Class: Spout::Commands::Help

Inherits:
Object
  • Object
show all
Defined in:
lib/spout/commands/help.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Help

Returns a new instance of Help.



6
7
8
# File 'lib/spout/commands/help.rb', line 6

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

Instance Method Details

#coverage_reportObject



108
109
110
111
112
113
114
115
# File 'lib/spout/commands/help.rb', line 108

def coverage_report
  puts <<-EOT
Usage: spout coverage

Generates `coverage/index.html` that can be viewed in browser.

EOT
end

#deployObject



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/spout/commands/help.rb', line 145

def deploy
  puts <<-EOT
Usage: spout deploy NAME

NAME is the name of the webserver listed in `.spout.yml` file
Optional Flags:
  --clean               Regenerate all variables (default is to
                  resume where command last left off)
  --rows=N              Limit the number of rows read from CSVs
                  to a maximum of N rows
  <variable>            Only deploy specified variable(s)
                  Ex: spout deploy production age gender
  --skip-checks         Skip git tag and version checks
  --skip-tests          Skip data dictionary tests
  --skip-coverage       Skip dataset coverage check
  --skip-variables      Skip upload of dataset variables
  --skip-dataset        Skip upload of dataset CSVs
  --skip-dictionary     Skip upload of data dictionary
  --skip-documentation  Skip upload of CHANGELOG.md and
                  KNOWNISSUES.md
  --skip-server-scripts Skips server refreshing datasets folder
                  to list newly uploaded files
  --archive-only        Only upload files to the datasets/archive
                  folder and not in the root datasets folder
  --token=TOKEN         Provide token via command-line for
                  automated processes

More information here:

https://github.com/sleepepi/spout#deploy-your-data-dictionary-to-a-staging-or-production-webserver

EOT
end

#exporterObject



95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/spout/commands/help.rb', line 95

def exporter
  puts <<-EOT
Usage: spout export

Exports data dictionary to CSV format.

More information here:

https://github.com/sleepepi/spout#create-a-csv-data-dictionary-from-your-json-repository

EOT
end

#generate_charts_and_tablesObject



117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/spout/commands/help.rb', line 117

def generate_charts_and_tables
  puts <<-EOT
Usage: spout graphs

Optional Flags:
  --clean       Regenerate all graphs (default is to resume
          where command last left off)
  --rows=N      Limit the number of rows read from CSVs to a
          maximum of N rows
  <variable>    Only generate graphs for the specified variable(s)
          Ex: spout graphs age gender

EOT
end

#helpObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/spout/commands/help.rb', line 10

def help
  puts <<-EOT
Usage: spout COMMAND [ARGS]

The most common spout commands are:
  [n]ew             Create a new Spout dictionary.
              `spout new <project_name>` creates a new
              data dictionary in `./<project_name>`
  [t]est            Run tests and show failing tests
  [i]mport          Import a CSV file into the JSON dictionary
  [e]xport [1.0.0]  Export the JSON dictionary to CSV format
  [c]overage        Coverage report, requires dataset CSVs
              in `<project_name>/csvs/<version>`
  [o]utliers        Outlier report, requires dataset CSVs
              in `<project_name>/csvs/<version>`
  [g]raphs          Generates JSON graphs for each variable
              in a dataset and places them
              in `<project_name>/graphs/<version>/`
  [d]eploy NAME     Push dataset and data dictionary to a
              webserver specified in `.spout.yml`
  [u]pdate          Update the Spout gem
  [v]ersion         Returns the version of Spout

Commands can be referenced by the first letter:
  Ex: `spout t`, for test

You can also get more in depth help by typing:
  Ex: `spout help deploy`, to list all deploy flags

EOT
end

#importerObject



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/spout/commands/help.rb', line 80

def importer
  puts <<-EOT
Usage: spout import <csv_file>

Optional Flags:
  --domains    Specify to import CSV of domains
  --forms      Specify to import CSV of forms

More information:
https://github.com/sleepepi/spout#generate-a-new-repository-from-an-existing-csv-file
https://github.com/sleepepi/spout#importing-domains-from-an-existing-csv-file
https://github.com/sleepepi/spout#importing-forms-from-an-existing-csv-file
EOT
end

#new_projectObject



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/spout/commands/help.rb', line 42

def new_project
  puts <<-EOT
Usage: spout new <project_name> [--skip-gemfile]

Use `--skip-gemfile` to skip installing gems after project creation.

More information here:

https://github.com/sleepepi/spout#generate-a-new-repository-from-an-existing-csv-file

EOT
end

#outliers_reportObject



132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/spout/commands/help.rb', line 132

def outliers_report
  puts <<-EOT
Usage: spout outliers

Generates `coverage/outliers.html` that can be viewed in browser.

More information here:

https://github.com/sleepepi/spout#identify-outliers-in-your-dataset

EOT
end

#testObject



64
65
66
67
68
69
# File 'lib/spout/commands/help.rb', line 64

def test
  puts <<-EOT
Usage: spout test

EOT
end

#updateObject



71
72
73
74
75
76
77
78
# File 'lib/spout/commands/help.rb', line 71

def update
  puts <<-EOT
Usage: spout update

Checks if a newer version of Spout is available.

EOT
end

#versionObject



55
56
57
58
59
60
61
62
# File 'lib/spout/commands/help.rb', line 55

def version
  puts <<-EOT
Usage: spout version

Returns version of spout.

EOT
end