Class: Jenkins::Plugin::CLI::New

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/jenkins/plugin/cli/new.rb

Instance Method Summary collapse

Instance Method Details

#create_gemfileObject



14
15
16
# File 'lib/jenkins/plugin/cli/new.rb', line 14

def create_gemfile
  template('templates/Gemfile.tt', "#{name}/Gemfile")
end

#create_pluginspecObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jenkins/plugin/cli/new.rb', line 18

def create_pluginspec
  git_name = %x[git config user.name].chomp
  git_email = %x[git config user.email].chomp

  developer_id = git_email.split('@', 2).first || ''

  # Fallback values.
  git_name = 'TODO: Put your realname here' if git_name.empty?
  git_email = '[email protected]' if git_email.empty?

  opts = {
    :developer_id => developer_id.empty? ? 'TODO: Put your jenkins-ci.org username here.' : developer_id,
    :developer_name => "#{git_name} <#{git_email}>"
  }

  template('templates/pluginspec.tt', "#{name}/#{name}.pluginspec", opts)
end