Class: Jenkins::Configuration
- Inherits:
-
Object
- Object
- Jenkins::Configuration
- Defined in:
- lib/jenkins-rails/configuration.rb
Instance Method Summary collapse
- #config ⇒ Object
- #host ⇒ Object
-
#initialize(config_file) ⇒ Configuration
constructor
A new instance of Configuration.
- #jobs ⇒ Object
- #params ⇒ Object
- #password ⇒ Object
- #port ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(config_file) ⇒ Configuration
Returns a new instance of Configuration.
3 4 5 6 |
# File 'lib/jenkins-rails/configuration.rb', line 3 def initialize(config_file) raise "Config file #{config_file} is missing!" if !File.exist? config_file @config_file = config_file end |
Instance Method Details
#config ⇒ Object
35 36 37 |
# File 'lib/jenkins-rails/configuration.rb', line 35 def config @config ||= ActiveSupport::HashWithIndifferentAccess.new(YAML.load(ERB.new(File.read(@config_file)).result)) end |
#host ⇒ Object
16 17 18 |
# File 'lib/jenkins-rails/configuration.rb', line 16 def host config[:host] end |
#jobs ⇒ Object
24 25 26 |
# File 'lib/jenkins-rails/configuration.rb', line 24 def jobs config[:jobs] ||= [] end |
#params ⇒ Object
28 29 30 31 32 33 |
# File 'lib/jenkins-rails/configuration.rb', line 28 def params jobs.each_index do |i| jobs[i][:shell_command] = File.read(script_file(jobs[i][:shell_script])) end jobs end |
#password ⇒ Object
12 13 14 |
# File 'lib/jenkins-rails/configuration.rb', line 12 def password config[:password] end |
#port ⇒ Object
20 21 22 |
# File 'lib/jenkins-rails/configuration.rb', line 20 def port config[:port] end |
#username ⇒ Object
8 9 10 |
# File 'lib/jenkins-rails/configuration.rb', line 8 def username config[:username] end |