bueller 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.markdown +141 -0
- data/LICENSE +20 -0
- data/README.markdown +182 -0
- data/bin/bueller +5 -0
- data/lib/bueller/commands/build_gem.rb +50 -0
- data/lib/bueller/commands/git_tag_release.rb +63 -0
- data/lib/bueller/commands/install_gem.rb +36 -0
- data/lib/bueller/commands/release_to_github.rb +41 -0
- data/lib/bueller/commands/release_to_rubygems.rb +26 -0
- data/lib/bueller/commands/version/base.rb +36 -0
- data/lib/bueller/commands/version/bump_major.rb +11 -0
- data/lib/bueller/commands/version/bump_minor.rb +12 -0
- data/lib/bueller/commands/version/bump_patch.rb +14 -0
- data/lib/bueller/commands/version/write.rb +21 -0
- data/lib/bueller/commands/write_gemspec.rb +29 -0
- data/lib/bueller/commands.rb +18 -0
- data/lib/bueller/errors.rb +8 -0
- data/lib/bueller/gemspec_helper.rb +83 -0
- data/lib/bueller/generator/application.rb +51 -0
- data/lib/bueller/generator/bacon_mixin.rb +43 -0
- data/lib/bueller/generator/github_mixin.rb +29 -0
- data/lib/bueller/generator/micronaut_mixin.rb +41 -0
- data/lib/bueller/generator/minitest_mixin.rb +42 -0
- data/lib/bueller/generator/options.rb +154 -0
- data/lib/bueller/generator/rdoc_mixin.rb +9 -0
- data/lib/bueller/generator/riot_mixin.rb +42 -0
- data/lib/bueller/generator/rspec_mixin.rb +50 -0
- data/lib/bueller/generator/shindo_mixin.rb +44 -0
- data/lib/bueller/generator/shoulda_mixin.rb +42 -0
- data/lib/bueller/generator/testspec_mixin.rb +42 -0
- data/lib/bueller/generator/testunit_mixin.rb +39 -0
- data/lib/bueller/generator/yard_mixin.rb +14 -0
- data/lib/bueller/generator.rb +291 -0
- data/lib/bueller/rubyforge_tasks.rb +88 -0
- data/lib/bueller/tasks.rb +133 -0
- data/lib/bueller/templates/.document +11 -0
- data/lib/bueller/templates/.gitignore +40 -0
- data/lib/bueller/templates/Gemfile +1 -0
- data/lib/bueller/templates/LICENSE +20 -0
- data/lib/bueller/templates/README.rdoc +17 -0
- data/lib/bueller/templates/Rakefile +20 -0
- data/lib/bueller/templates/bacon/flunking.rb +7 -0
- data/lib/bueller/templates/bacon/helper.rb +8 -0
- data/lib/bueller/templates/bueller_tasks.erb +10 -0
- data/lib/bueller/templates/features/default.feature +9 -0
- data/lib/bueller/templates/features/support/env.rb +16 -0
- data/lib/bueller/templates/gemspec +27 -0
- data/lib/bueller/templates/micronaut/flunking.rb +7 -0
- data/lib/bueller/templates/micronaut/helper.rb +17 -0
- data/lib/bueller/templates/minitest/flunking.rb +7 -0
- data/lib/bueller/templates/minitest/helper.rb +11 -0
- data/lib/bueller/templates/other_tasks.erb +84 -0
- data/lib/bueller/templates/riot/flunking.rb +11 -0
- data/lib/bueller/templates/riot/helper.rb +3 -0
- data/lib/bueller/templates/rspec/.rspec +1 -0
- data/lib/bueller/templates/rspec/flunking.rb +7 -0
- data/lib/bueller/templates/rspec/helper.rb +19 -0
- data/lib/bueller/templates/shindo/flunking.rb +8 -0
- data/lib/bueller/templates/shindo/helper.rb +5 -0
- data/lib/bueller/templates/shoulda/flunking.rb +7 -0
- data/lib/bueller/templates/shoulda/helper.rb +10 -0
- data/lib/bueller/templates/testspec/flunking.rb +7 -0
- data/lib/bueller/templates/testspec/helper.rb +7 -0
- data/lib/bueller/templates/testunit/flunking.rb +7 -0
- data/lib/bueller/templates/testunit/helper.rb +9 -0
- data/lib/bueller/version_helper.rb +59 -0
- data/lib/bueller.rb +139 -0
- data/spec/bueller/commands/build_gem_spec.rb +38 -0
- data/spec/bueller/commands/git_tag_release_spec.rb +79 -0
- data/spec/bueller/commands/install_gem_spec.rb +11 -0
- data/spec/bueller/commands/release_to_github_spec.rb +54 -0
- data/spec/bueller/commands/release_to_rubygems_spec.rb +15 -0
- data/spec/bueller/commands/version/bump_major_spec.rb +12 -0
- data/spec/bueller/commands/version/bump_minor_spec.rb +12 -0
- data/spec/bueller/commands/version/bump_patch_spec.rb +12 -0
- data/spec/bueller/commands/write_gemspec_spec.rb +32 -0
- data/spec/bueller/gemspec_helper_spec.rb +55 -0
- data/spec/bueller/generator/application_spec.rb +67 -0
- data/spec/bueller/generator/options_spec.rb +206 -0
- data/spec/bueller/generator_mixins_spec.rb +23 -0
- data/spec/bueller/generator_spec.rb +274 -0
- data/spec/bueller/tasks_spec.rb +29 -0
- data/spec/bueller/version_helper_spec.rb +57 -0
- data/spec/bueller_spec.rb +94 -0
- data/spec/fixtures/bar/bar.gemspec +41 -0
- data/spec/fixtures/bar/bin/foo_the_ultimate_bin +1 -0
- data/spec/fixtures/bar/hey_include_me_in_gemspec +0 -0
- data/spec/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -0
- data/spec/fixtures/existing-project/LICENSE +20 -0
- data/spec/fixtures/existing-project/README.rdoc +7 -0
- data/spec/fixtures/existing-project/Rakefile +69 -0
- data/spec/fixtures/existing-project/existing-project.gemspec +20 -0
- data/spec/fixtures/existing-project/lib/existing_project_with_version.rb +0 -0
- data/spec/fixtures/existing-project/test/existing_project_with_version_test.rb +7 -0
- data/spec/fixtures/existing-project/test/test_helper.rb +10 -0
- data/spec/fixtures/existing-project-with-version-constant/LICENSE +20 -0
- data/spec/fixtures/existing-project-with-version-constant/README.rdoc +7 -0
- data/spec/fixtures/existing-project-with-version-constant/Rakefile +69 -0
- data/spec/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +19 -0
- data/spec/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rb +0 -0
- data/spec/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +7 -0
- data/spec/fixtures/existing-project-with-version-constant/test/test_helper.rb +10 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/application.rb +28 -0
- data/spec/support/file_system.rb +24 -0
- data/spec/support/gemspec.rb +28 -0
- data/spec/support/git.rb +19 -0
- data/spec/support/have_version.rb +18 -0
- metadata +381 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller::Commands::InstallGem do
|
4
|
+
|
5
|
+
it "should call sh with gem install" do
|
6
|
+
bueller = Bueller.new FileSystem.fixture_path('existing-project')
|
7
|
+
command = Bueller::Commands::InstallGem.new bueller
|
8
|
+
command.should_receive(:sh).with /bundle exec gem install .*\/pkg\/existing-project-1.5.3.gem/
|
9
|
+
command.run
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller::Commands::ReleaseToGithub do
|
4
|
+
let(:bueller) { Bueller.new }
|
5
|
+
let(:command) { Bueller::Commands::ReleaseToGithub.new bueller, :output => StringIO.new }
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
status = mock(Object)
|
9
|
+
bueller.repo = mock(Git, :status => status)
|
10
|
+
|
11
|
+
command.repo.status.stub!(:added).and_return []
|
12
|
+
command.repo.status.stub!(:changed).and_return []
|
13
|
+
command.repo.status.stub!(:deleted).and_return []
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#run' do
|
17
|
+
before :each do
|
18
|
+
command.repo.stub! :checkout
|
19
|
+
command.repo.stub! :push
|
20
|
+
command.stub!(:release_tagged?).and_return true
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should raise an error if the staging area is unclean' do
|
24
|
+
command.stub!(:clean_staging_area?).and_return false
|
25
|
+
expect { command.run }.should raise_error(RuntimeError, /try committing/i)
|
26
|
+
end
|
27
|
+
it 'should check out master' do
|
28
|
+
command.repo.should_receive(:checkout).with 'master'
|
29
|
+
command.run
|
30
|
+
end
|
31
|
+
it 'should push' do
|
32
|
+
command.repo.should_receive :push
|
33
|
+
command.run
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#clean_staging_area?' do
|
38
|
+
it 'should return true if there are no added, changed, or deleted files' do
|
39
|
+
command.should be_clean_staging_area
|
40
|
+
end
|
41
|
+
it 'should return false if there are added files' do
|
42
|
+
command.repo.status.stub!(:added).and_return ['Gemfile.lock']
|
43
|
+
command.should_not be_clean_staging_area
|
44
|
+
end
|
45
|
+
it 'should return false if there are changed files' do
|
46
|
+
command.repo.status.stub!(:changed).and_return ['Gemfile.lock']
|
47
|
+
command.should_not be_clean_staging_area
|
48
|
+
end
|
49
|
+
it 'should return false if there are deleted files' do
|
50
|
+
command.repo.status.stub!(:deleted).and_return ['Gemfile.lock']
|
51
|
+
command.should_not be_clean_staging_area
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller::Commands::ReleaseToRubygems do
|
4
|
+
let(:gemspec_helper) { mock(Bueller::GemSpecHelper) }
|
5
|
+
let(:bueller) { mock(Bueller, :gemspec_helper => gemspec_helper) }
|
6
|
+
let(:command) { Bueller::Commands::ReleaseToRubygems.new bueller }
|
7
|
+
|
8
|
+
describe '.run' do
|
9
|
+
it "should push to gemcutter" do
|
10
|
+
command.gemspec_helper.stub!(:gem_path).and_return 'pkg/zomg-1.2.3.gem'
|
11
|
+
command.should_receive(:sh).with(/gem push pkg\/zomg-1\.2\.3\.gem/)
|
12
|
+
command.run
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller::Commands::Version::BumpMajor do
|
4
|
+
it "should call bump_major on version_helper in update_version" do
|
5
|
+
bueller = Bueller.new FileSystem.fixture_path('existing-project')
|
6
|
+
command = Bueller::Commands::Version::BumpMajor.new bueller
|
7
|
+
|
8
|
+
command.update_version
|
9
|
+
|
10
|
+
command.version_helper.major.should == 2
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller::Commands::Version::BumpMinor do
|
4
|
+
it "should call bump_minor on version_helper in update_version" do
|
5
|
+
bueller = Bueller.new FileSystem.fixture_path('existing-project')
|
6
|
+
command = Bueller::Commands::Version::BumpMinor.new bueller
|
7
|
+
|
8
|
+
command.update_version
|
9
|
+
|
10
|
+
command.version_helper.minor.should == 6
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller::Commands::Version::BumpPatch do
|
4
|
+
it "should call bump_patch on version_helper in update_version" do
|
5
|
+
bueller = Bueller.new FileSystem.fixture_path('existing-project')
|
6
|
+
command = Bueller::Commands::Version::BumpPatch.new bueller
|
7
|
+
|
8
|
+
command.update_version
|
9
|
+
|
10
|
+
command.version_helper.patch.should == 4
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller::Commands::WriteGemspec do
|
4
|
+
let(:bueller) { Bueller.new FileSystem.fixture_path('existing-project') }
|
5
|
+
let(:command) { Bueller::Commands::WriteGemspec.new(bueller) }
|
6
|
+
let(:now) { Time.now }
|
7
|
+
|
8
|
+
context "after run" do
|
9
|
+
before :each do
|
10
|
+
bueller.gemspec_helper.stub!(:write)
|
11
|
+
Time.stub!(:now).and_return Time.parse('2011-01-13 04:22:33')
|
12
|
+
end
|
13
|
+
it "should update gemspec version" do
|
14
|
+
bueller.version_helper.bump_major
|
15
|
+
command.run
|
16
|
+
bueller.gemspec_helper.version.to_s.should == '2.0.0'
|
17
|
+
end
|
18
|
+
it "should update gemspec date to the beginning of today" do
|
19
|
+
command.run
|
20
|
+
bueller.gemspec_helper.spec.date.to_s.should =~ /2011-01-13/
|
21
|
+
end
|
22
|
+
it "should write gemspec" do
|
23
|
+
bueller.gemspec_helper.should_receive :write
|
24
|
+
command.run
|
25
|
+
end
|
26
|
+
it "should output that the gemspec was written" do
|
27
|
+
bueller.output = StringIO.new
|
28
|
+
command.run
|
29
|
+
bueller.output.string.should =~ /Generated: .*existing-project\.gemspec/
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller::GemSpecHelper do
|
4
|
+
let(:spec) { Gemspec.build }
|
5
|
+
let(:helper) { Bueller::GemSpecHelper.new('.') }
|
6
|
+
|
7
|
+
describe '#valid?' do
|
8
|
+
it 'should return true if the gemspec is valid' do
|
9
|
+
helper.should be_valid
|
10
|
+
end
|
11
|
+
it 'should return false if the gemspec is not valid' do
|
12
|
+
helper.stub!(:reload_spec).and_raise StandardError
|
13
|
+
helper.should_not be_valid
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#reload_spec' do
|
18
|
+
it 'should clear out the evaluated gemspec' do
|
19
|
+
helper.spec_source = '2 + 2'
|
20
|
+
helper.reload_spec
|
21
|
+
helper.spec.should == 4
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#write" do
|
26
|
+
it 'should include updates made to the gemspec' do
|
27
|
+
file = mock(File)
|
28
|
+
File.stub!(:open).and_yield file
|
29
|
+
helper.update_version '999.999.999'
|
30
|
+
file.should_receive(:puts).with(/999\.999\.999/)
|
31
|
+
helper.write
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#path' do
|
36
|
+
it 'should return the path to the gemspec' do
|
37
|
+
Dir.stub!(:glob).and_return [File.join(File.dirname(__FILE__), 'test.gemspec')]
|
38
|
+
helper.path.should == "spec/bueller/test.gemspec"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#update_version' do
|
43
|
+
it 'should set the spec version to the new version' do
|
44
|
+
helper.update_version '999.999.999'
|
45
|
+
helper.version.to_s.should == '999.999.999'
|
46
|
+
end
|
47
|
+
it 'should raise an error if the spec has no existing version' do
|
48
|
+
s = Gem::Specification.new
|
49
|
+
helper.instance_variable_set :@spec, s
|
50
|
+
expect do
|
51
|
+
helper.update_version '9.9.9'
|
52
|
+
end.should raise_error(Bueller::GemSpecHelper::VersionMissing)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller::Generator::Application do
|
4
|
+
before :each do
|
5
|
+
# opts = {}
|
6
|
+
# opts.stub!(:opts).and_return({})
|
7
|
+
# Bueller::Generator::Options.stub!(:new).and_return(opts)
|
8
|
+
end
|
9
|
+
|
10
|
+
context "when options indicate help usage" do
|
11
|
+
let(:application) { App.run_application('-h') }
|
12
|
+
|
13
|
+
it "should exit with code 1" do
|
14
|
+
application.should == 1
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should should puts option usage' do
|
18
|
+
application
|
19
|
+
App.stderr.should =~ /Usage:/
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should not display anything on stdout' do
|
23
|
+
application
|
24
|
+
App.stdout.squeeze.strip.should == ''
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "when options indicate an invalid argument" do
|
29
|
+
let(:application) { App.run_application('--invalid-argument') }
|
30
|
+
|
31
|
+
it "should exit with code 1" do
|
32
|
+
application.should == 1
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should display invalid argument' do
|
36
|
+
application
|
37
|
+
App.stderr.should =~ /--invalid-argument/
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should display usage on stderr' do
|
41
|
+
application
|
42
|
+
App.stderr.should =~ /Usage:/
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should not display anything on stdout' do
|
46
|
+
App.stdout.squeeze.strip.should == ''
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "when options are good" do
|
51
|
+
let(:application) { App.run_application 'foo' }
|
52
|
+
|
53
|
+
before :each do
|
54
|
+
Bueller::Generator.stub!(:run)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should exit with code 1" do
|
58
|
+
application.should == 0
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should run generator" do
|
62
|
+
Bueller::Generator.should_receive :run
|
63
|
+
application
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -0,0 +1,206 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller::Generator::Options do
|
4
|
+
before :each do
|
5
|
+
GitSupport.stub_config GitSupport.valid_config
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.should_have_docmentation_framework(documentation_framework)
|
9
|
+
it "should use #{documentation_framework} for documentation" do
|
10
|
+
@options[:documentation_framework].should == documentation_framework.to_sym
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def setup_options(*arguments)
|
15
|
+
@options = Bueller::Generator::Options.new(["project_name"] + arguments)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.for_options(*options)
|
19
|
+
end
|
20
|
+
|
21
|
+
context "default options" do
|
22
|
+
before(:each) { setup_options }
|
23
|
+
should_have_docmentation_framework :rdoc
|
24
|
+
|
25
|
+
it "should use shoulda for testing" do
|
26
|
+
options = Bueller::Generator::Options.new(['project_name', '--shoulda'])
|
27
|
+
options[:testing_framework].should == :shoulda
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should not create repository' do
|
31
|
+
@options[:create_repo].should be_nil
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should have project name" do
|
35
|
+
@options[:project_name].should == "project_name"
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should use github username from git config" do
|
39
|
+
@options[:github_username].should == GitSupport.github_user
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should use github token from git config" do
|
43
|
+
@options[:github_token].should == GitSupport.github_token
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should use user name from git config" do
|
47
|
+
@options[:user_name].should == GitSupport.name
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should use user email from git config" do
|
51
|
+
@options[:user_email].should == GitSupport.email
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
it "should use bacon for testing" do
|
57
|
+
options = Bueller::Generator::Options.new(['project_name', '--bacon'])
|
58
|
+
options[:testing_framework].should == :bacon
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should use micronaut for testing" do
|
62
|
+
options = Bueller::Generator::Options.new(['project_name', '--micronaut'])
|
63
|
+
options[:testing_framework].should == :micronaut
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should use minitest for testing" do
|
67
|
+
options = Bueller::Generator::Options.new(['project_name', '--minitest'])
|
68
|
+
options[:testing_framework].should == :minitest
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should use rspec for testing" do
|
72
|
+
options = Bueller::Generator::Options.new(['project_name', '--rspec'])
|
73
|
+
options[:testing_framework].should == :rspec
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should use shoulda for testing" do
|
77
|
+
options = Bueller::Generator::Options.new(['project_name', '--shoulda'])
|
78
|
+
options[:testing_framework].should == :shoulda
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should use testunit for testing" do
|
82
|
+
options = Bueller::Generator::Options.new(['project_name', '--testunit'])
|
83
|
+
options[:testing_framework].should == :testunit
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should use testspec for testing" do
|
87
|
+
options = Bueller::Generator::Options.new(['project_name', '--testspec'])
|
88
|
+
options[:testing_framework].should == :testspec
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should use cucumber for testing" do
|
92
|
+
options = Bueller::Generator::Options.new(['project_name', '--cucumber'])
|
93
|
+
options[:use_cucumber].should be_true
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should use reek" do
|
97
|
+
options = Bueller::Generator::Options.new(['project_name', '--reek'])
|
98
|
+
options[:use_reek].should be_true
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should use roodi" do
|
102
|
+
options = Bueller::Generator::Options.new(['project_name', '--roodi'])
|
103
|
+
options[:use_roodi].should be_true
|
104
|
+
end
|
105
|
+
|
106
|
+
for_options '--create-repo' do
|
107
|
+
it 'should create repository' do
|
108
|
+
@options[:create_repo].should_not be_nil
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
for_options '--rdoc' do
|
113
|
+
should_have_docmentation_framework :rdoc
|
114
|
+
end
|
115
|
+
|
116
|
+
for_options '--yard' do
|
117
|
+
should_have_docmentation_framework :yard
|
118
|
+
end
|
119
|
+
|
120
|
+
for_options '--summary', 'zomg so awesome' do
|
121
|
+
it 'should have summary zomg so awesome' do
|
122
|
+
@options[:summary].should == 'zomg so awesome'
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
for_options '--description', 'Descriptive' do
|
127
|
+
it 'should have description Descriptive' do
|
128
|
+
@options[:description].should == 'Descriptive'
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
for_options '--directory', 'foo' do
|
133
|
+
it 'should have directory foo' do
|
134
|
+
@options[:directory].should == 'foo'
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
for_options '--help' do
|
139
|
+
it 'should show help' do
|
140
|
+
@options[:show_help].should_not be_nil
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
for_options '-h' do
|
145
|
+
it 'should show help' do
|
146
|
+
@options[:show_help].should_not be_nil
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
for_options '--zomg-invalid' do
|
151
|
+
it 'should be an invalid argument' do
|
152
|
+
@options[:invalid_argument].should_not be_nil
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
for_options '--user-name', 'myname' do
|
157
|
+
it "should set user name" do
|
158
|
+
@options[:user_name].should == 'myname'
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
for_options '--user-email', 'myname@mydomain.com' do
|
163
|
+
it "should set user email" do
|
164
|
+
@options[:user_email].should == 'myname@mydomain.com'
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
for_options '--homepage', 'http://zomg.com' do
|
169
|
+
it 'should set hoempage' do
|
170
|
+
@options[:homepage].should == 'http://zomg.com'
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
for_options '--git-remote', 'git@my-awesome-domain.com:zomg.git' do
|
175
|
+
it 'should set the git remote' do
|
176
|
+
@options[:git_remote].should == 'git@my-awesome-domain.com:zomg.git'
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
for_options '--github-username', 'mygithub' do
|
181
|
+
it "should set github username" do
|
182
|
+
@options[:github_username].should == 'mygithub'
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
for_options '--github-token', 'mygithubtoken' do
|
187
|
+
it "should set github token" do
|
188
|
+
@options[:github_token].should == 'mygithubtoken'
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
context "merging options" do
|
193
|
+
it "should take options from each" do
|
194
|
+
options = Bueller::Generator::Options.new(["--rspec"]).
|
195
|
+
merge Bueller::Generator::Options.new(["--create-repo"])
|
196
|
+
options[:testing_framework].should == :rspec
|
197
|
+
options[:create_repo].should_not be_nil
|
198
|
+
end
|
199
|
+
|
200
|
+
it "should shadow options" do
|
201
|
+
options = Bueller::Generator::Options.new(["--bacon"]).
|
202
|
+
merge Bueller::Generator::Options.new(["--rspec"])
|
203
|
+
options[:testing_framework].should == :rspec
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|