Class: Gigawatt::Commands::Sync
- Inherits:
-
Object
- Object
- Gigawatt::Commands::Sync
- Defined in:
- lib/gigawatt/commands/sync.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(settings, options) ⇒ Sync
constructor
A new instance of Sync.
- #sync ⇒ Object
- #sync_current ⇒ Object
Constructor Details
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/gigawatt/commands/sync.rb', line 4 def @options end |
Class Method Details
.run!(settings) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gigawatt/commands/sync.rb', line 6 def self.run!(settings) = Trollop:: do <<-EOS 88 Miles Command line application - http://88miles.net 88 Miles caches your company and project list to speed things up. Run this command if you add, edit or remove companies or projects If run inside a directory with a linked project, the linked project will be updated too Usage 88miles sync EOS end instance = self.new(settings, ) begin instance.sync instance.sync_current rescue OAuth2::Error => e say "Access to your 88 Miles may have been revoked. Please run <%= color('88miles setup', BOLD) %> again." return INVALID_OAUTH_TOKEN_EXIT_CODE end return 0 end |
Instance Method Details
#sync ⇒ Object
40 41 42 |
# File 'lib/gigawatt/commands/sync.rb', line 40 def sync @cache.refresh! end |
#sync_current ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/gigawatt/commands/sync.rb', line 44 def sync_current project = Gigawatt::ProjectFile.new.project if project response = JSON.parse(@access_key.get("/api/1/projects/#{project["uuid"]}.json").body) ProjectFile.write(response["response"]) end end |