Class: AdminModule::Command::Config

Inherits:
Thor
  • Object
show all
Defined in:
lib/admin_module/command/config.rb

Defined Under Namespace

Classes: Add, Del, Show

Instance Method Summary collapse

Instance Method Details

#amsversion(version = nil) ⇒ Object



300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/admin_module/command/config.rb', line 300

def amsversion(version=nil)
  if version.nil?
    with_loaded_config do
      say "ams version: #{AdminModule.configuration.ams_version}"
    end
    return
  end

  with_loaded_config(true) do
    AdminModule.configuration.ams_version = version
  end
end

#defcomment(comment = nil) ⇒ Object



280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/admin_module/command/config.rb', line 280

def defcomment(comment=nil)
  if comment.nil?
    with_loaded_config do
      say "default comment: #{AdminModule.configuration.default_comment}"
    end
    return
  end

  with_loaded_config(true) do
    AdminModule.configuration.default_comment = comment
  end
end

#defenv(envname = nil) ⇒ Object



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/admin_module/command/config.rb', line 253

def defenv(envname=nil)
  if envname.nil?
    with_loaded_config do
      say "default environment: #{AdminModule.configuration.default_environment}"
    end
    return
  end

  with_loaded_config(true) do
    if AdminModule.configuration.base_urls.key? envname.to_sym
      AdminModule.configuration.default_environment = envname.to_sym
    else
      say "argument error: environment '#{envname}' has not been configured", :red
    end
  end
end

#init(filedir = nil) ⇒ Object



214
215
216
217
# File 'lib/admin_module/command/config.rb', line 214

def init(filedir = nil)
  outpath = AdminModule.save_configuration filedir
  say("configuration written to #{outpath.to_s}", :green) unless options[:quiet]
end

#timeout(seconds = nil) ⇒ Object



229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/admin_module/command/config.rb', line 229

def timeout(seconds=nil)
  if seconds.nil?
    with_loaded_config do
      say "browser timeout: #{AdminModule.configuration.browser_timeout}"
    end
  else
    seconds = Integer(seconds)
    with_loaded_config(true) do
      AdminModule.configuration.browser_timeout = seconds
    end
  end
rescue ArgumentError => e
  say 'argument error: seconds must be an integer', :red
end