hunk.code_window:       },
         run: {
           command: [
             'docker stop portainer',
             'docker rm portainer',
             'docker run --privileged -d -p 9000:9000 -v /tmp/portainer:/data -v /var/run/docker.sock:/var/run/docker.sock --name portainer portainer'
           ].join(';')
         },
         runSwarm: {
           command: [
  
hunk.labels: keep keep keep keep keep replace keep keep keep keep
hunk.after_edit:           'docker run --privileged -d -p 9000:9000 -v /tmp/portainer:/data -v /var/run/docker.sock:/var/run/docker.sock --name portainer portainer --no-analytics'
  
hunk.file_path: gruntfile.js
hunk.type: replace
file: angular.module('portainer.services')
  .factory('StateManager', ['$q', 'Config', 'Info', 'InfoHelper', 'Version', 'LocalStorage', function StateManagerFactory($q, Config, Info, InfoHelper, Version, LocalStorage) {
    'use strict';
  
    var state = {
      loading: true,
      application: {},
      endpoint: {}
    };
  
    return {
      initialize: function() {
        var endpointState = LocalStorage.getEndpointState();
        if (endpointState) {
          state.endpoint = endpointState;
        }
  
        var deferred = $q.defer();
        var applicationState = LocalStorage.getApplicationState();
        if (applicationState) {
          state.application = applicationState;
          state.loading = false;
          deferred.resolve(state);
        } else {
          Config.$promise.then(function success(data) {
            state.application.authentication = data.authentication;
            state.application.logo = data.logo;
            LocalStorage.storeApplicationState(state.application);
            state.loading = false;
            deferred.resolve(state);
          }, function error(err) {
            state.loading = false;
            deferred.reject({msg: 'Unable to retrieve server configuration', err: err});
          });
        }
        return deferred.promise;
      },
      clean: function() {
        state.endpoint = {};
      },
      updateEndpointState: function(loading) {
        var deferred = $q.defer();
        if (loading) {
          state.loading = true;
        }
        $q.all([Info.get({}).$promise, Version.get({}).$promise])
        .then(function success(data) {
          var endpointMode = InfoHelper.determineEndpointMode(data[0]);
          var endpointAPIVersion = parseFloat(data[1].ApiVersion);
          state.endpoint.mode = endpointMode;
          state.endpoint.apiVersion = endpointAPIVersion;
          LocalStorage.storeEndpointState(state.endpoint);
          state.loading = false;
          deferred.resolve();
        }, function error(err) {
          state.loading = false;
          deferred.reject({msg: 'Unable to connect to the Docker endpoint', err: err});
        });
        return deferred.promise;
      },
      getState: function() {
        return state;
      }
    };
  }]);
  