Class: SunRaise::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/config.rb

Overview

configurator class

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/config.rb', line 41

def initialize
  @callbacks = {:after => ''}
  @conf = {
    :verbose => false, 
    :local_project_path => '.', 
    :release => true, 
    :test_rails_app => true, 
    :auto_migrate => true,
    :help => false
  }
  cl_options
end

Class Attribute Details

.config_methodsObject

Returns the value of attribute config_methods.



12
13
14
# File 'lib/config.rb', line 12

def config_methods
  @config_methods
end

Instance Attribute Details

#callbacksObject

Returns the value of attribute callbacks.



9
10
11
# File 'lib/config.rb', line 9

def callbacks
  @callbacks
end

#confObject

Returns the value of attribute conf.



9
10
11
# File 'lib/config.rb', line 9

def conf
  @conf
end

Instance Method Details

#cl_optionsObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/config.rb', line 54

def cl_options
  OptionParser.new do |opts|
    opts.on("-v", "--[no-]verbose", "Run verbosely") do |verbose|
      @conf[:verbose] = verbose
    end
            
    opts.on("-f", "--[no-]force", "Deploy even there are no new commits") do |force|
      @conf[:force] = force
    end

    opts.on("-n", "--no-reelase", "Do not replace 'current' dir and start test server") do |no_release|
      @conf[:release] = !no_release
    end

    opts.on("--remake", "Delete current deploy and make initial deploy") do |remake|
      @conf[:remake] = remake
    end

    opts.on("-d", "--destroy", "Delete current deploy and make initial deploy") do |destroy|
      @conf[:destroy] = destroy
    end

    opts.on("-h", "--help", "Show this help") do |help|
      @conf[:help] = true
      puts opts
    end
  end.parse!
end