Class: RailsInstaller::Command::Config

Inherits:
RailsInstaller::Command show all
Defined in:
lib/rails-installer/commands.rb

Overview

The config command controls the installation’s config parameters. Running ‘installer config /some/path’ will show all of the config parameters for the installation in /some/path. You can set params with ‘key=value’, or clear them with ‘key=’.

Class Method Summary collapse

Methods inherited from RailsInstaller::Command

commands, flag_help, flag_help_text, help, help_text, inherited

Class Method Details

.command(installer, *args) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/rails-installer/commands.rb', line 107

def self.command(installer, *args)
  if args.size == 0
    installer.config.keys.sort.each do |k|
      puts "#{k}=#{installer.config[k]}"
    end
  else
    args.each do |arg|
      if(arg=~/^([^=]+)=(.*)$/)
        if $2.to_s.empty?
          installer.config.delete($1.to_s)
        else
          installer.config[$1.to_s]=$2.to_s
        end
      else
        puts installer.config[arg]
      end
    end
    installer.save
  end
end