tumbler 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock DELETED
@@ -1,57 +0,0 @@
1
- ---
2
- dependencies:
3
- fakeweb:
4
- group:
5
- - :development
6
- version: ">= 0"
7
- rake:
8
- group:
9
- - :development
10
- version: ">= 0"
11
- rspec:
12
- group:
13
- - :development
14
- version: ">= 0"
15
- versionomy:
16
- group:
17
- - :default
18
- version: ">= 0"
19
- mocha:
20
- group:
21
- - :development
22
- version: ">= 0"
23
- json:
24
- group:
25
- - :default
26
- version: ">= 0"
27
- callsite:
28
- group:
29
- - :default
30
- version: ">= 0"
31
- bundler:
32
- group:
33
- - :default
34
- version: ">= 0"
35
- specs:
36
- - rake:
37
- version: 0.8.7
38
- - blockenspiel:
39
- version: 0.3.3
40
- - bundler:
41
- version: 0.9.26
42
- - callsite:
43
- version: 0.0.2
44
- - fakeweb:
45
- version: 1.2.8
46
- - json:
47
- version: 1.4.3
48
- - mocha:
49
- version: 0.9.8
50
- - rspec:
51
- version: 1.3.0
52
- - versionomy:
53
- version: 0.4.0
54
- hash: 85f3afef38338d73c791177045f3c5d9b77a14b4
55
- sources:
56
- - Rubygems:
57
- uri: http://gemcutter.org
@@ -1,67 +0,0 @@
1
- require 'spec/spec_helper'
2
-
3
- describe 'bin/tumbler' do
4
- before(:each) do
5
- @bin = File.expand_path(File.join(File.dirname(__FILE__), '..', 'bin', 'tumbler'))
6
- @target = temp_dir('tmp')
7
- end
8
-
9
- after(:each) do
10
- FileUtils.rm_rf @target
11
- $".delete "tumbler/gemspec.rb" # we need to delete this so each gemspec can be generated fresh
12
- end
13
-
14
- context 'creation' do
15
- it "should generate an app" do
16
- Dir.chdir(@target) {`bundle exec ruby #{@bin} test_gem`}
17
- $?.should == 0
18
- tumbler = Tumbler.load(File.join(@target, 'test_gem'))
19
- tumbler.version.to_s.should == '0.0.0'
20
- tumbler.bundler.dependencies.first.name.should == 'tumbler'
21
- tumbler.bundler.dependencies.first.requirements_list.should == ['>= 0']
22
- tumbler.bundler.dependencies.first.groups.should == [:development]
23
- end
24
- end
25
-
26
- context 'upgrading' do
27
- before(:each) do
28
- Dir.chdir(@target) {`bundle exec ruby #{@bin} rails`}
29
- end
30
-
31
- it "should do nothing on a normal existing tumbler app" do
32
- tumbler = Tumbler.load(File.join(@target, 'rails'))
33
- version_file = File.read(tumbler.version.file)
34
- changelog_file = File.read(tumbler.changelog.file)
35
- gemfile_file = File.read(tumbler.gemfile_path)
36
- gemspec_file = File.read(tumbler.gemspec_path)
37
- Dir.chdir(@target) {`bundle exec ruby #{@bin} rails -u`}
38
- $?.should == 0
39
- version_file.should == File.read(tumbler.version.file)
40
- changelog_file.should == File.read(tumbler.changelog.file)
41
- gemfile_file.should == File.read(tumbler.gemfile_path)
42
- gemspec_file.should == File.read(tumbler.gemspec_path)
43
- end
44
-
45
- it "should work from inside the directory" do
46
- tumbler = Tumbler.load(File.join(@target, 'rails'))
47
- version_file = File.read(tumbler.version.file)
48
- changelog_file = File.read(tumbler.changelog.file)
49
- gemfile_file = File.read(tumbler.gemfile_path)
50
- gemspec_file = File.read(tumbler.gemspec_path)
51
- Dir.chdir("#{@target}/rails") {`bundle exec ruby #{@bin} . -u --name rails`}
52
- $?.should == 0
53
- version_file.should == File.read(tumbler.version.file)
54
- changelog_file.should == File.read(tumbler.changelog.file)
55
- gemfile_file.should == File.read(tumbler.gemfile_path)
56
- gemspec_file.should == File.read(tumbler.gemspec_path)
57
- end
58
-
59
- it "should not work if the directory and gemspec mismatch and you don't supply a name" do
60
- tumbler = Tumbler.load(File.join(@target, 'rails'))
61
- FileUtils.mv("#{@target}/rails/rails.gemspec", "#{@target}/rails/notrails.gemspec")
62
- Dir.chdir(@target) {`bundle exec ruby #{@bin} rails -u`}
63
- $?.exitstatus.should == 1
64
- end
65
-
66
- end
67
- end
@@ -1,52 +0,0 @@
1
- require 'spec/spec_helper'
2
-
3
- describe Tumbler::Manager::Changelog do
4
-
5
- after(:each) do
6
- $".delete "tumbler/gemspec.rb" # we need to delete this so each gemspec can be generated fresh
7
- end
8
-
9
- it "should generate a changelog" do
10
- create_app('test') { |tumbler|
11
- tumbler.sh 'touch file1'
12
- tumbler.sh 'git add file1'
13
- tumbler.sh 'git commit file1 -m"added file1"'
14
- tumbler.sh 'touch file2'
15
- tumbler.sh 'git add file2'
16
- tumbler.sh 'git commit file2 -m"added file2"'
17
- Tumbler::Gem.any_instance.stubs(:push).once.returns(true)
18
- tumbler.bump_and_push(:tiny)
19
- tumbler.version.to_s.should == '0.0.1'
20
- tumbler.changelog.file.should match_in_file(/== 0\.0\.1\s+\* added file2 \(.*?, [a-f0-9]{7}\)\s+\* added file1 \(.*?, [a-f0-9]{7}\)/)
21
- }
22
- end
23
-
24
- it "should not perform any changelog activity when the option isn't specified" do
25
- create_app('test', :changelog => nil) { |tumbler|
26
- tumbler.sh 'touch file1'
27
- tumbler.sh 'git add file1'
28
- tumbler.sh 'git commit file1 -m"added file1"'
29
- tumbler.sh 'touch file2'
30
- tumbler.sh 'git add file2'
31
- tumbler.sh 'git commit file2 -m"added file2"'
32
- Tumbler::Gem.any_instance.stubs(:push).once.returns(true)
33
- tumbler.bump_and_push(:tiny)
34
- tumbler.version.to_s.should == '0.0.1'
35
- File.exist?(File.join(tumbler.base, 'CHANGELOG')).should be_false
36
- }
37
- end
38
-
39
- it "should rollback the entire set of commits when the remote is unreachable" do
40
- create_app('test', :changelog => nil, :remote => 'ssh://ijustmadethisupisadomain.com/what_you_say.git') { |tumbler|
41
- tumbler.sh 'touch file1'
42
- tumbler.sh 'git add file1'
43
- tumbler.sh 'git commit file1 -m"added file1"'
44
- tumbler.sh 'touch file2'
45
- tumbler.sh 'git add file2'
46
- tumbler.sh 'git commit file2 -m"added file2"'
47
- current_rev = tumbler.current_revision
48
- proc {tumbler.bump_and_push(:tiny)}.should raise_error
49
- tumbler.sh('git log').split(/\n/)[0].should == "commit #{current_rev}"
50
- }
51
- end
52
- end
data/spec/gemspec_spec.rb DELETED
@@ -1,38 +0,0 @@
1
- require 'spec/spec_helper'
2
-
3
- describe Tumbler::GemspecHelper do
4
- before(:each) do
5
- @dir, @app = create_bare_app('test')
6
- @helper = Tumbler::GemspecHelper.new(@app)
7
- end
8
-
9
- after(:each) do
10
- FileUtils.rm_rf(@dir)
11
- end
12
-
13
- it "should have a name" do
14
- @helper.name.should == 'test'
15
- end
16
-
17
- it "should have a version number" do
18
- @helper.version.should == '0.0.0'
19
- end
20
-
21
- it "should have files" do
22
- @helper.files.should == ["CHANGELOG", "Gemfile", "Rakefile", "Tumbler", "lib/test/version.rb", "test.gemspec"]
23
- end
24
-
25
- it "should have a date" do
26
- @helper.date.should == Time.new.strftime("%Y-%m-%d")
27
- end
28
-
29
- it "should inject_dependencies" do
30
- spec = Gem::Specification.new
31
- File.open("#{@app.base}/Gemfile", 'a') {|f| f.puts "gem 'test', '>= 0.0.5'"}
32
- @app.reload
33
- @helper.inject_dependencies(spec)
34
- spec.runtime_dependencies.should == [Gem::Dependency.new('test', '>= 0.0.5')]
35
- spec.development_dependencies.should == [Gem::Dependency.new('tumbler', '>= 0', :development)]
36
- end
37
-
38
- end
@@ -1,64 +0,0 @@
1
- require 'spec/spec_helper'
2
-
3
- describe Tumbler::Generate do
4
-
5
- after(:each) do
6
- $".delete "tumbler/gemspec.rb" # we need to delete this so each gemspec can be generated fresh
7
- end
8
-
9
- it "should suppress changelog creation if disabled" do
10
- temp_dir('test') do |test_dir|
11
- Tumbler::Generate.app(test_dir, 'mygem', :changelog => nil).write
12
- File.exist?(File.join(test_dir, "CHANGELOG")).should be_false
13
- end
14
- end
15
-
16
- it "should generate the gem constant correctly with -" do
17
- temp_dir('test') do |test_dir|
18
- Tumbler::Generate.app(test_dir, 'my-gem', :changelog => nil).write
19
- File.join(test_dir, 'lib','my-gem','version.rb').should match_in_file(/My::Gem/)
20
- end
21
- end
22
-
23
- it "should generate the gem constant correctly with _" do
24
- temp_dir('test') do |test_dir|
25
- Tumbler::Generate.app(test_dir, 'my_gem', :changelog => nil).write
26
- File.join(test_dir, 'lib','my_gem','version.rb').should match_in_file(/MyGem/)
27
- end
28
- end
29
-
30
- it "should generate a gemspec" do
31
- temp_dir('test') do |test_dir|
32
- Tumbler::Generate.app(test_dir, 'mygem').write
33
- spec = Gem::Specification.load("#{test_dir}/mygem.gemspec")
34
- spec.dependencies.should == [Gem::Dependency.new('tumbler', '>=0', :development)]
35
- end
36
- end
37
-
38
- it "should generate a Rakefile" do
39
- temp_dir('test') do |test_dir|
40
- Tumbler::Generate.app(test_dir, 'mygem').write
41
- File.exist?("#{test_dir}/Rakefile").should be_true
42
- end
43
- end
44
-
45
- it "should accept an extra dependency" do
46
- temp_dir('test2') do |test_dir|
47
- Tumbler::Generate.app(test_dir, 'mygem', :dependencies => 'eventmachine').write
48
- spec = Gem::Specification.load("#{test_dir}/mygem.gemspec")
49
- spec.dependencies.should include(Gem::Dependency.new('tumbler', '>=0', :development))
50
- spec.dependencies.should include(Gem::Dependency.new('eventmachine', '>=0', :runtime))
51
- spec.dependencies.size.should == 2
52
- end
53
- end
54
-
55
- it "should accept an extra dependency with a version" do
56
- temp_dir('test2') do |test_dir|
57
- Tumbler::Generate.app(test_dir, 'mygem', :dependencies => [['eventmachine', '>=1.0.0']]).write
58
- spec = Gem::Specification.load("#{test_dir}/mygem.gemspec")
59
- spec.dependencies.should include(Gem::Dependency.new('tumbler', '>=0', :development))
60
- spec.dependencies.should include(Gem::Dependency.new('eventmachine', '>=1.0.0', :runtime))
61
- spec.dependencies.size.should == 2
62
- end
63
- end
64
- end
data/spec/spec.opts DELETED
@@ -1,7 +0,0 @@
1
- --colour
2
- --format
3
- specdoc
4
- --loadby
5
- mtime
6
- --reverse
7
- --backtrace
data/spec/spec_helper.rb DELETED
@@ -1,84 +0,0 @@
1
- require 'tempfile'
2
- require 'fileutils'
3
- require 'mocha'
4
-
5
- $LOAD_PATH << File.basename(__FILE__)
6
- $LOAD_PATH << File.join(File.basename(__FILE__), '..', 'lib')
7
-
8
- require 'tumbler'
9
-
10
- Tumbler::Gem.any_instance.stubs(:install).raises
11
- Tumbler::Gem.any_instance.stubs(:push).raises
12
-
13
- def create_app(name = 'test', opts = {})
14
- temp_dir(name) do |dir|
15
- temp_dir("remote-#{name}.git") do |remote_dir|
16
- Tumbler::Generate.app(dir, name, opts).write
17
- tumbler = Tumbler::Manager.new(dir)
18
-
19
- Dir.chdir(remote_dir) { `git --bare init` }
20
-
21
- remote = opts[:remote] || "file://#{remote_dir}"
22
-
23
- Dir.chdir(dir) {
24
- `git remote add origin #{remote}`
25
- `git push origin master`
26
- }
27
-
28
- yield tumbler
29
- end
30
- end
31
- end
32
-
33
- def create_bare_app(name, opts = {})
34
- dir = temp_dir(name)
35
- Tumbler::Generate.app(dir, name, opts).write
36
- tumbler = Tumbler::Manager.new(dir)
37
- [dir, tumbler]
38
- end
39
-
40
- def temp_dir(name)
41
- dir = File.join(Dir.tmpdir, rand(10000).to_s, "#{Process.pid}-#{name}")
42
- FileUtils.rm_rf(dir)
43
- FileUtils.mkdir_p(dir)
44
- if block_given?
45
- begin
46
- yield dir
47
- ensure
48
- FileUtils.rm_rf(dir)
49
- end
50
- else
51
- dir
52
- end
53
- end
54
-
55
- module Matchers
56
- class MatchInFile
57
- def initialize(pattern)
58
- @pattern = pattern
59
- end
60
-
61
- def matches?(file)
62
- @file = file
63
- @file = File.exist?(file) ? File.read(file) : false
64
- @file and @file =~ @pattern
65
- end
66
-
67
- def failure_message
68
- "expected #{@pattern} to match in '#{@file}'"
69
- end
70
-
71
- def negative_failure_message
72
- "expected #{@pattern} to not match in '#{@file}'"
73
- end
74
- end
75
-
76
- def match_in_file(expected)
77
- MatchInFile.new(expected)
78
- end
79
-
80
- end
81
-
82
- Spec::Runner.configure do |config|
83
- config.include(Matchers)
84
- end
data/spec/tasks_spec.rb DELETED
@@ -1,71 +0,0 @@
1
- require 'spec/spec_helper'
2
-
3
- describe Tumbler do
4
- before(:all) do
5
- ENV['RUBYLIB'] = File.expand_path(File.join(__DIR__, '..', 'lib'))
6
- end
7
-
8
- it "should gem.build" do
9
- create_app do |app|
10
- app.gem.build
11
- File.exist?("#{app.base}/pkg/test-0.0.0.gem").should be_true
12
- end
13
- end
14
-
15
- context "version bumping" do
16
- it "shouldn't write a new tag" do
17
- create_app do |app|
18
- app.bump_and_commit(:minor)
19
- app.tags.should == ['0.0.0']
20
- end
21
- end
22
-
23
- it "should increment the locally stored version" do
24
- create_app do |app|
25
- app.bump_and_commit(:minor)
26
- app.reload
27
- app.version.to_s.should == '0.1.0'
28
- end
29
- end
30
-
31
- it "should successfully push after a bump" do
32
- create_app do |app|
33
- Tumbler::Gem.any_instance.stubs(:push).once.returns(true)
34
- app.bump_and_commit(:minor)
35
- app.tag_and_push
36
- app.reload
37
- app.version.to_s.should == '0.1.0'
38
- app.tags.should == %w(0.0.0 0.1.0)
39
- end
40
- end
41
- end
42
-
43
- context "version bumping & pushing" do
44
- it "should create a nice changelog" do
45
- create_app do |app|
46
- Tumbler::Gem.any_instance.stubs(:push).times(4).returns(true)
47
- app.sh 'touch test1; git add test1; git commit test1 -m"Added test1"'
48
- app.bump_and_push(:minor)
49
- app.sh 'touch test2; git add test2; git commit test2 -m"Added test2"'
50
- app.sh 'touch test2-1; git add test2-1; git commit test2-1 -m"Added test2-1"'
51
- app.bump_and_push(:minor)
52
- app.sh 'touch test3; git add test3; git commit test3 -m"Added test3"'
53
- app.bump_and_push(:minor)
54
- app.sh 'touch test4; git add test4; git commit test4 -m"Added test4"'
55
- app.bump_and_push(:minor)
56
- app.reload
57
- changelog = File.read(app.changelog.file)
58
- changelog.should match(/== 0\.4\.0\s+\* Added test4 \(.*?\)\n\n==/)
59
- changelog.should match(/== 0\.3\.0\s+\* Added test3 \(.*?\)\n\n==/)
60
- changelog.should match(/== 0\.2\.0\s+\* Added test2-1 \(.*?\)\n\* Added test2 \(.*?\)\n\n==/)
61
- changelog.should match(/== 0\.1\.0\s+\* Added test1 \(.*?\)\n\n$/)
62
- end
63
- end
64
- end
65
-
66
- #
67
- # @app.bump_and_commit(:minor)
68
- # @app.tag_and_push
69
- #end
70
-
71
- end