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



29
30
31
# File 'lib/jenkins.rb', line 29

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

Instance Method Details

#new_projectObject



21
22
23
24
25
26
27
# File 'lib/jenkins.rb', line 21

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
16
17
# File 'lib/jenkins.rb', line 13

def preflight
  jenkins_password
  jenkins_user
  jenkins_server =~ /^http/ or abort "jenkins_server must be a fully qualified http or https URL" # sanity check
end