/
jeweler
executable file
·72 lines (57 loc) · 2.4 KB
/
jeweler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env ruby
require 'rubygems'
require 'optparse'
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'jeweler'
class JewelerOpts < Hash
attr_reader :opts
def initialize(args)
super()
self[:test_style] = :shoulda
@opts = OptionParser.new do |o|
o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
o.on('--bacon', 'generate bacon specs') do
self[:test_style] = :bacon
end
o.on('--shoulda', 'generate shoulda tests') do
self[:test_style] = :shoulda
end
o.on('--create-repo', 'create the repository on GitHub') do
self[:create_repo] = true
end
o.on('--summary [SUMMARY]', 'specify the summary of the project') do |summary|
self[:summary] = summary
end
o.on_tail('-h', '--help', 'display this help and exit') do
puts o
exit
end
end
@opts.parse!(args)
end
end
options = JewelerOpts.new(ARGV)
unless ARGV.size == 1
puts options.opts
exit 1
end
github_repo_name = ARGV.first
begin
generator = Jeweler::Generator.new github_repo_name, options
generator.run
rescue Jeweler::NoGitUserName
$stderr.puts %Q{No user.name found in ~/.gitconfig. Please tell git about yourself (see http://github.com/guides/tell-git-your-user-name-and-email-address for details). For example: git config --global user.name "mad voo"}
exit 1
rescue Jeweler::NoGitUserEmail
$stderr.puts %Q{No user.email found in ~/.gitconfig. Please tell git about yourself (see http://github.com/guides/tell-git-your-user-name-and-email-address for details). For example: git config --global user.email mad.vooo@gmail.com}
exit 1
rescue Jeweler::NoGitHubUser
$stderr.puts %Q{No github.user found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.user defunkt}
exit 1
rescue Jeweler::NoGitHubToken
$stderr.puts %Q{No github.token found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.token 6ef8395fecf207165f1a82178ae1b984}
exit 1
rescue Jeweler::FileInTheWay
$stderr.puts "The directory #{github_repo_name} already exists. Maybe move it out of the way before continuing?"
exit 1
end