technicalpickles-jeweler 0.11.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/.gitignore +7 -0
  2. data/ChangeLog.markdown +8 -0
  3. data/README.markdown +9 -9
  4. data/ROADMAP +12 -0
  5. data/Rakefile +22 -5
  6. data/VERSION.yml +2 -2
  7. data/features/generator/cucumber.feature +83 -0
  8. data/features/generator/directory_layout.feature +76 -0
  9. data/features/generator/dotdocument.feature +14 -0
  10. data/features/generator/env_options.feature +9 -0
  11. data/features/generator/git.feature +94 -0
  12. data/features/generator/license.feature +11 -0
  13. data/features/generator/rakefile.feature +110 -0
  14. data/features/generator/readme.feature +12 -0
  15. data/features/generator/test.feature +41 -0
  16. data/features/generator/test_helper.feature +49 -0
  17. data/features/placeholder.feature +5 -0
  18. data/features/step_definitions/debug_steps.rb +6 -0
  19. data/features/step_definitions/filesystem_steps.rb +65 -0
  20. data/features/step_definitions/generator_steps.rb +251 -0
  21. data/features/step_definitions/task_steps.rb +6 -0
  22. data/features/support/env.rb +19 -0
  23. data/features/tasks/build_gem.feature +9 -0
  24. data/features/tasks/version.feature +24 -0
  25. data/features/tasks/version_bumping.feature +33 -0
  26. data/jeweler.gemspec +204 -0
  27. data/lib/jeweler/commands/release.rb +35 -11
  28. data/lib/jeweler/commands/version/base.rb +1 -1
  29. data/lib/jeweler/gemspec_helper.rb +4 -6
  30. data/lib/jeweler/generator/application.rb +8 -3
  31. data/lib/jeweler/generator/bacon_mixin.rb +39 -0
  32. data/lib/jeweler/generator/micronaut_mixin.rb +38 -0
  33. data/lib/jeweler/generator/minitest_mixin.rb +39 -0
  34. data/lib/jeweler/generator/options.rb +5 -1
  35. data/lib/jeweler/generator/rspec_mixin.rb +39 -0
  36. data/lib/jeweler/generator/shoulda_mixin.rb +39 -0
  37. data/lib/jeweler/generator/testunit_mixin.rb +39 -0
  38. data/lib/jeweler/generator.rb +48 -111
  39. data/lib/jeweler/rubyforge_tasks.rb +46 -0
  40. data/lib/jeweler/specification.rb +3 -2
  41. data/lib/jeweler/tasks.rb +32 -26
  42. data/lib/jeweler/templates/README.rdoc +1 -1
  43. data/lib/jeweler/templates/Rakefile +29 -52
  44. data/lib/jeweler/templates/bacon/helper.rb +1 -1
  45. data/lib/jeweler/templates/features/support/env.rb +4 -7
  46. data/lib/jeweler/templates/micronaut/helper.rb +1 -1
  47. data/lib/jeweler/templates/minitest/helper.rb +1 -1
  48. data/lib/jeweler/templates/rspec/flunking.rb +1 -1
  49. data/lib/jeweler/templates/rspec/helper.rb +1 -1
  50. data/lib/jeweler/templates/shoulda/helper.rb +1 -1
  51. data/lib/jeweler/templates/testunit/helper.rb +1 -1
  52. data/lib/jeweler/version_helper.rb +78 -33
  53. data/lib/jeweler.rb +5 -0
  54. data/test/fixtures/existing-project-with-version-plaintext/.document +5 -0
  55. data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
  56. data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/LICENSE +0 -0
  57. data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/README.rdoc +0 -0
  58. data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/Rakefile +0 -0
  59. data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
  60. data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/existing-project-with-version.gemspec +0 -0
  61. data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/lib/existing_project_with_version.rb +0 -0
  62. data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/test/existing_project_with_version_test.rb +0 -0
  63. data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/test/test_helper.rb +0 -0
  64. data/test/fixtures/existing-project-with-version-yaml/.document +5 -0
  65. data/test/fixtures/existing-project-with-version-yaml/.gitignore +5 -0
  66. data/test/fixtures/existing-project-with-version-yaml/LICENSE +20 -0
  67. data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
  68. data/test/fixtures/existing-project-with-version-yaml/Rakefile +82 -0
  69. data/test/fixtures/{existing-project-with-version → existing-project-with-version-yaml}/VERSION.yml +0 -0
  70. data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +29 -0
  71. data/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb +0 -0
  72. data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +7 -0
  73. data/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb +10 -0
  74. data/test/jeweler/commands/test_release.rb +304 -79
  75. data/test/test_application.rb +26 -0
  76. data/test/test_gemspec_helper.rb +4 -0
  77. data/test/test_generator.rb +83 -112
  78. data/test/test_generator_initialization.rb +113 -0
  79. data/test/test_generator_mixins.rb +18 -0
  80. data/test/test_helper.rb +3 -0
  81. data/test/test_options.rb +6 -0
  82. data/test/test_specification.rb +6 -2
  83. data/test/test_version_helper.rb +47 -9
  84. metadata +72 -17
  85. data/test/generators/initialization_test.rb +0 -146
@@ -3,40 +3,64 @@ class Jeweler
3
3
  class Release
4
4
  attr_accessor :gemspec, :version, :repo, :output, :gemspec_helper, :base_dir
5
5
 
6
- def initialize
6
+ def initialize(attributes = {})
7
7
  self.output = $stdout
8
+
9
+ attributes.each_pair do |key, value|
10
+ send("#{key}=", value)
11
+ end
8
12
  end
9
13
 
10
14
  def run
11
- repo.checkout('master')
12
-
13
15
  raise "Hey buddy, try committing them files first" if any_pending_changes?
14
16
 
15
- gemspec_helper.update_version(version)
16
- gemspec_helper.write
17
+ repo.checkout('master')
17
18
 
18
- repo.add(gemspec_helper.path)
19
- output.puts "Committing #{gemspec_helper.path}"
20
- repo.commit("Regenerated gemspec for version #{version}")
19
+ regenerate_gemspec!
20
+ commit_gemspec! if gemspec_changed?
21
21
 
22
22
  output.puts "Pushing master to origin"
23
23
  repo.push
24
24
 
25
+ tag_release! unless release_tagged?
26
+ end
27
+
28
+ def any_pending_changes?
29
+ !(@repo.status.added.empty? && @repo.status.deleted.empty? && @repo.status.changed.empty?)
30
+ end
31
+
32
+ def tag_release!
25
33
  output.puts "Tagging #{release_tag}"
26
34
  repo.add_tag(release_tag)
27
35
 
28
36
  output.puts "Pushing #{release_tag} to origin"
29
37
  repo.push('origin', release_tag)
30
38
  end
31
-
32
- def any_pending_changes?
33
- !(@repo.status.added.empty? && @repo.status.deleted.empty? && @repo.status.changed.empty?)
39
+
40
+ def commit_gemspec!
41
+ repo.add(gemspec_helper.path)
42
+ output.puts "Committing #{gemspec_helper.path}"
43
+ repo.commit "Regenerated gemspec for version #{version}"
44
+ end
45
+
46
+ def regenerate_gemspec!
47
+ gemspec_helper.update_version(version)
48
+ gemspec_helper.write
34
49
  end
35
50
 
36
51
  def release_tag
37
52
  "v#{version}"
38
53
  end
39
54
 
55
+ def release_tagged?
56
+ tag = repo.tag(release_tag) rescue nil
57
+ ! tag.nil?
58
+ end
59
+
60
+ def gemspec_changed?
61
+ ! any_pending_changes?
62
+ end
63
+
40
64
  def gemspec_helper
41
65
  @gemspec_helper ||= Jeweler::GemSpecHelper.new(self.gemspec, self.base_dir)
42
66
  end
@@ -20,7 +20,7 @@ class Jeweler
20
20
 
21
21
  def commit_version
22
22
  if self.repo
23
- self.repo.add('VERSION.yml')
23
+ self.repo.add(version_helper.path)
24
24
  self.repo.commit("Version bump to #{self.version_helper.to_s}")
25
25
  end
26
26
  end
@@ -58,12 +58,10 @@ class Jeweler
58
58
  end
59
59
 
60
60
  def prettyify_array(gemspec_ruby, array_name)
61
- array = @spec.send(array_name)
62
- quoted_array = array.map {|file| %Q{"#{file}"}}
63
- nastily_formated_array = "s.#{array_name} = [#{quoted_array.join(", ")}]"
64
- nicely_formated_array = "s.#{array_name} = [\n #{quoted_array.join(",\n ")}\n ]"
65
-
66
- gemspec_ruby.gsub(nastily_formated_array, nicely_formated_array)
61
+ gemspec_ruby.gsub(/s\.#{array_name.to_s} = \[.+?\]/) do |match|
62
+ leadin, files = match[0..-2].split("[")
63
+ leadin + "[\n #{files.split(",").join(",\n ")}\n ]"
64
+ end
67
65
  end
68
66
 
69
67
  def gem_path
@@ -9,6 +9,11 @@ class Jeweler
9
9
  options = Jeweler::Generator::Options.new(arguments)
10
10
  options = options.merge(env_opts) if env_opts
11
11
 
12
+ if options[:invalid_argument]
13
+ $stderr.puts options[:invalid_argument]
14
+ options[:show_help] = true
15
+ end
16
+
12
17
  if options[:show_help]
13
18
  $stderr.puts options.opts
14
19
  return 1
@@ -19,10 +24,10 @@ class Jeweler
19
24
  return 1
20
25
  end
21
26
 
22
- github_repo_name = arguments.first
27
+ project_name = arguments.first
23
28
 
24
29
  begin
25
- generator = Jeweler::Generator.new(github_repo_name, options)
30
+ generator = Jeweler::Generator.new(project_name, options)
26
31
  generator.run
27
32
  return 0
28
33
  rescue Jeweler::NoGitUserName
@@ -38,7 +43,7 @@ class Jeweler
38
43
  $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}
39
44
  return 1
40
45
  rescue Jeweler::FileInTheWay
41
- $stderr.puts "The directory #{github_repo_name} already exists. Maybe move it out of the way before continuing?"
46
+ $stderr.puts "The directory #{project_name} already exists. Maybe move it out of the way before continuing?"
42
47
  return 1
43
48
  end
44
49
  end
@@ -0,0 +1,39 @@
1
+ class Jeweler
2
+ class Generator
3
+ module BaconMixin
4
+
5
+ def default_task
6
+ 'spec'
7
+ end
8
+
9
+ def feature_support_require
10
+ 'test/unit/assertions'
11
+ end
12
+
13
+ def feature_support_extend
14
+ 'Test::Unit::Assertions' # NOTE can't use bacon inside of cucumber actually
15
+ end
16
+
17
+ def test_dir
18
+ 'spec'
19
+ end
20
+
21
+ def test_task
22
+ 'spec'
23
+ end
24
+
25
+ def test_pattern
26
+ 'spec/**/*_spec.rb'
27
+ end
28
+
29
+ def test_filename
30
+ "#{require_name}_spec.rb"
31
+ end
32
+
33
+ def test_helper_filename
34
+ "spec_helper.rb"
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,38 @@
1
+ class Jeweler
2
+ class Generator
3
+ module MicronautMixin
4
+
5
+ def default_task
6
+ 'examples'
7
+ end
8
+
9
+ def feature_support_require
10
+ 'micronaut/expectations'
11
+ end
12
+
13
+ def feature_support_extend
14
+ 'Micronaut::Matchers'
15
+ end
16
+
17
+ def test_dir
18
+ 'examples'
19
+ end
20
+
21
+ def test_task
22
+ 'examples'
23
+ end
24
+
25
+ def test_pattern
26
+ 'examples/**/*_example.rb'
27
+ end
28
+
29
+ def test_filename
30
+ "#{require_name}_example.rb"
31
+ end
32
+
33
+ def test_helper_filename
34
+ "example_helper.rb"
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,39 @@
1
+ class Jeweler
2
+ class Generator
3
+ module MinitestMixin
4
+
5
+ def default_task
6
+ 'test'
7
+ end
8
+
9
+ def feature_support_require
10
+ 'mini/test'
11
+ end
12
+
13
+ def feature_support_extend
14
+ 'Mini::Test::Assertions'
15
+ end
16
+
17
+ def test_dir
18
+ 'test'
19
+ end
20
+
21
+ def test_task
22
+ 'test'
23
+ end
24
+
25
+ def test_pattern
26
+ 'test/**/*_test.rb'
27
+ end
28
+
29
+ def test_filename
30
+ "#{require_name}_test.rb"
31
+ end
32
+
33
+ def test_helper_filename
34
+ "test_helper.rb"
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -61,7 +61,11 @@ class Jeweler
61
61
  end
62
62
  end
63
63
 
64
- @opts.parse!(args)
64
+ begin
65
+ @opts.parse!(args)
66
+ rescue OptionParser::InvalidOption => e
67
+ self[:invalid_argument] = e.message
68
+ end
65
69
  end
66
70
 
67
71
  def merge(other)
@@ -0,0 +1,39 @@
1
+ class Jeweler
2
+ class Generator
3
+ module RspecMixin
4
+
5
+ def default_task
6
+ 'spec'
7
+ end
8
+
9
+ def feature_support_require
10
+ 'spec/expectations'
11
+ end
12
+
13
+ def feature_support_extend
14
+ nil # Cucumber is smart enough extend Spec::Expectations on its own
15
+ end
16
+
17
+ def test_dir
18
+ 'spec'
19
+ end
20
+
21
+ def test_task
22
+ 'spec'
23
+ end
24
+
25
+ def test_pattern
26
+ 'spec/**/*_spec.rb'
27
+ end
28
+
29
+ def test_filename
30
+ "#{require_name}_spec.rb"
31
+ end
32
+
33
+ def test_helper_filename
34
+ "spec_helper.rb"
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,39 @@
1
+ class Jeweler
2
+ class Generator
3
+ module ShouldaMixin
4
+
5
+ def default_task
6
+ 'test'
7
+ end
8
+
9
+ def feature_support_require
10
+ 'test/unit/assertions'
11
+ end
12
+
13
+ def feature_support_extend
14
+ 'Test::Unit::Assertions'
15
+ end
16
+
17
+ def test_dir
18
+ 'test'
19
+ end
20
+
21
+ def test_task
22
+ 'test'
23
+ end
24
+
25
+ def test_pattern
26
+ 'test/**/*_test.rb'
27
+ end
28
+
29
+ def test_filename
30
+ "#{require_name}_test.rb"
31
+ end
32
+
33
+ def test_helper_filename
34
+ "test_helper.rb"
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,39 @@
1
+ class Jeweler
2
+ class Generator
3
+ module TestunitMixin
4
+
5
+ def default_task
6
+ 'test'
7
+ end
8
+
9
+ def feature_support_require
10
+ 'test/unit/assertions'
11
+ end
12
+
13
+ def feature_support_extend
14
+ 'Test::Unit::Assertions'
15
+ end
16
+
17
+ def test_dir
18
+ 'test'
19
+ end
20
+
21
+ def test_task
22
+ 'test'
23
+ end
24
+
25
+ def test_pattern
26
+ 'test/**/*_test.rb'
27
+ end
28
+
29
+ def test_filename
30
+ "#{require_name}_test.rb"
31
+ end
32
+
33
+ def test_helper_filename
34
+ "test_helper.rb"
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -4,6 +4,13 @@ require 'erb'
4
4
  require 'net/http'
5
5
  require 'uri'
6
6
 
7
+ require 'jeweler/generator/bacon_mixin'
8
+ require 'jeweler/generator/micronaut_mixin'
9
+ require 'jeweler/generator/minitest_mixin'
10
+ require 'jeweler/generator/rspec_mixin'
11
+ require 'jeweler/generator/shoulda_mixin'
12
+ require 'jeweler/generator/testunit_mixin'
13
+
7
14
  class Jeweler
8
15
  class NoGitUserName < StandardError
9
16
  end
@@ -22,28 +29,33 @@ class Jeweler
22
29
 
23
30
  class Generator
24
31
  attr_accessor :target_dir, :user_name, :user_email, :summary, :testing_framework,
25
- :github_repo_name, :github_username, :github_token,
32
+ :project_name, :github_username, :github_token,
26
33
  :repo, :should_create_repo, :should_use_cucumber, :should_setup_rubyforge
27
34
 
28
- SUPPORTED_TESTING_FRAMEWORKS = [:shoulda, :testunit, :bacon, :rspec, :micronaut, :minitest]
35
+ DEFAULT_TESTING_FRAMEWORK = :shoulda
29
36
 
30
- def initialize(github_repo_name, options = {})
31
- if github_repo_name.nil? || github_repo_name.squeeze.strip == ""
37
+ def initialize(project_name, options = {})
38
+ if project_name.nil? || project_name.squeeze.strip == ""
32
39
  raise NoGitHubRepoNameGiven
33
40
  end
34
41
 
35
- self.github_repo_name = github_repo_name
42
+ self.project_name = project_name
36
43
 
37
- self.testing_framework = (options[:testing_framework] || :shoulda).to_sym
38
- unless SUPPORTED_TESTING_FRAMEWORKS.include? self.testing_framework
44
+ self.testing_framework = (options[:testing_framework] || DEFAULT_TESTING_FRAMEWORK).to_sym
45
+ begin
46
+ generator_mixin_name = "#{self.testing_framework.to_s.capitalize}Mixin"
47
+ generator_mixin = self.class.const_get(generator_mixin_name)
48
+ extend generator_mixin
49
+ rescue NameError => e
39
50
  raise ArgumentError, "Unsupported testing framework (#{testing_framework})"
40
51
  end
41
52
 
42
- self.target_dir = options[:directory] || self.github_repo_name
43
53
 
44
- self.should_create_repo = options[:create_repo]
45
- self.summary = options[:summary] || 'TODO'
46
- self.should_use_cucumber= options[:use_cucumber]
54
+ self.target_dir = options[:directory] || self.project_name
55
+
56
+ self.should_create_repo = options[:create_repo]
57
+ self.summary = options[:summary] || 'TODO'
58
+ self.should_use_cucumber = options[:use_cucumber]
47
59
  self.should_setup_rubyforge = options[:rubyforge]
48
60
 
49
61
  use_user_git_config
@@ -53,112 +65,49 @@ class Jeweler
53
65
  def run
54
66
  create_files
55
67
  gitify
56
- $stdout.puts "Jeweler has prepared your gem in #{github_repo_name}"
68
+ $stdout.puts "Jeweler has prepared your gem in #{target_dir}"
57
69
  if should_create_repo
58
70
  create_and_push_repo
59
- $stdout.puts "Jeweler has pushed your repo to #{github_url}"
71
+ $stdout.puts "Jeweler has pushed your repo to #{project_homepage}"
60
72
  enable_gem_for_repo
61
73
  $stdout.puts "Jeweler has enabled gem building for your repo"
62
74
  end
63
75
  end
64
76
 
65
- # Directory where 'tests' live
66
- def test_dir
67
- test_or_spec
77
+ def git_remote
78
+ "git@github.com:#{github_username}/#{project_name}.git"
68
79
  end
69
80
 
70
- # Default rake task to use
71
- def default_task
72
- case testing_framework.to_sym
73
- when :shoulda, :testunit, :minitest
74
- 'test'
75
- when :bacon, :rspec
76
- 'spec'
77
- when :micronaut
78
- 'examples'
79
- else
80
- raise ArgumentError, "Don't know default task for #{testing_framework}"
81
- end
82
- end
83
-
84
- def feature_support_require
85
- case testing_framework.to_sym
86
- when :testunit, :shoulda, :bacon # NOTE bacon doesn't really work inside of cucumber
87
- 'test/unit/assertions'
88
- when :minitest
89
- 'mini/test'
90
- when :rspec
91
- 'spec/expectations'
92
- when :micronaut
93
- 'micronaut/expectations'
94
- else
95
- raise "Don't know what to require for #{testing_framework}"
96
- end
81
+ def project_homepage
82
+ "http://github.com/#{github_username}/#{project_name}"
97
83
  end
98
-
99
- def feature_support_extend
100
- case testing_framework.to_sym
101
- when :testunit, :shoulda, :bacon # NOTE bacon doesn't really work inside of cucumber
102
- 'Test::Unit::Assertions'
103
- when :minitest
104
- 'Mini::Test::Assertions'
105
- when :rspec
106
- nil
107
- when :micronaut
108
- 'Micronaut::Matchers'
109
- else
110
- raise "Don't know what to extend for #{testing_framework}"
111
- end
84
+
85
+ def constant_name
86
+ self.project_name.split(/[-_]/).collect{|each| each.capitalize }.join
112
87
  end
113
88
 
114
- def github_remote
115
- "git@github.com:#{github_username}/#{github_repo_name}.git"
89
+ def lib_filename
90
+ "#{project_name}.rb"
116
91
  end
117
92
 
118
- def github_url
119
- "http://github.com/#{github_username}/#{github_repo_name}"
120
- end
121
-
122
-
123
- def constant_name
124
- self.github_repo_name.split(/[-_]/).collect{|each| each.capitalize }.join
93
+ def require_name
94
+ self.project_name
125
95
  end
126
96
 
127
97
  def file_name_prefix
128
- self.github_repo_name.gsub('-', '_')
98
+ self.project_name.gsub('-', '_')
129
99
  end
130
100
 
131
101
  def lib_dir
132
102
  'lib'
133
103
  end
134
104
 
135
- def test_dir
136
- case testing_framework.to_sym
137
- when :shoulda, :testunit, :minitest
138
- 'test'
139
- when :bacon, :rspec
140
- 'spec'
141
- when :micronaut
142
- 'examples'
143
- else
144
- raise ArgumentError, "Don't know test dir for #{testing_framework.inspect}"
145
- end
146
- end
147
-
148
- def test_filename
149
- "#{file_name_prefix}_#{test_or_spec}.rb"
150
- end
151
-
152
- def test_helper_filename
153
- "#{test_or_spec}_helper.rb"
154
- end
155
-
156
105
  def feature_filename
157
- "#{file_name_prefix}.feature"
106
+ "#{project_name}.feature"
158
107
  end
159
108
 
160
109
  def steps_filename
161
- "#{file_name_prefix}_steps.rb"
110
+ "#{project_name}_steps.rb"
162
111
  end
163
112
 
164
113
  def features_dir
@@ -173,20 +122,6 @@ class Jeweler
173
122
  File.join(features_dir, 'step_definitions')
174
123
  end
175
124
 
176
- def test_or_spec
177
- case testing_framework.to_sym
178
- when :shoulda, :testunit, :minitest
179
- 'test'
180
- when :bacon, :rspec
181
- 'spec'
182
- when :micronaut
183
- 'example'
184
- else
185
- raise ArgumentError, "Unknown test style: #{testing_framework}"
186
- end
187
- end
188
-
189
-
190
125
  protected
191
126
 
192
127
  # This is in a separate method so we can stub it out during testing
@@ -213,7 +148,7 @@ class Jeweler
213
148
  output_template_in_target '.document'
214
149
 
215
150
  mkdir_in_target lib_dir
216
- touch_in_target File.join(lib_dir, "#{file_name_prefix}.rb")
151
+ touch_in_target File.join(lib_dir, lib_filename)
217
152
 
218
153
  mkdir_in_target test_dir
219
154
  output_template_in_target File.join(testing_framework.to_s, 'helper.rb'), File.join(test_dir, test_helper_filename)
@@ -247,8 +182,10 @@ class Jeweler
247
182
  raise NoGitHubUser
248
183
  end
249
184
 
250
- unless git_config.has_key? 'github.token'
251
- raise NoGitHubToken
185
+ if should_create_repo
186
+ unless git_config.has_key? 'github.token'
187
+ raise NoGitHubToken
188
+ end
252
189
  end
253
190
 
254
191
  self.user_name = git_config['user.name']
@@ -306,13 +243,13 @@ class Jeweler
306
243
  end
307
244
 
308
245
  begin
309
- @repo.commit "Initial commit to #{github_repo_name}."
246
+ @repo.commit "Initial commit to #{project_name}."
310
247
  rescue Git::GitExecuteError => e
311
248
  raise
312
249
  end
313
250
 
314
251
  begin
315
- @repo.add_remote('origin', github_remote)
252
+ @repo.add_remote('origin', git_remote)
316
253
  rescue Git::GitExecuteError => e
317
254
  puts "Encountered an error while adding origin remote. Maybe you have some weird settings in ~/.gitconfig?"
318
255
  raise
@@ -327,13 +264,13 @@ class Jeweler
327
264
  'login' => github_username,
328
265
  'token' => github_token,
329
266
  'repository[description]' => summary,
330
- 'repository[name]' => github_repo_name
267
+ 'repository[name]' => project_name
331
268
  # TODO do a HEAD request to see when it's ready
332
269
  @repo.push('origin')
333
270
  end
334
271
 
335
272
  def enable_gem_for_repo
336
- url = "https://github.com/#{github_username}/#{github_repo_name}/update"
273
+ url = "https://github.com/#{github_username}/#{project_name}/update"
337
274
  `curl -F 'login=#{github_username}' -F 'token=#{github_token}' -F 'field=repository_rubygem' -F 'value=1' #{url} 2>/dev/null`
338
275
  # FIXME use NET::HTTP instead of curl
339
276
  #Net::HTTP.post_form URI.parse(url),