technicalpickles-jeweler 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,20 +7,20 @@ $:.unshift('lib')
7
7
 
8
8
  begin
9
9
  require 'jeweler'
10
- Jeweler.gemspec = Gem::Specification.new do |s|
11
- s.name = "jeweler"
12
- s.executables = "jeweler"
13
- s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
14
- s.email = "josh@technicalpickles.com"
15
- s.homepage = "http://github.com/technicalpickles/jeweler"
16
- s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
17
- s.authors = ["Josh Nichols", "Dan Croak"]
18
- s.bindir = 'bin'
19
- s.files = FileList["[A-Z]*", "{bin,generators,lib,test}/**/*"]
20
- s.add_dependency 'schacon-git'
10
+ Jeweler::Tasks.new do |gemspec|
11
+ gemspec.name = "jeweler"
12
+ gemspec.executables = "jeweler"
13
+ gemspec.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
14
+ gemspec.email = "josh@technicalpickles.com"
15
+ gemspec.homepage = "http://github.com/technicalpickles/jeweler"
16
+ gemspec.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
17
+ gemspec.authors = ["Josh Nichols"]
18
+ gemspec.bindir = 'bin'
19
+ gemspec.files = FileList["[A-Z]*", "{bin,generators,lib,test}/**/*", 'lib/jeweler/templates/.gitignore']
20
+ gemspec.add_dependency 'schacon-git'
21
21
  end
22
22
  rescue LoadError
23
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
23
+ puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
24
24
  end
25
25
 
26
26
 
@@ -32,7 +32,7 @@ end
32
32
 
33
33
  Rake::RDocTask.new do |rdoc|
34
34
  rdoc.rdoc_dir = 'rdoc'
35
- rdoc.title = 'Jeweler'
35
+ rdoc.title = 'jeweler'
36
36
  rdoc.options << '--line-numbers' << '--inline-source'
37
37
  rdoc.rdoc_files.include('README.markdown')
38
38
  rdoc.rdoc_files.include('lib/**/*.rb')
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- patch: 3
2
+ patch: 4
3
3
  major: 0
4
4
  minor: 3
data/bin/jeweler CHANGED
@@ -4,12 +4,12 @@ require 'rubygems'
4
4
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
5
5
  require 'jeweler'
6
6
 
7
- unless ARGV.size == 1
8
- puts "jeweler takes one argument, a GitHub clone URL, like git@github.com:technicalpickles/the-perfect-gem.git"
7
+ unless ARGV.size == 2
8
+ puts "jeweler takes 2 arguments: GitHub username and a repo that will eventually live there. Example: jeweler technicalpickles the-perfect-gem"
9
9
  exit 1
10
10
  end
11
11
 
12
- github_remote = ARGV.first
13
- generator = Jeweler::Generator.new github_remote
14
- generator.run
15
- generator.gitify
12
+ github_username = ARGV.first
13
+ github_repo_name = ARGV.last
14
+ generator = Jeweler::Generator.new github_username, github_repo_name
15
+ generator.run
@@ -6,51 +6,48 @@ class Jeweler
6
6
  end
7
7
  class NoGitUserEmail < StandardError
8
8
  end
9
-
10
9
  class FileInTheWay < StandardError
11
10
  end
12
-
13
- class NoRemoteGiven < StandardError
11
+ class NoGitHubRepoNameGiven < StandardError
12
+ end
13
+ class NoGitHubUsernameGiven < StandardError
14
14
  end
15
15
 
16
16
  class Generator
17
- attr_accessor :target_dir, :user_name, :user_email, :github_repo_name, :github_remote, :github_url, :github_username, :lib_dir
17
+ attr_accessor :target_dir, :user_name, :user_email,
18
+ :github_repo_name, :github_remote, :github_url, :github_username,
19
+ :lib_dir, :test_dir, :constant_name, :file_name_prefix
18
20
 
19
- def initialize(github_remote, dir = nil)
20
- if github_remote.nil?
21
- raise NoRemoteGiven
21
+ def initialize(github_username, github_repo_name, dir = nil)
22
+ if github_username.nil?
23
+ raise NoGitHubUsernameGiven
24
+ end
25
+ self.github_username = github_username
26
+
27
+ if github_repo_name.nil?
28
+ raise NoGitHubRepoNameGiven
22
29
  end
30
+ self.github_repo_name = github_repo_name
23
31
 
24
- self.github_remote = github_remote
32
+ self.github_remote = "git@github.com:#{github_username}/#{github_repo_name}.git"
33
+ self.github_url = "http://github.com/#{github_username}/#{github_repo_name}"
25
34
 
26
35
  check_user_git_config()
27
36
 
28
- determine_github_stuff()
29
-
30
37
  self.target_dir = dir || self.github_repo_name
31
38
  self.lib_dir = File.join(target_dir, 'lib')
32
- end
33
-
34
- def check_user_git_config
35
- config = read_git_config
36
- unless config.has_key? 'user.name'
37
- raise NoGitUserName, %Q{No user.name set in ~/.gitconfig. Set it with: git config --global user.name 'Your Name Here'}
38
- end
39
- unless config.has_key? 'user.email'
40
- raise NoGitUserEmail, %Q{No user.name set in ~/.gitconfig. Set it with: git config --global user.name 'Your Name Here'}
41
- end
42
-
43
- @user_name = config['user.name']
44
- @user_email = config['user.email']
45
- end
46
-
47
- def determine_github_stuff
48
- self.github_url = self.github_remote.gsub(/^git@github\.com:/, 'http://github.com/').gsub(/\.git$/, '')
49
- self.github_repo_name = self.github_remote.match(/\/(.*)\.git$/)[1]
50
- self.github_username = self.github_remote.match(%r{git@github\.com:(.*)/})[1]
39
+ self.test_dir = File.join(target_dir, 'test')
40
+ self.constant_name = self.github_repo_name.split(/[-_]/).collect{|each| each.capitalize }.join
41
+ self.file_name_prefix = self.github_repo_name.gsub('-', '_')
51
42
  end
52
43
 
53
44
  def run
45
+ create_files
46
+ gitify
47
+ end
48
+
49
+ private
50
+ def create_files
54
51
  begin
55
52
  FileUtils.mkdir target_dir
56
53
  rescue Errno::EEXIST => e
@@ -59,21 +56,34 @@ class Jeweler
59
56
  end
60
57
 
61
58
  FileUtils.mkdir lib_dir
59
+ FileUtils.mkdir test_dir
62
60
 
63
- rakefile = template('Rakefile')
64
- File.open(File.join(target_dir, 'Rakefile'), 'w') {|file| file.write(rakefile.result(binding))}
65
-
66
- license = template('LICENSE')
67
- File.open(File.join(target_dir, 'LICENSE'), 'w') {|file| file.write(license.result(binding))}
61
+ output_template_in_target('.gitignore')
62
+ output_template_in_target('Rakefile')
63
+ output_template_in_target('LICENSE')
64
+ output_template_in_target('README')
65
+ output_template_in_target('test/test_helper.rb')
66
+ output_template_in_target('test/flunking_test.rb', "test/#{file_name_prefix}_test.rb")
68
67
 
69
- readme = template('README')
70
- File.open(File.join(target_dir, 'README'), 'w') {|file| file.write(readme.result(binding))}
71
-
72
- FileUtils.touch File.join(lib_dir, "#{github_repo_name}.rb")
68
+ FileUtils.touch File.join(lib_dir, "#{file_name_prefix}.rb")
73
69
  end
70
+
71
+ def check_user_git_config
72
+ config = read_git_config
73
+ unless config.has_key? 'user.name'
74
+ raise NoGitUserName, %Q{No user.name set in ~/.gitconfig. Set it with: git config --global user.name 'Your Name Here'}
75
+ end
76
+ unless config.has_key? 'user.email'
77
+ raise NoGitUserEmail, %Q{No user.name set in ~/.gitconfig. Set it with: git config --global user.name 'Your Name Here'}
78
+ end
74
79
 
75
- def template(file)
76
- ERB.new(File.read(File.join(File.dirname(__FILE__), 'templates', file)))
80
+ self.user_name = config['user.name']
81
+ self.user_email = config['user.email']
82
+ end
83
+
84
+ def output_template_in_target(source, destination = source)
85
+ template = ERB.new(File.read(File.join(File.dirname(__FILE__), 'templates', source)))
86
+ File.open(File.join(target_dir, destination), 'w') {|file| file.write(template.result(binding))}
77
87
  end
78
88
 
79
89
  def gitify
@@ -82,9 +92,8 @@ class Jeweler
82
92
  begin
83
93
  repo = Git.init()
84
94
  repo.add('.')
85
- repo.commit 'First commit courtesy of jeweler.'
95
+ repo.commit "Initial commit to #{github_repo_name}."
86
96
  repo.add_remote('origin', github_remote)
87
- repo.push('origin', 'master')
88
97
  rescue Git::GitExecuteError => e
89
98
  puts "Encountered an error during gitification. Maybe the repo already exists, or has already been pushed to?"
90
99
  puts
@@ -93,8 +102,9 @@ class Jeweler
93
102
  Dir.chdir(saved_pwd)
94
103
  end
95
104
 
96
- protected
97
105
  def read_git_config
106
+ # we could just use Git::Base's .config, but that relies on a repo being around already
107
+ # ... which we don't have yet, since this is part of a sanity check
98
108
  lib = Git::Lib.new(nil, nil)
99
109
  config = lib.parse_config '~/.gitconfig'
100
110
  end
@@ -0,0 +1,26 @@
1
+ class Jeweler
2
+ module Release
3
+
4
+ def release
5
+ @repo.checkout('master')
6
+
7
+ raise "Hey buddy, try committing them files first" if any_pending_changes?
8
+
9
+ write_gemspec()
10
+
11
+ @repo.add(gemspec_path)
12
+ @repo.commit("Regenerated gemspec for version #{version}")
13
+ @repo.push
14
+
15
+ # require 'ruby-debug'
16
+ # breakpoint
17
+ #
18
+ # @repo.tag("v#{version}")
19
+ end
20
+
21
+ protected
22
+ def any_pending_changes?
23
+ !@repo.status.added.empty? || !@repo.status.deleted.empty? || !@repo.status.changed.empty? || !@repo.status.untracked.empty?
24
+ end
25
+ end
26
+ end
data/lib/jeweler/tasks.rb CHANGED
@@ -1,70 +1,86 @@
1
- desc "Generate and validates gemspec"
2
- task :gemspec => ['gemspec:generate', 'gemspec:validate']
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
3
 
4
- namespace :gemspec do
5
- desc "Validates the gemspec"
6
- task :validate do
7
- Jeweler.instance.validate_gemspec
8
- end
9
-
10
- desc "Generates the gemspec"
11
- task :generate do
12
- Jeweler.instance.write_gemspec
13
- end
14
- end
15
-
16
- desc "Displays the current version"
17
- task :version => 'version:display'
18
-
19
- namespace :version do
20
-
21
- desc "Creates an initial version file"
22
- task :write do
23
- jeweler = Jeweler.instance
24
- jeweler.write_version(ENV['MAJOR'], ENV['MINOR'], ENV['PATCH'])
25
- end
26
-
27
- def ensure_version_yml(&block)
28
- if File.exists? 'VERSION.yml'
29
- block.call
30
- else
31
- abort "VERSION.yml is needed for this operation, but it doesn't exist. Try running 'rake version:write' first."
32
- end
33
- end
34
-
35
- desc "Displays the current version"
36
- task :display do
37
- ensure_version_yml do
38
- puts "Current version: #{Jeweler.instance.version}"
39
- end
40
- end
41
-
42
- namespace :bump do
43
- desc "Bump the gemspec by a major version."
44
- task :major => 'version:display' do
45
- ensure_version_yml do
46
- jeweler = Jeweler.instance
47
- jeweler.bump_major_version
48
- jeweler.write_gemspec
49
- end
4
+ class Jeweler
5
+ class Tasks < ::Rake::TaskLib
6
+ def initialize(&block)
7
+ @gemspec = Gem::Specification.new(&block)
8
+ @jeweler = Jeweler.new(@gemspec)
9
+
10
+ define_tasks
50
11
  end
51
12
 
52
- desc "Bump the gemspec by a minor version."
53
- task :minor => 'version:display' do
54
- ensure_version_yml do
55
- jeweler = Jeweler.instance
56
- jeweler.bump_minor_version
57
- jeweler.write_gemspec
13
+ private
14
+ def ensure_version_yml(&block)
15
+ unless File.exists? 'VERSION.yml'
16
+ @jeweler.write_version(ENV['MAJOR'], ENV['MINOR'], ENV['PATCH'])
58
17
  end
18
+ block.call if block
59
19
  end
60
20
 
61
- desc "Bump the gemspec by a patch version."
62
- task :patch => 'version:display' do
63
- ensure_version_yml do
64
- jeweler = Jeweler.instance
65
- jeweler.bump_patch_version
66
- jeweler.write_gemspec
21
+ def define_tasks
22
+ desc "Generate and validates gemspec"
23
+ task :gemspec => ['gemspec:generate', 'gemspec:validate']
24
+
25
+ namespace :gemspec do
26
+ desc "Validates the gemspec"
27
+ task :validate do
28
+ @jeweler.validate_gemspec
29
+ end
30
+
31
+ desc "Generates the gemspec"
32
+ task :generate do
33
+ ensure_version_yml do
34
+ @jeweler.write_gemspec
35
+ end
36
+ end
37
+ end
38
+
39
+ desc "Displays the current version"
40
+ task :version => 'version:display'
41
+
42
+ namespace :version do
43
+ desc "Creates an initial version file. Respects the following environment variables, or defaults to 0: MAJOR, MINOR, PATCH"
44
+ task :write do
45
+ @jeweler.write_version(ENV['MAJOR'], ENV['MINOR'], ENV['PATCH'])
46
+ end
47
+
48
+ desc "Displays the current version"
49
+ task :display do
50
+ ensure_version_yml do
51
+ puts "Current version: #{@jeweler.version}"
52
+ end
53
+ end
54
+
55
+ namespace :bump do
56
+ desc "Bump the gemspec by a major version."
57
+ task :major => 'version:display' do
58
+ ensure_version_yml do
59
+ @jeweler.bump_major_version
60
+ end
61
+ end
62
+
63
+ desc "Bump the gemspec by a minor version."
64
+ task :minor => 'version:display' do
65
+ ensure_version_yml do
66
+ @jeweler.bump_minor_version
67
+ end
68
+ end
69
+
70
+ desc "Bump the gemspec by a patch version."
71
+ task :patch => 'version:display' do
72
+ ensure_version_yml do
73
+ @jeweler.bump_patch_version
74
+ end
75
+ end
76
+ end
77
+ end
78
+
79
+ desc "Release the current version. Includes updating the gemspec, pushing, and tagging the release"
80
+ task :release do
81
+ @jeweler.release
67
82
  end
83
+
68
84
  end
69
85
  end
70
86
  end
@@ -0,0 +1,3 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
@@ -5,7 +5,7 @@ require 'rcov/rcovtask'
5
5
 
6
6
  begin
7
7
  require 'jeweler'
8
- Jeweler.gemspec = Gem::Specification.new do |s|
8
+ Jeweler::Tasks.new do |s|
9
9
  s.name = "<%= github_repo_name %>"
10
10
  s.summary = "TODO"
11
11
  s.email = "<%= user_email %>"
@@ -17,7 +17,6 @@ rescue LoadError
17
17
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
18
18
  end
19
19
 
20
-
21
20
  Rake::TestTask.new do |t|
22
21
  t.libs << 'lib'
23
22
  t.pattern = 'test/**/*_test.rb'
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class <%= constant_name %>Test < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+ require 'mocha'
5
+
6
+ class Test::Unit::TestCase
7
+ end
data/lib/jeweler.rb CHANGED
@@ -6,8 +6,9 @@ require 'jeweler/singleton'
6
6
  require 'jeweler/gemspec'
7
7
  require 'jeweler/errors'
8
8
  require 'jeweler/generator'
9
+ require 'jeweler/release'
9
10
 
10
- require 'jeweler/tasks' if defined?(Rake)
11
+ require 'jeweler/tasks'
11
12
 
12
13
  # A Jeweler helps you craft the perfect Rubygem. Give him a gemspec, and he takes care of the rest.
13
14
  class Jeweler
@@ -15,6 +16,7 @@ class Jeweler
15
16
  include Jeweler::Bumping
16
17
  include Jeweler::Versioning
17
18
  include Jeweler::Gemspec
19
+ include Jeweler::Release
18
20
 
19
21
  attr_reader :gemspec
20
22
  attr_accessor :base_dir
@@ -25,6 +27,10 @@ class Jeweler
25
27
  @base_dir = base_dir
26
28
 
27
29
  @gemspec.files ||= FileList["[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"]
30
+
31
+ if File.exists?(File.join(base_dir, '.git'))
32
+ @repo = Git.open(base_dir)
33
+ end
28
34
  end
29
35
  end
30
36
 
@@ -2,17 +2,48 @@ require File.dirname(__FILE__) + '/test_helper'
2
2
 
3
3
  class JewelerTest < Test::Unit::TestCase
4
4
 
5
- def setup
6
- @github_remote = 'git@github.com:technicalpickles/the-perfect-gem.git'
5
+ def self.should_create_directory(directory)
6
+ should "create #{directory} directory" do
7
+ assert File.exists?(File.join(@tmp_dir, directory))
8
+ assert File.directory?(File.join(@tmp_dir, directory))
9
+ end
7
10
  end
8
11
 
9
- context "given a nil github remote" do
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"
25
+ end
26
+ end
27
+
28
+ context "given a nil github username" do
10
29
  setup do
11
- @block = lambda { Jeweler::Generator.new(nil) }
30
+ @block = lambda { Jeweler::Generator.new(nil, 'the-perfect-gem', nil) }
12
31
  end
13
32
 
14
33
  should "raise an error" do
15
- assert_raise Jeweler::NoRemoteGiven do
34
+ assert_raise Jeweler::NoGitHubUsernameGiven do
35
+ @block.call
36
+ end
37
+ end
38
+ end
39
+
40
+ context "given a nil github repo name" do
41
+ setup do
42
+ @block = lambda { Jeweler::Generator.new('technicalpickles', nil, nil) }
43
+ end
44
+
45
+ should "raise an error" do
46
+ assert_raise Jeweler::NoGitHubRepoNameGiven do
16
47
  @block.call
17
48
  end
18
49
  end
@@ -25,7 +56,7 @@ class JewelerTest < Test::Unit::TestCase
25
56
 
26
57
  context "instantiating new generator" do
27
58
  setup do
28
- @block = lambda { Jeweler::Generator.new('git@github.com:technicalpickles/the-perfect-gem.git')}
59
+ @block = lambda { Jeweler::Generator.new('technicalpickles', 'the-perfect-gem')}
29
60
  end
30
61
 
31
62
  should "raise no git user name exception" do
@@ -43,7 +74,7 @@ class JewelerTest < Test::Unit::TestCase
43
74
 
44
75
  context "instantiating new generator" do
45
76
  setup do
46
- @block = lambda { Jeweler::Generator.new('git@github.com:technicalpickles/the-perfect-gem.git')}
77
+ @block = lambda { Jeweler::Generator.new('technicalpickles', 'the-perfect-gem')}
47
78
  end
48
79
 
49
80
  should "raise no git user name exception" do
@@ -59,9 +90,9 @@ class JewelerTest < Test::Unit::TestCase
59
90
  Jeweler::Generator.any_instance.stubs(:read_git_config).returns({'user.name' => 'foo', 'user.email' => 'bar@example.com'})
60
91
  end
61
92
 
62
- context "for a repository 'git@github.com:technicalpickles/the-perfect-gem.git'" do
93
+ context "for technicalpickle's the-perfect-gem repository" do
63
94
  setup do
64
- @generator = Jeweler::Generator.new('git@github.com:technicalpickles/the-perfect-gem.git')
95
+ @generator = Jeweler::Generator.new('technicalpickles', 'the-perfect-gem')
65
96
  end
66
97
 
67
98
  should "assign 'foo' to user's name" do
@@ -95,6 +126,18 @@ class JewelerTest < Test::Unit::TestCase
95
126
  should "determine lib directory as being inside the target directory" do
96
127
  assert_equal File.join(@generator.target_dir, 'lib'), @generator.lib_dir
97
128
  end
129
+
130
+ should "determine test directory as being inside the target directory" do
131
+ assert_equal File.join(@generator.target_dir, 'test'), @generator.test_dir
132
+ end
133
+
134
+ should "determine constant name as ThePerfectGem" do
135
+ assert_equal 'ThePerfectGem', @generator.constant_name
136
+ end
137
+
138
+ should "determine file name prefix as the_perfect_gem" do
139
+ assert_equal 'the_perfect_gem', @generator.file_name_prefix
140
+ end
98
141
  end
99
142
 
100
143
 
@@ -110,9 +153,9 @@ class JewelerTest < Test::Unit::TestCase
110
153
  FileUtils.rm_rf(@tmp_dir)
111
154
  end
112
155
 
113
- context "for a repository 'git@github.com:technicalpickles/the-perfect-gem.git' and working directory 'tmp'" do
156
+ context "for technicalpickles's the-perfect-gem repo and working directory 'tmp'" do
114
157
  setup do
115
- @generator = Jeweler::Generator.new('git@github.com:technicalpickles/the-perfect-gem.git', @tmp_dir)
158
+ @generator = Jeweler::Generator.new('technicalpickles', 'the-perfect-gem', @tmp_dir)
116
159
  end
117
160
 
118
161
  should "use tmp for target directory" do
@@ -128,25 +171,15 @@ class JewelerTest < Test::Unit::TestCase
128
171
  assert File.exists?(@tmp_dir)
129
172
  end
130
173
 
131
- should "create lib directory" do
132
- assert File.exists?(File.join(@tmp_dir, 'lib'))
133
- assert File.directory?(File.join(@tmp_dir, 'lib'))
134
- end
135
-
136
- should "create LICENSE" do
137
- assert File.exists?(File.join(@tmp_dir, 'LICENSE'))
138
- assert File.file?(File.join(@tmp_dir, 'LICENSE'))
139
- end
140
-
141
- should "create README" do
142
- assert File.exists?(File.join(@tmp_dir, 'README'))
143
- assert File.file?(File.join(@tmp_dir, 'README'))
144
- end
174
+ should_create_directory 'lib'
175
+ should_create_directory 'test'
145
176
 
146
- should "create lib/the-perfect-gem.rb" do
147
- assert File.exists?(File.join(@tmp_dir, 'lib', 'the-perfect-gem.rb'))
148
- assert File.file?(File.join(@tmp_dir, 'lib', 'the-perfect-gem.rb'))
149
- end
177
+ should_create_file 'LICENSE'
178
+ should_create_file 'README'
179
+ should_create_file 'lib/the_perfect_gem.rb'
180
+ should_create_file 'test/test_helper.rb'
181
+ should_create_file 'test/the_perfect_gem_test.rb'
182
+ should_create_file '.gitignore'
150
183
 
151
184
  context "LICENSE" do
152
185
  setup do
@@ -176,8 +209,83 @@ class JewelerTest < Test::Unit::TestCase
176
209
  end
177
210
  end
178
211
 
179
- end
212
+ context ".gitignore" do
213
+ setup do
214
+ @content = File.read((File.join(@tmp_dir, '.gitignore')))
215
+ end
216
+
217
+ should "include vim swap files" do
218
+ assert_match '*.sw?', @content
219
+ end
220
+
221
+ should "include coverage" do
222
+ assert_match 'coverage', @content
223
+ end
224
+
225
+ should "include .DS_Store" do
226
+ assert_match '.DS_Store', @content
227
+ end
228
+ end
180
229
 
230
+
231
+ context "test/the_perfect_gem_test.rb" do
232
+ setup do
233
+ @content = File.read((File.join(@tmp_dir, 'test', 'the_perfect_gem_test.rb')))
234
+ end
235
+
236
+ should "have class of ThePerfectGemTest" do
237
+ assert_match 'class ThePerfectGemTest < Test::Unit::TestCase', @content
238
+ end
239
+ end
240
+
241
+
242
+ context "created git repo" do
243
+ setup do
244
+ @repo = Git.open(@tmp_dir)
245
+ end
246
+
247
+ should 'have one commit log' do
248
+ assert_equal 1, @repo.log.size
249
+ end
250
+
251
+ should "have one commit log an initial commit message" do
252
+ # TODO message seems to include leading whitespace, could probably fix that in ruby-git
253
+ assert_match 'Initial commit to the-perfect-gem.', @repo.log.first.message
254
+ end
255
+
256
+ should_be_checked_in 'README'
257
+ should_be_checked_in 'Rakefile'
258
+ should_be_checked_in 'LICENSE'
259
+ should_be_checked_in 'lib/the_perfect_gem.rb'
260
+ should_be_checked_in 'test/test_helper.rb'
261
+ should_be_checked_in 'test/the_perfect_gem_test.rb'
262
+ should_be_checked_in '.gitignore'
263
+
264
+ should "have no untracked files" do
265
+ assert_equal 0, @repo.status.untracked.size
266
+ end
267
+
268
+ should "have no changed files" do
269
+ assert_equal 0, @repo.status.changed.size
270
+ end
271
+
272
+ should "have no added files" do
273
+ assert_equal 0, @repo.status.added.size
274
+ end
275
+
276
+ should "have no deleted files" do
277
+ assert_equal 0, @repo.status.deleted.size
278
+ end
279
+
280
+
281
+ should "have git@github.com:technicalpickles/the-perfect-gem.git as origin remote" do
282
+ assert_equal 1, @repo.remotes.size
283
+ remote = @repo.remotes.first
284
+ assert_equal 'origin', remote.name
285
+ assert_equal 'git@github.com:technicalpickles/the-perfect-gem.git', remote.url
286
+ end
287
+ end
288
+ end
181
289
  end
182
290
  end
183
291
  end
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: technicalpickles-jeweler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nichols
8
- - Dan Croak
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
11
 
13
- date: 2008-10-25 00:00:00 -07:00
12
+ date: 2008-10-26 00:00:00 -07:00
14
13
  default_executable: jeweler
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
@@ -41,12 +40,16 @@ files:
41
40
  - lib/jeweler/errors.rb
42
41
  - lib/jeweler/gemspec.rb
43
42
  - lib/jeweler/generator.rb
43
+ - lib/jeweler/release.rb
44
44
  - lib/jeweler/singleton.rb
45
45
  - lib/jeweler/tasks.rb
46
46
  - lib/jeweler/templates
47
47
  - lib/jeweler/templates/LICENSE
48
48
  - lib/jeweler/templates/Rakefile
49
49
  - lib/jeweler/templates/README
50
+ - lib/jeweler/templates/test
51
+ - lib/jeweler/templates/test/flunking_test.rb
52
+ - lib/jeweler/templates/test/test_helper.rb
50
53
  - lib/jeweler/versioning.rb
51
54
  - lib/jeweler.rb
52
55
  - test/fixtures
@@ -55,6 +58,7 @@ files:
55
58
  - test/jeweler_generator_test.rb
56
59
  - test/jeweler_test.rb
57
60
  - test/test_helper.rb
61
+ - lib/jeweler/templates/.gitignore
58
62
  has_rdoc: false
59
63
  homepage: http://github.com/technicalpickles/jeweler
60
64
  post_install_message: