technicalpickles-jeweler 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -75,14 +75,16 @@ Here's a rundown of what's happening:
75
75
 
76
76
  ## Bootstrap a new project
77
77
 
78
- Before proceeding, take a minute to setup your git environment, specifically your name and email address:
78
+ Before proceeding, take a minute to setup your git environment, specifically your name, email address, and GitHub username
79
79
 
80
80
  $ git config --global user.email johndoe@example.com
81
81
  $ git config --global user.name 'John Doe'
82
+ $ git config --global github.user johndoe
83
+ $ git config --global github.token 55555555555555
82
84
 
83
- Jeweler provides a generator of sorts, `jeweler`. It takes two arguments: your GitHub username and a repository name.
85
+ Jeweler provides a generator of sorts, `jeweler`. It requires only argument, the name of a repo you want to create. It also takes a few options: --[shoulda](http://github.com/thoughtbot/shoulda) and --[bacon](http://github.com/chneukirchen/bacon/tree/master). These control what type of tests are created, with the default being shoulda.
84
86
 
85
- $ jeweler technicalpickles the-perfect-gem
87
+ $ jeweler --create-repo the-perfect-gem
86
88
 
87
89
  Basically, this does:
88
90
 
@@ -96,14 +98,9 @@ Basically, this does:
96
98
  * `test/the_perfect_gem.rb`, placeholder failing test
97
99
  * `lib/the_perfect_gem.rb`, placeholder library file
98
100
  * Makes it a git repo
99
- * Sets up `git@github.com:technicalpickles/jeweler.git` as the `origin` git remote
100
- * Makes an initial commit, but does not push
101
-
102
- At this point, you probably should create a repository by wandering to [http://github.com/repositories/new](http://github.com/repositories/new). Be sure to use the same project name you told Jeweler.
103
-
104
- With the repository firmly created, just push it:
105
-
106
- $ git push origin master
101
+ * Sets up `git@github.com:johndoe/jeweler.git` as the `origin` git remote
102
+ * Makes an initial commit
103
+ * Sets up a new repository on GitHub and pushes to it (omit --create-repo to skip this)
107
104
 
108
105
  You also probably should [enable RubyGem creation for you repository](http://github.com/blog/51-github-s-rubygem-server): Go to your project's edit page and check the 'RubyGem' box.
109
106
 
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- patch: 0
2
+ patch: 1
3
3
  major: 0
4
4
  minor: 6
data/bin/jeweler CHANGED
@@ -24,6 +24,10 @@ class JewelerOpts < Hash
24
24
  self[:test_style] = :shoulda
25
25
  end
26
26
 
27
+ o.on('--create-repo', 'create the repository on GitHub') do
28
+ self[:create_repo] = true
29
+ end
30
+
27
31
  o.on_tail('-h', '--help', 'display this help and exit') do
28
32
  puts o
29
33
  exit
@@ -38,6 +38,11 @@ class Jeweler
38
38
  Thread.new { eval("$SAFE = 3\n#{data}", binding, gemspec_path) }.join
39
39
  end
40
40
 
41
+ def unsafe_parse_gemspec(data = nil)
42
+ data ||= File.read(gemspec_path)
43
+ eval(data, binding, gemspec_path)
44
+ end
45
+
41
46
  protected
42
47
  def gemspec_path
43
48
  denormalized_path = File.join(@base_dir, "#{@gemspec.name}.gemspec")
@@ -45,4 +50,4 @@ class Jeweler
45
50
  absolute_path.gsub(Dir.getwd + File::SEPARATOR, '')
46
51
  end
47
52
  end
48
- end
53
+ end
@@ -1,6 +1,9 @@
1
1
  require 'git'
2
2
  require 'erb'
3
3
 
4
+ require 'net/http'
5
+ require 'uri'
6
+
4
7
  class Jeweler
5
8
  class NoGitUserName < StandardError
6
9
  end
@@ -12,14 +15,16 @@ class Jeweler
12
15
  end
13
16
  class NoGitHubUser < StandardError
14
17
  end
15
- class GitInitFailed < StandardError
18
+ class NoGitHubToken < StandardError
16
19
  end
17
-
20
+ class GitInitFailed < StandardError
21
+ end
18
22
 
19
- class Generator
23
+ class Generator
20
24
  attr_accessor :target_dir, :user_name, :user_email,
21
- :github_repo_name, :github_remote, :github_url, :github_username,
22
- :lib_dir, :constant_name, :file_name_prefix, :config, :test_style
25
+ :github_repo_name, :github_remote, :github_url, :github_username, :github_token,
26
+ :lib_dir, :constant_name, :file_name_prefix, :config, :test_style,
27
+ :repo, :should_create_repo
23
28
 
24
29
  def initialize(github_repo_name, options = {})
25
30
  check_user_git_config()
@@ -37,11 +42,17 @@ class Jeweler
37
42
  self.lib_dir = File.join(target_dir, 'lib')
38
43
  self.constant_name = self.github_repo_name.split(/[-_]/).collect{|each| each.capitalize }.join
39
44
  self.file_name_prefix = self.github_repo_name.gsub('-', '_')
45
+ self.should_create_repo = options[:create_repo]
40
46
  end
41
47
 
42
48
  def run
43
49
  create_files
44
50
  gitify
51
+ puts "Jeweler has prepared your gem in #{github_repo_name}"
52
+ if should_create_repo
53
+ create_and_push_repo
54
+ puts "Jeweler has pushed your repo to #{github_url}"
55
+ end
45
56
  end
46
57
 
47
58
  def testspec
@@ -73,8 +84,8 @@ class Jeweler
73
84
  output_template_in_target('Rakefile')
74
85
  output_template_in_target('LICENSE')
75
86
  output_template_in_target('README')
76
- output_template_in_target("#{testspec}/#{testspec}_helper.rb")
77
- output_template_in_target("#{testspec}/flunking_#{testspec}.rb", "#{testspec}/#{file_name_prefix}_#{testspec}.rb")
87
+ output_template_in_target("#{test_style}/#{testspec}_helper.rb", "#{testspec}/#{testspec}_helper.rb")
88
+ output_template_in_target("#{test_style}/flunking_#{testspec}.rb", "#{testspec}/#{file_name_prefix}_#{testspec}.rb")
78
89
 
79
90
  FileUtils.touch File.join(lib_dir, "#{file_name_prefix}.rb")
80
91
  end
@@ -93,10 +104,15 @@ class Jeweler
93
104
  unless config.has_key? 'github.user'
94
105
  raise NoGitHubUser, %Q{No github.user set in ~/.gitconfig. Set it with: git config --global github.user 'Your username here'}
95
106
  end
107
+
108
+ unless config.has_key? 'github.token'
109
+ raise NoGitHubToken, %Q{No github.token set in ~/.gitconfig. Set it with: git config --global github.token 'Your token here'}
110
+ end
96
111
 
97
112
  self.user_name = config['user.name']
98
113
  self.user_email = config['user.email']
99
114
  self.github_username = config['github.user']
115
+ self.github_token = config['github.token']
100
116
  end
101
117
 
102
118
  def output_template_in_target(source, destination = source)
@@ -110,26 +126,26 @@ class Jeweler
110
126
  Dir.chdir(target_dir)
111
127
  begin
112
128
  begin
113
- repo = Git.init()
129
+ @repo = Git.init()
114
130
  rescue Git::GitExecuteError => e
115
131
  raise GitInitFailed, "Encountered an error during gitification. Maybe the repo already exists, or has already been pushed to?"
116
132
  end
117
133
 
118
134
  begin
119
- repo.add('.')
135
+ @repo.add('.')
120
136
  rescue Git::GitExecuteError => e
121
137
  #raise GitAddFailed, "There was some problem adding this directory to the git changeset"
122
138
  raise
123
139
  end
124
140
 
125
141
  begin
126
- repo.commit "Initial commit to #{github_repo_name}."
142
+ @repo.commit "Initial commit to #{github_repo_name}."
127
143
  rescue Git::GitExecuteError => e
128
144
  raise
129
145
  end
130
146
 
131
147
  begin
132
- repo.add_remote('origin', github_remote)
148
+ @repo.add_remote('origin', github_remote)
133
149
  rescue Git::GitExecuteError => e
134
150
  puts "Encountered an error while adding origin remote. Maybe you have some weird settings in ~/.gitconfig?"
135
151
  raise
@@ -138,6 +154,15 @@ class Jeweler
138
154
  Dir.chdir(saved_pwd)
139
155
  end
140
156
  end
157
+
158
+ def create_and_push_repo
159
+ Net::HTTP.post_form URI.parse('http://github.com/repositories'),
160
+ 'login' => github_username,
161
+ 'token' => github_token,
162
+ 'repository[name]' => github_repo_name
163
+ sleep 2
164
+ @repo.push('origin')
165
+ end
141
166
 
142
167
  def read_git_config
143
168
  # we could just use Git::Base's .config, but that relies on a repo being around already
data/lib/jeweler/tasks.rb CHANGED
@@ -1,15 +1,18 @@
1
1
  require 'rake'
2
2
  require 'rake/tasklib'
3
+ require 'rubygems/builder'
3
4
 
4
5
  class Jeweler
5
6
  class Tasks < ::Rake::TaskLib
7
+ attr_accessor :gemspec, :jeweler
8
+
6
9
  def initialize(gemspec = nil, &block)
7
10
  @gemspec = gemspec || Gem::Specification.new()
8
11
  yield @gemspec if block_given?
9
12
 
10
13
  @jeweler = Jeweler.new(@gemspec)
11
14
 
12
- define_tasks
15
+ define
13
16
  end
14
17
 
15
18
  private
@@ -20,7 +23,13 @@ class Jeweler
20
23
  block.call if block
21
24
  end
22
25
 
23
- def define_tasks
26
+ def define
27
+ desc "Generate a gem"
28
+ task :gem => :'gemspec:validate' do
29
+ gemspec = @jeweler.unsafe_parse_gemspec
30
+ Gem::Builder.new(gemspec).build
31
+ end
32
+
24
33
  desc "Generate and validates gemspec"
25
34
  task :gemspec => ['gemspec:generate', 'gemspec:validate']
26
35
 
@@ -32,7 +32,7 @@ Rake::RDocTask.new do |rdoc|
32
32
  end
33
33
 
34
34
  Rcov::RcovTask.new do |t|
35
- t.libs << "<%= testspec %>"
35
+ t.libs << '<%= testspec %>'
36
36
  t.test_files = FileList['<%= testspec %>/**/*_<%= testspec %>.rb']
37
37
  t.verbose = true
38
38
  end
@@ -9,145 +9,104 @@ class JewelerTest < Test::Unit::TestCase
9
9
  end
10
10
  end
11
11
 
12
- def self.should_create_file(file)
13
- should "create file #{file}" do
14
- assert File.exists?(File.join(@tmp_dir, file))
15
- assert File.file?(File.join(@tmp_dir, file))
16
- end
17
- end
18
-
19
- def self.should_be_checked_in(file)
20
- should "have #{file} checked in" do
21
- status = @repo.status[file]
22
- assert_not_nil status, "wasn't able to get status for #{file}"
23
- assert ! status.untracked, "#{file} was untracked"
24
- assert_nil status.type, "#{file} had a type. it should have been nil"
12
+ def self.should_create_files(*files)
13
+ should "create #{files.join ', '}" do
14
+ files.each do |file|
15
+ assert File.exists?(File.join(@tmp_dir, file))
16
+ assert File.file?(File.join(@tmp_dir, file))
17
+ end
25
18
  end
26
19
  end
27
20
 
28
- context "given a nil github repo name" do
29
- setup do
30
- @block = lambda { Jeweler::Generator.new(nil) }
31
- end
32
-
33
- should "raise an error" do
34
- assert_raise Jeweler::NoGitHubRepoNameGiven do
35
- @block.call
21
+ def self.should_be_checked_in(*files)
22
+ should "have #{files.join ', '} checked in" do
23
+ files.each do |file|
24
+ status = @repo.status[file]
25
+ assert_not_nil status, "wasn't able to get status for #{file}"
26
+ assert ! status.untracked, "#{file} was untracked"
27
+ assert_nil status.type, "#{file} had a type. it should have been nil"
36
28
  end
37
29
  end
38
30
  end
39
-
40
- context "without git user's name set" do
41
- setup do
42
- Jeweler::Generator.any_instance.stubs(:read_git_config).returns({'user.email' => 'bar@example.com'})
43
- end
44
-
45
- context "instantiating new generator" do
31
+
32
+ def self.should_have_sane_license
33
+ context "LICENSE" do
46
34
  setup do
47
- @block = lambda { Jeweler::Generator.new('the-perfect-gem')}
35
+ @content = File.read((File.join(@tmp_dir, 'LICENSE')))
48
36
  end
49
37
 
50
- should "raise no git user name exception" do
51
- assert_raise Jeweler::NoGitUserName do
52
- @block.call
53
- end
38
+ should "include copyright for this year with user's name" do
39
+ assert_match 'Copyright (c) 2008 foo', @content
54
40
  end
55
41
  end
56
42
  end
57
-
58
- context "without git user's email set" do
59
- setup do
60
- Jeweler::Generator.any_instance.stubs(:read_git_config).returns({'user.name' => 'foo'})
61
- end
62
-
63
- context "instantiating new generator" do
43
+
44
+ def self.should_have_sane_gitignore
45
+ context ".gitignore" do
64
46
  setup do
65
- @block = lambda { Jeweler::Generator.new('the-perfect-gem')}
47
+ @content = File.read((File.join(@tmp_dir, '.gitignore')))
66
48
  end
67
49
 
68
- should "raise no git user name exception" do
69
- assert_raise Jeweler::NoGitUserEmail do
70
- @block.call
71
- end
50
+ should "include vim swap files" do
51
+ assert_match '*.sw?', @content
72
52
  end
73
- end
74
- end
75
-
76
- context "without github username set" do
77
- setup do
78
- Jeweler::Generator.any_instance.stubs(:read_git_config).
79
- returns({'user.email' => 'bar@example.com', 'user.name' => 'foo'})
80
- end
81
53
 
82
- context "instantiating new generator" do
83
- setup do
84
- @block = lambda { Jeweler::Generator.new('the-perfect-gem')}
54
+ should "include coverage" do
55
+ assert_match 'coverage', @content
85
56
  end
86
57
 
87
- should "raise no github user exception" do
88
- assert_raise Jeweler::NoGitHubUser do
89
- @block.call
90
- end
58
+ should "include .DS_Store" do
59
+ assert_match '.DS_Store', @content
91
60
  end
92
61
  end
93
62
  end
94
-
95
- context "with valid git user configuration" do
96
- setup do
97
- Jeweler::Generator.any_instance.stubs(:read_git_config).
98
- returns({'user.name' => 'foo', 'user.email' => 'bar@example.com', 'github.user' => 'technicalpickles'})
99
- end
100
-
101
- context "for technicalpickle's the-perfect-gem repository" do
63
+
64
+ def self.should_have_sane_rakefile(options)
65
+ context "Rakefile" do
102
66
  setup do
103
- @generator = Jeweler::Generator.new('the-perfect-gem')
104
- end
105
-
106
- should "assign 'foo' to user's name" do
107
- assert_equal 'foo', @generator.user_name
108
- end
109
-
110
- should "assign 'bar@example.com to user's email" do
111
- assert_equal 'bar@example.com', @generator.user_email
112
- end
113
-
114
- should "assign github remote" do
115
- assert_equal 'git@github.com:technicalpickles/the-perfect-gem.git', @generator.github_remote
67
+ @content = File.read((File.join(@tmp_dir, 'Rakefile')))
116
68
  end
117
69
 
118
- should "determine github username as technicalpickles" do
119
- assert_equal 'technicalpickles', @generator.github_username
70
+ should "include repo's name as the gem's name" do
71
+ assert_match 's.name = "the-perfect-gem"', @content
120
72
  end
121
73
 
122
- should "determine github repository name as the-perfect-gem" do
123
- assert_equal 'the-perfect-gem', @generator.github_repo_name
74
+ should "include the user's email as the gem's email" do
75
+ assert_match 's.email = "bar@example.com"', @content
124
76
  end
125
77
 
126
- should "determine github url as http://github.com/technicalpickles/the-perfect-gem" do
127
- assert_equal 'http://github.com/technicalpickles/the-perfect-gem', @generator.github_url
78
+ should "include the github repo's url as the gem's url" do
79
+ assert_match 's.homepage = "http://github.com/technicalpickles/the-perfect-gem"', @content
128
80
  end
129
81
 
130
- should "determine target directory as the same as the github repository name" do
131
- assert_equal @generator.github_repo_name, @generator.target_dir
82
+ should "include #{options[:pattern]} in the TestTask" do
83
+ assert_match "t.pattern = '#{options[:pattern]}'", @content
132
84
  end
133
85
 
134
- should "determine lib directory as being inside the target directory" do
135
- assert_equal File.join(@generator.target_dir, 'lib'), @generator.lib_dir
86
+ should "include #{options[:pattern]} in the RcovTask" do
87
+ assert_match "t.test_files = FileList['#{options[:pattern]}']", @content
136
88
  end
137
89
 
138
- should "determine test directory as being inside the target directory" do
139
- assert_equal File.join(@generator.target_dir, 'test'), @generator.test_dir
140
- end
141
-
142
- should "determine constant name as ThePerfectGem" do
143
- assert_equal 'ThePerfectGem', @generator.constant_name
144
- end
145
-
146
- should "determine file name prefix as the_perfect_gem" do
147
- assert_equal 'the_perfect_gem', @generator.file_name_prefix
90
+ should "push #{options[:libs]} dir into RcovTask libs" do
91
+ assert_match "t.libs << '#{options[:libs]}'", @content
148
92
  end
149
93
  end
94
+ end
95
+
96
+ def self.should_have_sane_origin_remote
97
+ should "have git@github.com:technicalpickles/the-perfect-gem.git as origin remote" do
98
+ assert_equal 1, @repo.remotes.size
99
+ remote = @repo.remotes.first
100
+ assert_equal 'origin', remote.name
101
+ assert_equal 'git@github.com:technicalpickles/the-perfect-gem.git', remote.url
102
+ end
103
+ end
150
104
 
105
+ context "with valid git user configuration" do
106
+ setup do
107
+ Jeweler::Generator.any_instance.stubs(:read_git_config).
108
+ returns({'user.name' => 'foo', 'user.email' => 'bar@example.com', 'github.user' => 'technicalpickles', 'github.token' => 'zomgtoken'})
109
+ end
151
110
 
152
111
  context "and cleaned out tmp directory" do
153
112
  setup do
@@ -161,7 +120,7 @@ class JewelerTest < Test::Unit::TestCase
161
120
  FileUtils.rm_rf(@tmp_dir)
162
121
  end
163
122
 
164
- context "for technicalpickles's the-perfect-gem repo and working directory 'tmp'" do
123
+ context "for generating technicalpickles's the-perfect-gem repo in 'tmp'" do
165
124
  setup do
166
125
  @generator = Jeweler::Generator.new('the-perfect-gem', :directory => @tmp_dir)
167
126
  end
@@ -170,9 +129,9 @@ class JewelerTest < Test::Unit::TestCase
170
129
  assert_equal @tmp_dir, @generator.target_dir
171
130
  end
172
131
 
173
- context "running for spec = false" do
132
+ context "running with default test style" do
174
133
  setup do
175
- @generator.run
134
+ @output = catch_out { @generator.run }
176
135
  end
177
136
 
178
137
  should 'create target directory' do
@@ -182,70 +141,11 @@ class JewelerTest < Test::Unit::TestCase
182
141
  should_create_directory 'lib'
183
142
  should_create_directory 'test'
184
143
 
185
- should_create_file 'LICENSE'
186
- should_create_file 'README'
187
- should_create_file 'lib/the_perfect_gem.rb'
188
- should_create_file 'test/test_helper.rb'
189
- should_create_file 'test/the_perfect_gem_test.rb'
190
- should_create_file '.gitignore'
191
-
192
- context "LICENSE" do
193
- setup do
194
- @content = File.read((File.join(@tmp_dir, 'LICENSE')))
195
- end
196
-
197
- should "include copyright for this year with user's name" do
198
- assert_match 'Copyright (c) 2008 foo', @content
199
- end
200
- end
201
-
202
- context "Rakefile" do
203
- setup do
204
- @content = File.read((File.join(@tmp_dir, 'Rakefile')))
205
- end
206
-
207
- should "include repo's name as the gem's name" do
208
- assert_match 's.name = "the-perfect-gem"', @content
209
- end
210
-
211
- should "include the user's email as the gem's email" do
212
- assert_match 's.email = "bar@example.com"', @content
213
- end
214
-
215
- should "include the github repo's url as the gem's url" do
216
- assert_match 's.homepage = "http://github.com/technicalpickles/the-perfect-gem"', @content
217
- end
218
-
219
- should "include a glob to match test files in the TestTask" do
220
- assert_match "t.pattern = 'test/**/*_test.rb'", @content
221
- end
222
-
223
- should "include a glob to match test files in the RcovTask" do
224
- assert_match "t.test_files = FileList['test/**/*_test.rb']", @content
225
- end
226
-
227
- should "push test dir into RcovTask libs" do
228
- assert_match 't.libs << "test"', @content
229
- end
230
- end
231
-
232
- context ".gitignore" do
233
- setup do
234
- @content = File.read((File.join(@tmp_dir, '.gitignore')))
235
- end
236
-
237
- should "include vim swap files" do
238
- assert_match '*.sw?', @content
239
- end
144
+ should_create_files 'LICENSE', 'README', 'lib/the_perfect_gem.rb', 'test/test_helper.rb', 'test/the_perfect_gem_test.rb', '.gitignore'
240
145
 
241
- should "include coverage" do
242
- assert_match 'coverage', @content
243
- end
244
-
245
- should "include .DS_Store" do
246
- assert_match '.DS_Store', @content
247
- end
248
- end
146
+ should_have_sane_rakefile :libs => 'test', :pattern => 'test/**/*_test.rb'
147
+ should_have_sane_license
148
+ should_have_sane_gitignore
249
149
 
250
150
 
251
151
  context "test/the_perfect_gem_test.rb" do
@@ -264,22 +164,13 @@ class JewelerTest < Test::Unit::TestCase
264
164
  @repo = Git.open(@tmp_dir)
265
165
  end
266
166
 
267
- should 'have one commit log' do
268
- assert_equal 1, @repo.log.size
269
- end
270
-
271
167
  should "have one commit log an initial commit message" do
168
+ assert_equal 1, @repo.log.size
272
169
  # TODO message seems to include leading whitespace, could probably fix that in ruby-git
273
170
  assert_match 'Initial commit to the-perfect-gem.', @repo.log.first.message
274
171
  end
275
172
 
276
- should_be_checked_in 'README'
277
- should_be_checked_in 'Rakefile'
278
- should_be_checked_in 'LICENSE'
279
- should_be_checked_in 'lib/the_perfect_gem.rb'
280
- should_be_checked_in 'test/test_helper.rb'
281
- should_be_checked_in 'test/the_perfect_gem_test.rb'
282
- should_be_checked_in '.gitignore'
173
+ should_be_checked_in 'README', 'Rakefile', 'LICENSE', 'lib/the_perfect_gem.rb', 'test/test_helper.rb', 'test/the_perfect_gem_test.rb', '.gitignore'
283
174
 
284
175
  should "have no untracked files" do
285
176
  assert_equal 0, @repo.status.untracked.size
@@ -297,20 +188,16 @@ class JewelerTest < Test::Unit::TestCase
297
188
  assert_equal 0, @repo.status.deleted.size
298
189
  end
299
190
 
300
-
301
- should "have git@github.com:technicalpickles/the-perfect-gem.git as origin remote" do
302
- assert_equal 1, @repo.remotes.size
303
- remote = @repo.remotes.first
304
- assert_equal 'origin', remote.name
305
- assert_equal 'git@github.com:technicalpickles/the-perfect-gem.git', remote.url
306
- end
191
+ should_have_sane_origin_remote
307
192
  end
308
193
  end
309
194
 
310
- context "running bacon" do
195
+ context "running with bacon test style" do
311
196
  setup do
312
197
  @generator.test_style = :bacon
313
- @generator.run
198
+ @output = catch_out {
199
+ @generator.run
200
+ }
314
201
  end
315
202
 
316
203
  should 'create target directory' do
@@ -320,70 +207,11 @@ class JewelerTest < Test::Unit::TestCase
320
207
  should_create_directory 'lib'
321
208
  should_create_directory 'spec'
322
209
 
323
- should_create_file 'LICENSE'
324
- should_create_file 'README'
325
- should_create_file 'lib/the_perfect_gem.rb'
326
- should_create_file 'spec/spec_helper.rb'
327
- should_create_file 'spec/the_perfect_gem_spec.rb'
328
- should_create_file '.gitignore'
329
-
330
- context "LICENSE" do
331
- setup do
332
- @content = File.read((File.join(@tmp_dir, 'LICENSE')))
333
- end
334
-
335
- should "include copyright for this year with user's name" do
336
- assert_match 'Copyright (c) 2008 foo', @content
337
- end
338
- end
339
-
340
- context "Rakefile" do
341
- setup do
342
- @content = File.read((File.join(@tmp_dir, 'Rakefile')))
343
- end
344
-
345
- should "include repo's name as the gem's name" do
346
- assert_match 's.name = "the-perfect-gem"', @content
347
- end
348
-
349
- should "include the user's email as the gem's email" do
350
- assert_match 's.email = "bar@example.com"', @content
351
- end
352
-
353
- should "include the github repo's url as the gem's url" do
354
- assert_match 's.homepage = "http://github.com/technicalpickles/the-perfect-gem"', @content
355
- end
356
-
357
- should "include a glob to match spec files in the TestTask" do
358
- assert_match "t.pattern = 'spec/**/*_spec.rb'", @content
359
- end
360
-
361
- should "include a glob to match spec files in the RcovTask" do
362
- assert_match "t.test_files = FileList['spec/**/*_spec.rb']", @content
363
- end
210
+ should_create_files 'LICENSE', 'README', 'lib/the_perfect_gem.rb', 'spec/spec_helper.rb', 'spec/the_perfect_gem_spec.rb', '.gitignore'
364
211
 
365
- should "push spec dir into RcovTask libs" do
366
- assert_match 't.libs << "spec"', @content
367
- end
368
- end
369
-
370
- context ".gitignore" do
371
- setup do
372
- @content = File.read((File.join(@tmp_dir, '.gitignore')))
373
- end
374
-
375
- should "include vim swap files" do
376
- assert_match '*.sw?', @content
377
- end
378
-
379
- should "include coverage" do
380
- assert_match 'coverage', @content
381
- end
382
-
383
- should "include .DS_Store" do
384
- assert_match '.DS_Store', @content
385
- end
386
- end
212
+ should_have_sane_rakefile :libs => 'spec', :pattern => 'spec/**/*_spec.rb'
213
+ should_have_sane_license
214
+ should_have_sane_gitignore
387
215
 
388
216
 
389
217
  context "spec/the_perfect_gem_spec.rb" do
@@ -411,13 +239,7 @@ class JewelerTest < Test::Unit::TestCase
411
239
  assert_match 'Initial commit to the-perfect-gem.', @repo.log.first.message
412
240
  end
413
241
 
414
- should_be_checked_in 'README'
415
- should_be_checked_in 'Rakefile'
416
- should_be_checked_in 'LICENSE'
417
- should_be_checked_in 'lib/the_perfect_gem.rb'
418
- should_be_checked_in 'spec/spec_helper.rb'
419
- should_be_checked_in 'spec/the_perfect_gem_spec.rb'
420
- should_be_checked_in '.gitignore'
242
+ should_be_checked_in 'README', 'Rakefile', 'LICENSE', 'lib/the_perfect_gem.rb', 'spec/spec_helper.rb', 'spec/the_perfect_gem_spec.rb', '.gitignore'
421
243
 
422
244
  should "have no untracked files" do
423
245
  assert_equal 0, @repo.status.untracked.size
@@ -435,17 +257,10 @@ class JewelerTest < Test::Unit::TestCase
435
257
  assert_equal 0, @repo.status.deleted.size
436
258
  end
437
259
 
438
-
439
- should "have git@github.com:technicalpickles/the-perfect-gem.git as origin remote" do
440
- assert_equal 1, @repo.remotes.size
441
- remote = @repo.remotes.first
442
- assert_equal 'origin', remote.name
443
- assert_equal 'git@github.com:technicalpickles/the-perfect-gem.git', remote.url
444
- end
260
+ should_have_sane_origin_remote
445
261
  end
446
262
  end
447
263
  end
448
264
  end
449
265
  end
450
-
451
266
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: technicalpickles-jeweler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nichols
@@ -43,15 +43,15 @@ files:
43
43
  - lib/jeweler/release.rb
44
44
  - lib/jeweler/tasks.rb
45
45
  - lib/jeweler/templates
46
+ - lib/jeweler/templates/bacon
47
+ - lib/jeweler/templates/bacon/flunking_spec.rb
48
+ - lib/jeweler/templates/bacon/spec_helper.rb
46
49
  - lib/jeweler/templates/LICENSE
47
50
  - lib/jeweler/templates/Rakefile
48
51
  - lib/jeweler/templates/README
49
- - lib/jeweler/templates/spec
50
- - lib/jeweler/templates/spec/flunking_spec.rb
51
- - lib/jeweler/templates/spec/spec_helper.rb
52
- - lib/jeweler/templates/test
53
- - lib/jeweler/templates/test/flunking_test.rb
54
- - lib/jeweler/templates/test/test_helper.rb
52
+ - lib/jeweler/templates/shoulda
53
+ - lib/jeweler/templates/shoulda/flunking_test.rb
54
+ - lib/jeweler/templates/shoulda/test_helper.rb
55
55
  - lib/jeweler/versioning.rb
56
56
  - lib/jeweler.rb
57
57
  - test/fixtures