Class: RRSE::Command::SetUpConfig
- Inherits:
-
Object
- Object
- RRSE::Command::SetUpConfig
- Defined in:
- lib/rrse/setup-command.rb
Constant Summary collapse
- DEFAULT_CONFIG =
{ "sources" => [ {"type" => "bitclust", "config" => "~/.bitclust/config"} ] }
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(dir) ⇒ SetUpConfig
constructor
A new instance of SetUpConfig.
- #options ⇒ Object
- #run(argv) ⇒ Object
Constructor Details
#initialize(dir) ⇒ SetUpConfig
Returns a new instance of SetUpConfig.
16 17 18 |
# File 'lib/rrse/setup-command.rb', line 16 def initialize(dir) @dir = dir end |
Class Method Details
.short_description ⇒ Object
12 13 14 |
# File 'lib/rrse/setup-command.rb', line 12 def self.short_description "setup config file" end |
Instance Method Details
#options ⇒ Object
20 21 22 23 24 |
# File 'lib/rrse/setup-command.rb', line 20 def opts = OptionParser.new opts. = "Usage: rrse [global-options] setup-config" opts end |
#run(argv) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/rrse/setup-command.rb', line 26 def run(argv) .order!(argv) FileUtils.mkdir_p(@dir) config_path = @dir + "config" IO.write(config_path, YAML.dump(DEFAULT_CONFIG)) end |