technicalpickles-jeweler 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,7 +48,7 @@ class TestApplication < Test::Unit::TestCase
48
48
  end
49
49
 
50
50
  def build_generator(name = 'zomg', options = {:testing_framework => :shoulda})
51
- stub.instance_of(Git::Lib).parse_config '~/.gitconfig' do
51
+ stub(Git).global_config() do
52
52
  {'user.name' => 'John Doe', 'user.email' => 'john@example.com', 'github.user' => 'johndoe', 'github.token' => 'yyz'}
53
53
  end
54
54
 
@@ -105,7 +105,7 @@ class TestApplication < Test::Unit::TestCase
105
105
 
106
106
  context "when called with repo name" do
107
107
  setup do
108
- @options = {:testing_framework => :shoulda}
108
+ @options = {:testing_framework => :shoulda, :documentation_framework => :rdoc}
109
109
  @generator = build_generator('zomg', @options)
110
110
 
111
111
  stub(@generator).run
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class TestGenerator < Test::Unit::TestCase
4
4
  def build_generator(testing_framework = nil, options = {})
5
- stub.instance_of(Git::Lib).parse_config '~/.gitconfig' do
5
+ stub(Git).global_config() do
6
6
  {'user.name' => 'John Doe', 'user.email' => 'john@example.com', 'github.user' => 'johndoe', 'github.token' => 'yyz'}
7
7
  end
8
8
 
@@ -10,7 +10,11 @@ class TestGeneratorInitialization < Test::Unit::TestCase
10
10
  end
11
11
 
12
12
  def stub_git_config(options = {})
13
- stub.instance_of(Git::Lib).parse_config('~/.gitconfig') { options }
13
+ stub(Git).global_config() { options }
14
+ end
15
+
16
+ def valid_git_config
17
+ { 'user.name' => @git_name, 'user.email' => @git_email, 'github.user' => @github_user, 'github.token' => @github_token }
14
18
  end
15
19
 
16
20
  context "given a nil github repo name" do
@@ -74,40 +78,79 @@ class TestGeneratorInitialization < Test::Unit::TestCase
74
78
  end
75
79
  end
76
80
  end
77
-
78
- context "with valid git user configuration" do
81
+
82
+ context "default configuration" do
79
83
  setup do
80
- stub_git_config 'user.name' => @git_name, 'user.email' => @git_email, 'github.user' => @github_user, 'github.token' => @github_token
84
+ stub_git_config valid_git_config
85
+ @generator = Jeweler::Generator.new(@project_name)
81
86
  end
82
87
 
83
- context "for technicalpickle's the-perfect-gem repository" do
84
- setup do
85
- @generator = Jeweler::Generator.new(@project_name)
86
- end
88
+ should "use shoulda for testing" do
89
+ assert_equal :shoulda, @generator.testing_framework
90
+ end
87
91
 
88
- should "assign user's name from git config" do
89
- assert_equal @git_name, @generator.user_name
90
- end
92
+ should "use rdoc for documentation" do
93
+ assert_equal :rdoc, @generator.documentation_framework
94
+ end
91
95
 
92
- should "assign email from git config" do
93
- assert_equal @git_email, @generator.user_email
94
- end
96
+ should "set todo in summary" do
97
+ assert_match /todo/i, @generator.summary
98
+ end
95
99
 
96
- should "assign github remote" do
97
- assert_equal 'git@github.com:technicalpickles/the-perfect-gem.git', @generator.git_remote
98
- end
100
+ should "set todo in description" do
101
+ assert_match /todo/i, @generator.description
102
+ end
99
103
 
100
- should "assign github username from git config" do
101
- assert_equal @github_user, @generator.github_username
102
- end
104
+ should "set target directory to the project name" do
105
+ assert_equal @project_name, @generator.target_dir
106
+ end
103
107
 
104
- should "determine project name as the-perfect-gem" do
105
- assert_equal @project_name, @generator.project_name
106
- end
108
+ should "set user's name from git config" do
109
+ assert_equal @git_name, @generator.user_name
110
+ end
107
111
 
108
- should "determine target directory as the same as the github repository name" do
109
- assert_equal @generator.project_name, @generator.target_dir
110
- end
112
+ should "set email from git config" do
113
+ assert_equal @git_email, @generator.user_email
114
+ end
115
+
116
+ should "set a github remote based on username and project name" do
117
+ assert_equal "git@github.com:#{@github_user}/#{@project_name}.git", @generator.git_remote
118
+ end
119
+
120
+ should "set github username from git config" do
121
+ assert_equal @github_user, @generator.github_username
122
+ end
123
+
124
+ should "set project name as the-perfect-gem" do
125
+ assert_equal @project_name, @generator.project_name
126
+ end
127
+ end
128
+
129
+ context "using yard" do
130
+ setup do
131
+ @generator = Jeweler::Generator.new(@project_name, :documentation_framework => :yard)
132
+ end
133
+
134
+ should "set the doc_task to yardoc" do
135
+ assert_equal "yardoc", @generator.doc_task
136
+ end
137
+
138
+ end
139
+
140
+ context "using yard" do
141
+ setup do
142
+ @generator = Jeweler::Generator.new(@project_name, :documentation_framework => :rdoc)
143
+ end
144
+
145
+ should "set the doc_task to rdoc" do
146
+ assert_equal "rdoc", @generator.doc_task
147
+ end
148
+ end
149
+
150
+ context "using options" do
151
+ should "set documentation" do
152
+ generator = Jeweler::Generator.new(@project_name, :documentation_framework => :yard)
153
+ assert_equal :yard, generator.documentation_framework
111
154
  end
112
155
  end
113
156
  end
data/test/test_helper.rb CHANGED
@@ -1,21 +1,24 @@
1
- # Use vendored gem because of limited gem availability on runcoderun
2
- # This is loosely based on 'vendor everything'.
3
- Dir[File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', '**')].each do |dir|
4
- lib = "#{dir}/lib"
5
- $LOAD_PATH.unshift(lib) if File.directory?(lib)
6
- end
7
-
8
1
  require 'test/unit'
9
2
 
10
3
  require 'rubygems'
11
- require 'shoulda'
12
4
  begin
13
5
  require 'ruby-debug'
14
6
  rescue LoadError
15
7
  end
16
8
 
17
- require 'rr'
18
- require 'redgreen'
9
+ begin
10
+ require 'shoulda'
11
+ require 'rr'
12
+ require 'redgreen'
13
+ rescue LoadError => e
14
+ puts "*" * 80
15
+ puts "Some dependencies needed to run tests were missing. Run the following command to find them:"
16
+ puts
17
+ puts "\trake development_dependencies:check"
18
+ puts "*" * 80
19
+ exit 1
20
+ end
21
+
19
22
  require 'time'
20
23
 
21
24
  $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
@@ -35,8 +38,6 @@ class RubyForgeStub
35
38
  end
36
39
  end
37
40
 
38
- require 'output_catcher'
39
-
40
41
  class Test::Unit::TestCase
41
42
  include RR::Adapters::TestUnit unless include?(RR::Adapters::TestUnit)
42
43
 
@@ -93,6 +94,11 @@ class Test::Unit::TestCase
93
94
  @output = StringIO.new
94
95
  @command.output = @output
95
96
  end
97
+
98
+ if @command.respond_to? :repo
99
+ @repo = Object.new
100
+ @command.repo = @repo
101
+ end
96
102
  end
97
103
 
98
104
  context "", &block
data/test/test_options.rb CHANGED
@@ -8,6 +8,12 @@ class TestOptions < Test::Unit::TestCase
8
8
  end
9
9
  end
10
10
 
11
+ def self.should_have_docmentation_framework(documentation_framework)
12
+ should "use #{documentation_framework} for documentation" do
13
+ assert_equal documentation_framework.to_sym, @options[:documentation_framework]
14
+ end
15
+ end
16
+
11
17
  def setup_options(*arguments)
12
18
  @options = Jeweler::Generator::Options.new(arguments)
13
19
  end
@@ -22,6 +28,7 @@ class TestOptions < Test::Unit::TestCase
22
28
  context "default options" do
23
29
  setup { setup_options }
24
30
  should_have_testing_framework :shoulda
31
+ should_have_docmentation_framework :rdoc
25
32
  should 'not create repository' do
26
33
  assert ! @options[:create_repo]
27
34
  end
@@ -81,6 +88,14 @@ class TestOptions < Test::Unit::TestCase
81
88
  end
82
89
  end
83
90
 
91
+ for_options '--rdoc' do
92
+ should_have_docmentation_framework :rdoc
93
+ end
94
+
95
+ for_options '--yard' do
96
+ should_have_docmentation_framework :yard
97
+ end
98
+
84
99
  for_options '--summary', 'zomg so awesome' do
85
100
  should 'have summary zomg so awesome' do
86
101
  assert_equal 'zomg so awesome', @options[:summary]
data/test/test_tasks.rb CHANGED
@@ -6,11 +6,13 @@ class TestTasks < Test::Unit::TestCase
6
6
 
7
7
  context 'instantiating Jeweler::Tasks' do
8
8
  setup do
9
- Task.clear
10
-
11
9
  @jt = Jeweler::Tasks.new {}
12
10
  end
13
11
 
12
+ teardown do
13
+ Task.clear
14
+ end
15
+
14
16
  should 'assign @gemspec' do
15
17
  assert_not_nil @jt.gemspec
16
18
  end
@@ -29,23 +31,5 @@ class TestTasks < Test::Unit::TestCase
29
31
  assert !s.files.empty?
30
32
  end
31
33
  end
32
-
33
- should 'define tasks' do
34
- assert Task.task_defined?(:build)
35
- assert Task.task_defined?(:install)
36
- assert Task.task_defined?(:gemspec)
37
- assert Task.task_defined?(:build)
38
- assert Task.task_defined?(:install)
39
- assert Task.task_defined?(:'gemspec:validate')
40
- assert Task.task_defined?(:'gemspec:generate')
41
- assert Task.task_defined?(:version)
42
- assert Task.task_defined?(:'version:write')
43
- assert Task.task_defined?(:'version:bump:major')
44
- assert Task.task_defined?(:'version:bump:minor')
45
- assert Task.task_defined?(:'version:bump:patch')
46
- assert Task.task_defined?(:'release')
47
- assert Task.task_defined?(:'rubyforge:release:gem')
48
- assert Task.task_defined?(:'rubyforge:setup')
49
- end
50
34
  end
51
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: technicalpickles-jeweler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nichols
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-29 00:00:00 -07:00
12
+ date: 2009-08-05 00:00:00 -07:00
13
13
  default_executable: jeweler
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.1.1
23
+ version: 1.2.1
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rubyforge
@@ -32,6 +32,56 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: "0"
34
34
  version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: thoughtbot-shoulda
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: mhennemeyer-output_catcher
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: rr
57
+ type: :development
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: mocha
67
+ type: :development
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ - !ruby/object:Gem::Dependency
76
+ name: redgreen
77
+ type: :development
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: "0"
84
+ version:
35
85
  description: Simple and opinionated helper for creating Rubygem projects on GitHub
36
86
  email: josh@technicalpickles.com
37
87
  executables: