Class: Doggy::CLI::Pull
- Inherits:
-
Object
- Object
- Doggy::CLI::Pull
- Defined in:
- lib/doggy/cli/pull.rb
Instance Method Summary collapse
-
#initialize(options, ids) ⇒ Pull
constructor
A new instance of Pull.
- #run ⇒ Object
Constructor Details
#initialize(options, ids) ⇒ Pull
Returns a new instance of Pull.
8 9 10 11 |
# File 'lib/doggy/cli/pull.rb', line 8 def initialize(, ids) @options = @ids = ids end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/doggy/cli/pull.rb', line 13 def run @local_resources = Doggy::Model.all_local_resources if @ids.empty? Parallel.each(@local_resources) do |local_resource| if remote_resource = local_resource.class.find(local_resource.id) remote_resource.path = local_resource.path remote_resource.save_local else local_resource.destroy_local end end else @ids.each { |id| pull_by_id(id.to_i) } end end |