Class: Agave::Dump::Runner
- Inherits:
-
Object
- Object
- Agave::Dump::Runner
- Defined in:
- lib/agave/dump/runner.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#destination_path ⇒ Object
readonly
Returns the value of attribute destination_path.
-
#preview_mode ⇒ Object
readonly
Returns the value of attribute preview_mode.
Instance Method Summary collapse
-
#initialize(config_path, client, preview_mode, destination_path = Dir.pwd) ⇒ Runner
constructor
A new instance of Runner.
- #loader ⇒ Object
- #operation ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(config_path, client, preview_mode, destination_path = Dir.pwd) ⇒ Runner
Returns a new instance of Runner.
12 13 14 15 16 17 |
# File 'lib/agave/dump/runner.rb', line 12 def initialize(config_path, client, preview_mode, destination_path = Dir.pwd) @config_path = config_path @preview_mode = preview_mode @client = client @destination_path = destination_path end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'lib/agave/dump/runner.rb', line 10 def client @client end |
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
10 11 12 |
# File 'lib/agave/dump/runner.rb', line 10 def config_path @config_path end |
#destination_path ⇒ Object (readonly)
Returns the value of attribute destination_path.
10 11 12 |
# File 'lib/agave/dump/runner.rb', line 10 def destination_path @destination_path end |
#preview_mode ⇒ Object (readonly)
Returns the value of attribute preview_mode.
10 11 12 |
# File 'lib/agave/dump/runner.rb', line 10 def preview_mode @preview_mode end |
Instance Method Details
#loader ⇒ Object
42 43 44 |
# File 'lib/agave/dump/runner.rb', line 42 def loader @loader ||= Agave::Local::Loader.new(client, preview_mode) end |
#operation ⇒ Object
38 39 40 |
# File 'lib/agave/dump/runner.rb', line 38 def operation @operation ||= Operation::Root.new(destination_path) end |
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/agave/dump/runner.rb', line 19 def run print 'Fetching content from AgaveCMS... ' loader.load I18n.available_locales = loader.items_repo.available_locales I18n.locale = I18n.available_locales.first Dsl::Root.new( File.read(config_path), loader.items_repo, operation ) operation.perform puts "\e[32m✓\e[0m Done!" end |