Class: Jenkins

Inherits:
Thor
  • Object
show all
Includes:
GitConfig, Thor::Actions
Defined in:
lib/jenkins.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from GitConfig

#author, #email, #github_token, #github_user, #jenkins_password, #jenkins_server, #jenkins_user

Instance Attribute Details

#secretObject (readonly)

Returns the value of attribute secret.



10
11
12
# File 'lib/jenkins.rb', line 10

def secret
  @secret
end

Class Method Details

.source_rootObject



27
28
29
# File 'lib/jenkins.rb', line 27

def self.source_root
  File.join(File.dirname(File.expand_path(__FILE__)), '..', 'templates')
end

Instance Method Details

#new_projectObject



19
20
21
22
23
24
25
# File 'lib/jenkins.rb', line 19

def new_project
  @secret = UUID.new.generate
  config = ERB.new(File.read File.join(Jenkins.source_root, 'config_xml.tt'))
  jenkins_post "/createItem/api/xml?name=#{name}", config.result(binding)
  announce "new project on jenkins"
  invoke 'github:attach', [name], :token => @secret
end

#preflightObject



13
14
15
# File 'lib/jenkins.rb', line 13

def preflight
  jenkins_password && jenkins_user
end