technicalpickles-jeweler 0.11.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +7 -0
- data/ChangeLog.markdown +8 -0
- data/README.markdown +9 -9
- data/ROADMAP +12 -0
- data/Rakefile +22 -5
- data/VERSION.yml +2 -2
- data/features/generator/cucumber.feature +83 -0
- data/features/generator/directory_layout.feature +76 -0
- data/features/generator/dotdocument.feature +14 -0
- data/features/generator/env_options.feature +9 -0
- data/features/generator/git.feature +94 -0
- data/features/generator/license.feature +11 -0
- data/features/generator/rakefile.feature +110 -0
- data/features/generator/readme.feature +12 -0
- data/features/generator/test.feature +41 -0
- data/features/generator/test_helper.feature +49 -0
- data/features/placeholder.feature +5 -0
- data/features/step_definitions/debug_steps.rb +6 -0
- data/features/step_definitions/filesystem_steps.rb +65 -0
- data/features/step_definitions/generator_steps.rb +251 -0
- data/features/step_definitions/task_steps.rb +6 -0
- data/features/support/env.rb +19 -0
- data/features/tasks/build_gem.feature +9 -0
- data/features/tasks/version.feature +24 -0
- data/features/tasks/version_bumping.feature +33 -0
- data/jeweler.gemspec +204 -0
- data/lib/jeweler/commands/release.rb +35 -11
- data/lib/jeweler/commands/version/base.rb +1 -1
- data/lib/jeweler/gemspec_helper.rb +4 -6
- data/lib/jeweler/generator/application.rb +8 -3
- data/lib/jeweler/generator/bacon_mixin.rb +39 -0
- data/lib/jeweler/generator/micronaut_mixin.rb +38 -0
- data/lib/jeweler/generator/minitest_mixin.rb +39 -0
- data/lib/jeweler/generator/options.rb +5 -1
- data/lib/jeweler/generator/rspec_mixin.rb +39 -0
- data/lib/jeweler/generator/shoulda_mixin.rb +39 -0
- data/lib/jeweler/generator/testunit_mixin.rb +39 -0
- data/lib/jeweler/generator.rb +48 -111
- data/lib/jeweler/rubyforge_tasks.rb +46 -0
- data/lib/jeweler/specification.rb +3 -2
- data/lib/jeweler/tasks.rb +32 -26
- data/lib/jeweler/templates/README.rdoc +1 -1
- data/lib/jeweler/templates/Rakefile +29 -52
- data/lib/jeweler/templates/bacon/helper.rb +1 -1
- data/lib/jeweler/templates/features/support/env.rb +4 -7
- data/lib/jeweler/templates/micronaut/helper.rb +1 -1
- data/lib/jeweler/templates/minitest/helper.rb +1 -1
- data/lib/jeweler/templates/rspec/flunking.rb +1 -1
- data/lib/jeweler/templates/rspec/helper.rb +1 -1
- data/lib/jeweler/templates/shoulda/helper.rb +1 -1
- data/lib/jeweler/templates/testunit/helper.rb +1 -1
- data/lib/jeweler/version_helper.rb +78 -33
- data/lib/jeweler.rb +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.document +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/LICENSE +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/README.rdoc +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/Rakefile +0 -0
- data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/existing-project-with-version.gemspec +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/test/existing_project_with_version_test.rb +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/test/test_helper.rb +0 -0
- data/test/fixtures/existing-project-with-version-yaml/.document +5 -0
- data/test/fixtures/existing-project-with-version-yaml/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-yaml/LICENSE +20 -0
- data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +82 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-yaml}/VERSION.yml +0 -0
- data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb +10 -0
- data/test/jeweler/commands/test_release.rb +304 -79
- data/test/test_application.rb +26 -0
- data/test/test_gemspec_helper.rb +4 -0
- data/test/test_generator.rb +83 -112
- data/test/test_generator_initialization.rb +113 -0
- data/test/test_generator_mixins.rb +18 -0
- data/test/test_helper.rb +3 -0
- data/test/test_options.rb +6 -0
- data/test/test_specification.rb +6 -2
- data/test/test_version_helper.rb +47 -9
- metadata +72 -17
- 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
|
-
|
16
|
-
gemspec_helper.write
|
17
|
+
repo.checkout('master')
|
17
18
|
|
18
|
-
|
19
|
-
|
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
|
33
|
-
|
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
|
@@ -58,12 +58,10 @@ class Jeweler
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def prettyify_array(gemspec_ruby, array_name)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
-
|
27
|
+
project_name = arguments.first
|
23
28
|
|
24
29
|
begin
|
25
|
-
generator = Jeweler::Generator.new(
|
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 #{
|
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
|
@@ -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
|
data/lib/jeweler/generator.rb
CHANGED
@@ -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
|
-
:
|
32
|
+
:project_name, :github_username, :github_token,
|
26
33
|
:repo, :should_create_repo, :should_use_cucumber, :should_setup_rubyforge
|
27
34
|
|
28
|
-
|
35
|
+
DEFAULT_TESTING_FRAMEWORK = :shoulda
|
29
36
|
|
30
|
-
def initialize(
|
31
|
-
if
|
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.
|
42
|
+
self.project_name = project_name
|
36
43
|
|
37
|
-
self.testing_framework = (options[:testing_framework] ||
|
38
|
-
|
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.
|
45
|
-
|
46
|
-
self.
|
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 #{
|
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 #{
|
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
|
-
|
66
|
-
|
67
|
-
test_or_spec
|
77
|
+
def git_remote
|
78
|
+
"git@github.com:#{github_username}/#{project_name}.git"
|
68
79
|
end
|
69
80
|
|
70
|
-
|
71
|
-
|
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
|
100
|
-
|
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
|
115
|
-
"
|
89
|
+
def lib_filename
|
90
|
+
"#{project_name}.rb"
|
116
91
|
end
|
117
92
|
|
118
|
-
def
|
119
|
-
|
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.
|
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
|
-
"#{
|
106
|
+
"#{project_name}.feature"
|
158
107
|
end
|
159
108
|
|
160
109
|
def steps_filename
|
161
|
-
"#{
|
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,
|
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
|
-
|
251
|
-
|
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 #{
|
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',
|
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]' =>
|
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}/#{
|
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),
|