Class: Paraduct::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/paraduct/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



46
47
48
# File 'lib/paraduct/cli.rb', line 46

def self.source_root
  File.expand_path(File.join(File.dirname(__FILE__), "templates"))
end

Instance Method Details

#generateObject



41
42
43
44
# File 'lib/paraduct/cli.rb', line 41

def generate
  template(".paraduct.yml")
  template(".paraduct_rsync_exclude.txt")
end

#testObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/paraduct/cli.rb', line 18

def test
  script = Paraduct.config.script
  raise "require script" if script.blank?

  variables = Paraduct.config.variables
  raise "require variables" if variables.blank?

  product_variables = Paraduct::VariableConverter.product(variables)
  product_variables = Paraduct::VariableConverter.reject(product_variables, Paraduct.config.exclude)

  if options[:dry_run]
    product_variables.each do |params|
      runner = Paraduct::Runner.new(params: params)
      Paraduct.logger.info "[dry-run] params: #{runner.formatted_params}"
    end
  else
    test_response = Paraduct::ParallelRunner.perform_all(script, product_variables)
    Paraduct.logger.info test_response.detail_message
    raise Paraduct::Errors::TestFailureError if test_response.failure?
  end
end

#versionObject



11
12
13
# File 'lib/paraduct/cli.rb', line 11

def version
  puts Paraduct::VERSION
end