Module: Spout

Defined in:
lib/spout.rb,
lib/spout/tests.rb,
lib/spout/version.rb,
lib/spout/models/form.rb,
lib/spout/models/empty.rb,
lib/spout/commands/help.rb,
lib/spout/models/bucket.rb,
lib/spout/models/domain.rb,
lib/spout/models/option.rb,
lib/spout/models/record.rb,
lib/spout/models/tables.rb,
lib/spout/models/subject.rb,
lib/spout/commands/deploy.rb,
lib/spout/commands/graphs.rb,
lib/spout/commands/update.rb,
lib/spout/helpers/quietly.rb,
lib/spout/models/variable.rb,
lib/spout/helpers/semantic.rb,
lib/spout/commands/coverage.rb,
lib/spout/commands/exporter.rb,
lib/spout/commands/importer.rb,
lib/spout/commands/outliers.rb,
lib/spout/helpers/framework.rb,
lib/spout/helpers/iterators.rb,
lib/spout/helpers/send_file.rb,
lib/spout/helpers/send_json.rb,
lib/spout/models/dictionary.rb,
lib/spout/models/graphables.rb,
lib/spout/helpers/csv_reader.rb,
lib/spout/helpers/chart_types.rb,
lib/spout/helpers/json_loader.rb,
lib/spout/tests/domain_format.rb,
lib/spout/commands/test_runner.rb,
lib/spout/helpers/json_request.rb,
lib/spout/helpers/config_reader.rb,
lib/spout/helpers/number_helper.rb,
lib/spout/models/outlier_result.rb,
lib/spout/models/tables/default.rb,
lib/spout/tests/form_name_match.rb,
lib/spout/tests/json_validation.rb,
lib/spout/helpers/subject_loader.rb,
lib/spout/models/coverage_result.rb,
lib/spout/tests/domain_specified.rb,
lib/spout/tests/form_name_format.rb,
lib/spout/helpers/array_statistics.rb,
lib/spout/helpers/table_formatting.rb,
lib/spout/tests/domain_name_format.rb,
lib/spout/models/graphables/default.rb,
lib/spout/tests/variable_name_match.rb,
lib/spout/commands/project_generator.rb,
lib/spout/tests/form_name_uniqueness.rb,
lib/spout/tests/variable_name_format.rb,
lib/spout/models/graphables/histogram.rb,
lib/spout/tests/domain_name_uniqueness.rb,
lib/spout/tests/variable_name_uniqueness.rb,
lib/spout/tests/variable_type_validation.rb,
lib/spout/tests/form_existence_validation.rb,
lib/spout/models/tables/choices_vs_choices.rb,
lib/spout/models/tables/choices_vs_numeric.rb,
lib/spout/models/tables/numeric_vs_choices.rb,
lib/spout/models/tables/numeric_vs_numeric.rb,
lib/spout/tests/domain_existence_validation.rb,
lib/spout/tests/variable_display_name_length.rb,
lib/spout/models/graphables/choices_vs_choices.rb,
lib/spout/models/graphables/choices_vs_numeric.rb,
lib/spout/models/graphables/numeric_vs_choices.rb,
lib/spout/models/graphables/numeric_vs_numeric.rb

Overview

Launch spout commands from command line.

Defined Under Namespace

Modules: Commands, Helpers, Models, Tests, VERSION

Constant Summary collapse

COMMANDS =
{
  "c" => :coverage_report,
  "d" => :deploy,
  "e" => :exporter,
  "g" => :generate_charts_and_tables,
  "i" => :importer,
  "n" => :new_project,
  "o" => :outliers_report,
  "t" => :test,
  "u" => :update,
  "v" => :version
}

Class Method Summary collapse

Class Method Details

.coverage_report(argv) ⇒ Object



32
33
34
35
36
37
# File 'lib/spout.rb', line 32

def self.coverage_report(argv)
  require "spout/commands/coverage"
  Spout::Commands::Coverage.new(standard_version, argv)
rescue NoMemoryError
  puts "[NoMemoryError] You made Spout cry... Spout doesn't run on potatoes :'-("
end

.deploy(argv) ⇒ Object



55
56
57
58
# File 'lib/spout.rb', line 55

def self.deploy(argv)
  require "spout/commands/deploy"
  Spout::Commands::Deploy.new(argv, standard_version)
end

.exporter(argv) ⇒ Object



39
40
41
42
# File 'lib/spout.rb', line 39

def self.exporter(argv)
  require "spout/commands/exporter"
  Spout::Commands::Exporter.new(standard_version, argv)
end

.generate_charts_and_tables(argv) ⇒ Object



44
45
46
47
48
# File 'lib/spout.rb', line 44

def self.generate_charts_and_tables(argv)
  argv = argv.last(argv.size - 1)
  require "spout/commands/graphs"
  Spout::Commands::Graphs.new(argv, standard_version)
end

.help(argv) ⇒ Object



50
51
52
53
# File 'lib/spout.rb', line 50

def self.help(argv)
  require "spout/commands/help"
  Spout::Commands::Help.new(argv)
end

.importer(argv) ⇒ Object



60
61
62
63
# File 'lib/spout.rb', line 60

def self.importer(argv)
  require "spout/commands/importer"
  Spout::Commands::Importer.new(argv)
end

.launch(argv) ⇒ Object



23
24
25
# File 'lib/spout.rb', line 23

def self.launch(argv)
  send((Spout::COMMANDS[argv.first.to_s.scan(/\w/).first] || :help), argv)
end

.new_project(argv) ⇒ Object



27
28
29
30
# File 'lib/spout.rb', line 27

def self.new_project(argv)
  require "spout/commands/project_generator"
  Spout::Commands::ProjectGenerator.new(argv)
end

.outliers_report(argv) ⇒ Object



65
66
67
68
# File 'lib/spout.rb', line 65

def self.outliers_report(argv)
  require "spout/commands/outliers"
  Spout::Commands::Outliers.new(standard_version, argv)
end

.standard_versionObject



84
85
86
87
88
89
# File 'lib/spout.rb', line 84

def self.standard_version
  version = File.open("VERSION", &:readline).strip
  version == "" ? "1.0.0" : version
rescue
  "1.0.0"
end

.test(_argv) ⇒ Object



70
71
72
73
# File 'lib/spout.rb', line 70

def self.test(_argv)
  require "spout/commands/test_runner"
  Spout::Commands::TestRunner.run
end

.update(argv) ⇒ Object



75
76
77
78
# File 'lib/spout.rb', line 75

def self.update(argv)
  require "spout/commands/update"
  Spout::Commands::Update.start(argv)
end

.version(_argv) ⇒ Object



80
81
82
# File 'lib/spout.rb', line 80

def self.version(_argv)
  puts "Spout #{Spout::VERSION::STRING}"
end