mattknox-jeweler 0.7.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/ChangeLog.markdown +14 -0
- data/LICENSE +20 -0
- data/README.markdown +90 -0
- data/Rakefile +43 -0
- data/TODO +13 -0
- data/VERSION.yml +4 -0
- data/bin/jeweler +72 -0
- data/lib/jeweler.rb +231 -0
- data/lib/jeweler/errors.rb +8 -0
- data/lib/jeweler/gemspec.rb +41 -0
- data/lib/jeweler/generator.rb +190 -0
- data/lib/jeweler/tasks.rb +109 -0
- data/lib/jeweler/templates/.gitignore +3 -0
- data/lib/jeweler/templates/LICENSE +20 -0
- data/lib/jeweler/templates/README +9 -0
- data/lib/jeweler/templates/Rakefile +40 -0
- data/lib/jeweler/templates/bacon/flunking_spec.rb +7 -0
- data/lib/jeweler/templates/bacon/spec_helper.rb +8 -0
- data/lib/jeweler/templates/shoulda/flunking_test.rb +7 -0
- data/lib/jeweler/templates/shoulda/test_helper.rb +10 -0
- data/lib/jeweler/version.rb +81 -0
- data/test/fixtures/bar/VERSION.yml +4 -0
- data/test/generators/initialization_test.rb +146 -0
- data/test/shoulda_macros/jeweler_macros.rb +35 -0
- data/test/test_gemspec.rb +32 -0
- data/test/test_generator.rb +269 -0
- data/test/test_helper.rb +63 -0
- data/test/test_jeweler.rb +133 -0
- data/test/test_tasks.rb +39 -0
- data/test/test_version.rb +115 -0
- metadata +102 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
gem 'thoughtbot-shoulda'
|
5
|
+
require 'shoulda'
|
6
|
+
gem 'ruby-debug'
|
7
|
+
require 'ruby-debug'
|
8
|
+
gem 'mocha'
|
9
|
+
require 'mocha'
|
10
|
+
|
11
|
+
require File.dirname(__FILE__) + '/shoulda_macros/jeweler_macros'
|
12
|
+
|
13
|
+
# Use vendored gem because of limited gem availability on runcoderun
|
14
|
+
# This is loosely based on 'vendor everything'.
|
15
|
+
Dir[File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', '**')].each do |dir|
|
16
|
+
lib = "#{dir}/lib"
|
17
|
+
$LOAD_PATH.unshift(lib) if File.directory?(lib)
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'output_catcher'
|
21
|
+
require 'time'
|
22
|
+
|
23
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
|
24
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
25
|
+
require 'jeweler'
|
26
|
+
|
27
|
+
# Fake out FileList from Rake
|
28
|
+
class FileList
|
29
|
+
def self.[](*args)
|
30
|
+
TMP_DIR.entries - ['.','..','.DS_STORE']
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
TMP_DIR = File.join(File.dirname(__FILE__), 'tmp')
|
35
|
+
FileUtils.rm_f(TMP_DIR) # GAH, dirty hax. Somewhere isn't tearing up correctly, so do some cleanup first
|
36
|
+
|
37
|
+
class Test::Unit::TestCase
|
38
|
+
def catch_out(&block)
|
39
|
+
OutputCatcher.catch_out do
|
40
|
+
block.call
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def fixture_dir
|
45
|
+
File.join(File.dirname(__FILE__), 'fixtures', 'bar')
|
46
|
+
end
|
47
|
+
|
48
|
+
def tmp_dir
|
49
|
+
File.join(File.dirname(__FILE__), 'tmp')
|
50
|
+
end
|
51
|
+
|
52
|
+
def build_spec(*files)
|
53
|
+
Gem::Specification.new do |s|
|
54
|
+
s.name = "bar"
|
55
|
+
s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
|
56
|
+
s.email = "josh@technicalpickles.com"
|
57
|
+
s.homepage = "http://github.com/technicalpickles/jeweler"
|
58
|
+
s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
|
59
|
+
s.authors = ["Josh Nichols", "Dan Croak"]
|
60
|
+
s.files = FileList[*files] unless files.empty?
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class TestJeweler < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@now = Time.now
|
7
|
+
Time.stubs(:now).returns(@now)
|
8
|
+
FileUtils.rm_rf("#{File.dirname(__FILE__)}/tmp")
|
9
|
+
end
|
10
|
+
|
11
|
+
def teardown
|
12
|
+
FileUtils.rm_rf("#{File.dirname(__FILE__)}/tmp")
|
13
|
+
end
|
14
|
+
|
15
|
+
context "A jeweler without a VERSION.yml" do
|
16
|
+
setup do
|
17
|
+
FileUtils.mkdir_p(tmp_dir)
|
18
|
+
@jeweler = Jeweler.new(build_spec, tmp_dir)
|
19
|
+
end
|
20
|
+
|
21
|
+
should "not have VERSION.yml" do
|
22
|
+
assert ! File.exists?(File.join(tmp_dir, 'VERSION.yml'))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
context "A Jeweler with a VERSION.yml" do
|
28
|
+
setup do
|
29
|
+
FileUtils.cp_r(fixture_dir, tmp_dir)
|
30
|
+
|
31
|
+
@jeweler = Jeweler.new(build_spec, tmp_dir)
|
32
|
+
end
|
33
|
+
|
34
|
+
should_have_major_version 1
|
35
|
+
should_have_minor_version 5
|
36
|
+
should_have_patch_version 2
|
37
|
+
should_be_version '1.5.2'
|
38
|
+
|
39
|
+
context "bumping the patch version" do
|
40
|
+
setup do
|
41
|
+
@output = catch_out { @jeweler.bump_patch_version }
|
42
|
+
end
|
43
|
+
should_bump_version 1, 5, 3
|
44
|
+
end
|
45
|
+
|
46
|
+
context "bumping the minor version" do
|
47
|
+
setup do
|
48
|
+
@output = catch_out { @jeweler.bump_minor_version }
|
49
|
+
end
|
50
|
+
|
51
|
+
should_bump_version 1, 6, 0
|
52
|
+
end
|
53
|
+
|
54
|
+
context "bumping the major version" do
|
55
|
+
setup do
|
56
|
+
@output = catch_out { @jeweler.bump_major_version}
|
57
|
+
end
|
58
|
+
|
59
|
+
should_bump_version 2, 0, 0
|
60
|
+
end
|
61
|
+
|
62
|
+
should "should find files" do
|
63
|
+
assert ! @jeweler.gemspec.files.empty?
|
64
|
+
end
|
65
|
+
|
66
|
+
context "with standard 'files' specified" do
|
67
|
+
setup do
|
68
|
+
@alt_jeweler = Jeweler.new(build_spec("[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"), tmp_dir)
|
69
|
+
end
|
70
|
+
|
71
|
+
should "have the same files as when no 'files' are specified" do
|
72
|
+
assert_equal @jeweler.gemspec.files, @alt_jeweler.gemspec.files
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context "gemsepc's rdoc" do
|
77
|
+
should 'have be enabled' do
|
78
|
+
assert @jeweler.gemspec.has_rdoc
|
79
|
+
end
|
80
|
+
|
81
|
+
should 'do inline source' do
|
82
|
+
assert @jeweler.gemspec.rdoc_options.include?('--inline-source')
|
83
|
+
end
|
84
|
+
|
85
|
+
should 'be utf-8' do
|
86
|
+
assert @jeweler.gemspec.rdoc_options.include?('--charset=UTF-8')
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
context "writing the gemspec" do
|
92
|
+
setup do
|
93
|
+
@output = catch_out { @jeweler.write_gemspec }
|
94
|
+
end
|
95
|
+
|
96
|
+
should "create bar.gemspec" do
|
97
|
+
assert File.exists?(File.join(tmp_dir, 'bar.gemspec'))
|
98
|
+
end
|
99
|
+
|
100
|
+
should "have created a valid gemspec" do
|
101
|
+
assert @jeweler.valid_gemspec?
|
102
|
+
end
|
103
|
+
|
104
|
+
should "output the name of the gemspec" do
|
105
|
+
assert_match 'bar.gemspec', @output
|
106
|
+
end
|
107
|
+
|
108
|
+
context "re-reading the gemspec" do
|
109
|
+
setup do
|
110
|
+
gemspec_path = File.join(tmp_dir, 'bar.gemspec')
|
111
|
+
data = File.read(gemspec_path)
|
112
|
+
|
113
|
+
@parsed_spec = eval("$SAFE = 3\n#{data}", binding, gemspec_path)
|
114
|
+
end
|
115
|
+
|
116
|
+
should "have version 1.5.2" do
|
117
|
+
assert_equal '1.5.2', @parsed_spec.version.version
|
118
|
+
end
|
119
|
+
|
120
|
+
should "have date filled in" do
|
121
|
+
assert_equal Time.local(@now.year, @now.month, @now.day), @parsed_spec.date
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
should "raise an exception when created with a nil gemspec" do
|
128
|
+
assert_raises Jeweler::GemspecError do
|
129
|
+
@jeweler = Jeweler.new(nil, tmp_dir)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
data/test/test_tasks.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
class TestTasks < Test::Unit::TestCase
|
5
|
+
include Rake
|
6
|
+
|
7
|
+
context 'instantiating Jeweler::Tasks' do
|
8
|
+
setup do
|
9
|
+
Task.clear
|
10
|
+
|
11
|
+
@jt = Jeweler::Tasks.new do |s|
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'assign @gemspec' do
|
17
|
+
assert_not_nil @jt.gemspec
|
18
|
+
end
|
19
|
+
|
20
|
+
should 'assign @jeweler' do
|
21
|
+
assert_not_nil @jt.jeweler
|
22
|
+
end
|
23
|
+
|
24
|
+
should 'define tasks' do
|
25
|
+
assert Task.task_defined?(:build)
|
26
|
+
assert Task.task_defined?(:install)
|
27
|
+
assert Task.task_defined?(:gemspec)
|
28
|
+
assert Task.task_defined?(:'gemspec:validate')
|
29
|
+
assert Task.task_defined?(:'gemspec:generate')
|
30
|
+
assert Task.task_defined?(:version)
|
31
|
+
assert Task.task_defined?(:'version:write')
|
32
|
+
assert Task.task_defined?(:'version:display')
|
33
|
+
assert Task.task_defined?(:'version:bump:major')
|
34
|
+
assert Task.task_defined?(:'version:bump:minor')
|
35
|
+
assert Task.task_defined?(:'version:bump:patch')
|
36
|
+
assert Task.task_defined?(:'release')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class TestVersion < Test::Unit::TestCase
|
4
|
+
|
5
|
+
VERSION_TMP_DIR = File.dirname(__FILE__) + '/version_tmp'
|
6
|
+
|
7
|
+
def self.should_have_version(major, minor, patch)
|
8
|
+
should "have major version #{major}" do
|
9
|
+
assert_equal major, @version.major
|
10
|
+
end
|
11
|
+
|
12
|
+
should "have minor version #{minor}" do
|
13
|
+
assert_equal minor, @version.minor
|
14
|
+
end
|
15
|
+
|
16
|
+
should "have patch version #{patch}" do
|
17
|
+
assert_equal patch, @version.patch
|
18
|
+
end
|
19
|
+
|
20
|
+
version_s = "#{major}.#{minor}.#{patch}"
|
21
|
+
should "render string as #{version_s.inspect}" do
|
22
|
+
assert_equal version_s, @version.to_s
|
23
|
+
end
|
24
|
+
|
25
|
+
version_hash = {:major => major, :minor => minor, :patch => patch}
|
26
|
+
should "render hash as #{version_hash.inspect}" do
|
27
|
+
assert_equal version_hash, @version.to_hash
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
context "VERSION.yml with 3.5.4" do
|
33
|
+
setup do
|
34
|
+
FileUtils.rm_rf VERSION_TMP_DIR
|
35
|
+
FileUtils.mkdir_p VERSION_TMP_DIR
|
36
|
+
|
37
|
+
build_version_yml VERSION_TMP_DIR, 3, 5, 4
|
38
|
+
|
39
|
+
@version = Jeweler::Version.new VERSION_TMP_DIR
|
40
|
+
end
|
41
|
+
|
42
|
+
should_have_version 3, 5, 4
|
43
|
+
|
44
|
+
context "bumping major version" do
|
45
|
+
setup { @version.bump_major }
|
46
|
+
should_have_version 4, 0, 0
|
47
|
+
end
|
48
|
+
|
49
|
+
context "bumping the minor version" do
|
50
|
+
setup { @version.bump_minor }
|
51
|
+
should_have_version 3, 6, 0
|
52
|
+
end
|
53
|
+
|
54
|
+
context "bumping the patch version" do
|
55
|
+
setup { @version.bump_patch }
|
56
|
+
should_have_version 3, 5, 5
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context "Non-existant VERSION.yml" do
|
61
|
+
setup do
|
62
|
+
FileUtils.rm_rf VERSION_TMP_DIR
|
63
|
+
FileUtils.mkdir_p VERSION_TMP_DIR
|
64
|
+
end
|
65
|
+
|
66
|
+
should "not raise error if the VERSION.yml doesn't exist" do
|
67
|
+
assert_nothing_raised Jeweler::VersionYmlError do
|
68
|
+
Jeweler::Version.new(VERSION_TMP_DIR)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "setting an initial version" do
|
73
|
+
setup do
|
74
|
+
@version = Jeweler::Version.new(VERSION_TMP_DIR)
|
75
|
+
@version.update_to 0, 0, 1
|
76
|
+
end
|
77
|
+
|
78
|
+
should_have_version 0, 0, 1
|
79
|
+
should "not create VERSION.yml" do
|
80
|
+
assert ! File.exists?(File.join(VERSION_TMP_DIR, 'VERSION.yml'))
|
81
|
+
end
|
82
|
+
|
83
|
+
context "outputting" do
|
84
|
+
setup do
|
85
|
+
@version.write
|
86
|
+
end
|
87
|
+
|
88
|
+
should "create VERSION.yml" do
|
89
|
+
assert File.exists?(File.join(VERSION_TMP_DIR, 'VERSION.yml'))
|
90
|
+
end
|
91
|
+
|
92
|
+
context "re-reading VERSION.yml" do
|
93
|
+
setup do
|
94
|
+
@version = Jeweler::Version.new(VERSION_TMP_DIR)
|
95
|
+
end
|
96
|
+
|
97
|
+
should_have_version 0, 0, 1
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def build_version_yml(base_dir, major, minor, patch)
|
104
|
+
version_yaml_path = File.join(base_dir, 'VERSION.yml')
|
105
|
+
|
106
|
+
File.open(version_yaml_path, 'w+') do |f|
|
107
|
+
version_hash = {
|
108
|
+
'major' => major.to_i,
|
109
|
+
'minor' => minor.to_i,
|
110
|
+
'patch' => patch.to_i
|
111
|
+
}
|
112
|
+
YAML.dump(version_hash, f)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mattknox-jeweler
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Josh Nichols
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-01-19 00:00:00 -08:00
|
13
|
+
default_executable: jeweler
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: schacon-git
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "0"
|
23
|
+
version:
|
24
|
+
description: Simple and opinionated helper for creating Rubygem projects on GitHub
|
25
|
+
email: josh@technicalpickles.com
|
26
|
+
executables:
|
27
|
+
- jeweler
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files: []
|
31
|
+
|
32
|
+
files:
|
33
|
+
- ChangeLog.markdown
|
34
|
+
- LICENSE
|
35
|
+
- Rakefile
|
36
|
+
- README.markdown
|
37
|
+
- TODO
|
38
|
+
- VERSION.yml
|
39
|
+
- bin/jeweler
|
40
|
+
- lib/jeweler
|
41
|
+
- lib/jeweler/errors.rb
|
42
|
+
- lib/jeweler/gemspec.rb
|
43
|
+
- lib/jeweler/generator.rb
|
44
|
+
- lib/jeweler/tasks.rb
|
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
|
49
|
+
- lib/jeweler/templates/LICENSE
|
50
|
+
- lib/jeweler/templates/Rakefile
|
51
|
+
- lib/jeweler/templates/README
|
52
|
+
- lib/jeweler/templates/shoulda
|
53
|
+
- lib/jeweler/templates/shoulda/flunking_test.rb
|
54
|
+
- lib/jeweler/templates/shoulda/test_helper.rb
|
55
|
+
- lib/jeweler/version.rb
|
56
|
+
- lib/jeweler.rb
|
57
|
+
- test/fixtures
|
58
|
+
- test/fixtures/bar
|
59
|
+
- test/fixtures/bar/VERSION.yml
|
60
|
+
- test/generators
|
61
|
+
- test/generators/initialization_test.rb
|
62
|
+
- test/jeweler
|
63
|
+
- test/shoulda_macros
|
64
|
+
- test/shoulda_macros/jeweler_macros.rb
|
65
|
+
- test/test_gemspec.rb
|
66
|
+
- test/test_generator.rb
|
67
|
+
- test/test_helper.rb
|
68
|
+
- test/test_jeweler.rb
|
69
|
+
- test/test_tasks.rb
|
70
|
+
- test/test_version.rb
|
71
|
+
- test/version_tmp
|
72
|
+
- test/version_tmp/VERSION.yml
|
73
|
+
- lib/jeweler/templates/.gitignore
|
74
|
+
has_rdoc: true
|
75
|
+
homepage: http://github.com/technicalpickles/jeweler
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options:
|
78
|
+
- --inline-source
|
79
|
+
- --charset=UTF-8
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: "0"
|
87
|
+
version:
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: "0"
|
93
|
+
version:
|
94
|
+
requirements: []
|
95
|
+
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 1.2.0
|
98
|
+
signing_key:
|
99
|
+
specification_version: 2
|
100
|
+
summary: Simple and opinionated helper for creating Rubygem projects on GitHub
|
101
|
+
test_files: []
|
102
|
+
|