simple-gem 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/bin/simple-gem +1 -1
- data/lib/simple_gem.rb +3 -0
- data/lib/simple_gem/gem.rb +0 -2
- data/lib/simple_gem/version.rb +1 -1
- data/templates/Rakefile.erb +7 -2
- data/templates/test.rb.erb +1 -1
- data/test/simple_gem/gem_test.rb +20 -19
- metadata +12 -5
data/Rakefile
CHANGED
data/bin/simple-gem
CHANGED
data/lib/simple_gem.rb
CHANGED
data/lib/simple_gem/gem.rb
CHANGED
data/lib/simple_gem/version.rb
CHANGED
data/templates/Rakefile.erb
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake/gempackagetask'
|
3
3
|
require 'rake/testtask'
|
4
4
|
|
5
|
-
require
|
5
|
+
require File.join(File.dirname(__FILE__), %w(lib <%= self.ruby_name %> version))
|
6
6
|
|
7
7
|
spec = Gem::Specification.new do |s|
|
8
8
|
s.name = '<%= self.name %>'
|
@@ -33,11 +33,16 @@ end
|
|
33
33
|
begin
|
34
34
|
require 'rcov/rcovtask'
|
35
35
|
|
36
|
+
exclude_paths = %w(/Library/Ruby /usr/lib/ruby)
|
37
|
+
exclude_paths += Array(Gem.path)
|
38
|
+
|
39
|
+
options = ['--text-report'] + exclude_paths.map {|p| "-x '#{p}'" }
|
40
|
+
|
36
41
|
Rcov::RcovTask.new(:coverage) do |t|
|
37
42
|
t.libs = ['test']
|
38
43
|
t.test_files = FileList["test/**/*_test.rb"]
|
39
44
|
t.verbose = true
|
40
|
-
t.rcov_opts =
|
45
|
+
t.rcov_opts = options
|
41
46
|
end
|
42
47
|
|
43
48
|
task :default => :coverage
|
data/templates/test.rb.erb
CHANGED
data/test/simple_gem/gem_test.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'test/unit'
|
3
|
+
require 'shoulda'
|
3
4
|
require 'matchy'
|
4
5
|
|
5
|
-
require File.dirname(__FILE__)
|
6
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w(.. .. lib simple_gem)))
|
6
7
|
|
7
8
|
module SimpleGem
|
8
9
|
class GemTest < Test::Unit::TestCase
|
9
10
|
|
10
11
|
def self.should_generate(expectations)
|
11
12
|
name = expectations[:from].sub(/\W/, '')
|
12
|
-
|
13
|
-
|
13
|
+
context "An instance of Gem when given the name: #{name} name" do
|
14
|
+
setup do
|
14
15
|
path = '/this/path'
|
15
16
|
@name = expectations[:from]
|
16
17
|
@gem = Gem.new(path, @name)
|
@@ -18,7 +19,7 @@ module SimpleGem
|
|
18
19
|
|
19
20
|
expectations.each do |k,v|
|
20
21
|
unless k == :from
|
21
|
-
|
22
|
+
should "know its #{k}" do
|
22
23
|
@gem.send(k).should == v
|
23
24
|
end
|
24
25
|
end
|
@@ -47,16 +48,16 @@ module SimpleGem
|
|
47
48
|
:ruby_name => 'simple_gem',
|
48
49
|
:from => 'simpleGem'
|
49
50
|
|
50
|
-
|
51
|
-
|
51
|
+
context "An instance of the Gem class" do
|
52
|
+
setup { @path = '/this/path' }
|
52
53
|
|
53
|
-
|
54
|
+
should " know its root path" do
|
54
55
|
Gem.new(@path, 'name').root_path.should == @path
|
55
56
|
end
|
56
57
|
|
57
58
|
context "when generating the directory structure" do
|
58
59
|
|
59
|
-
|
60
|
+
setup do
|
60
61
|
@tmp_dir = File.dirname(__FILE__) + '/../../tmp'
|
61
62
|
FileUtils.mkdir(@tmp_dir) unless File.exist?(@tmp_dir)
|
62
63
|
|
@@ -64,45 +65,45 @@ module SimpleGem
|
|
64
65
|
Gem.new(@tmp_dir, @name).generate
|
65
66
|
end
|
66
67
|
|
67
|
-
|
68
|
+
teardown do
|
68
69
|
FileUtils.rm_rf(@tmp_dir)
|
69
70
|
end
|
70
71
|
|
71
|
-
|
72
|
+
should "be able to make the root directory" do
|
72
73
|
File.exist?("#{@tmp_dir}/#{@name}").should == true
|
73
74
|
end
|
74
75
|
|
75
76
|
%w(lib test lib/simple_gem test/unit).each do |dir|
|
76
|
-
|
77
|
+
should "create the #{dir} subdirectory" do
|
77
78
|
File.exist?("#{@tmp_dir}/#{@name}/#{dir}").should == true
|
78
79
|
end
|
79
80
|
end
|
80
81
|
|
81
|
-
|
82
|
+
should "create the main library file" do
|
82
83
|
File.exist?("#{@tmp_dir}/#{@name}/lib/simple_gem.rb").should == true
|
83
84
|
end
|
84
85
|
|
85
|
-
|
86
|
+
should "create the version file" do
|
86
87
|
File.exist?("#{@tmp_dir}/#{@name}/lib/simple_gem/version.rb").should == true
|
87
88
|
end
|
88
89
|
|
89
|
-
|
90
|
+
should "create the main Rakefile" do
|
90
91
|
File.exist?("#{@tmp_dir}/#{@name}/Rakefile").should == true
|
91
92
|
end
|
92
93
|
|
93
|
-
|
94
|
+
should "create the README file" do
|
94
95
|
File.exist?("#{@tmp_dir}/#{@name}/README.rdoc").should == true
|
95
96
|
end
|
96
97
|
|
97
|
-
|
98
|
+
should "generate the test helper file" do
|
98
99
|
File.exist?("#{@tmp_dir}/#{@name}/test/test_helper.rb").should == true
|
99
100
|
end
|
100
101
|
|
101
|
-
|
102
|
+
should "generate the test file" do
|
102
103
|
File.exist?("#{@tmp_dir}/#{@name}/test/unit/simple_gem_test.rb").should == true
|
103
104
|
end
|
104
105
|
|
105
|
-
|
106
|
+
should "generate the .gitignore file" do
|
106
107
|
File.exist?("#{@tmp_dir}/#{@name}/.gitignore").should == true
|
107
108
|
end
|
108
109
|
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 5
|
8
|
+
- 1
|
9
|
+
version: 0.5.1
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Patrick Reagan
|
@@ -9,7 +14,7 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-04-22 00:00:00 -04:00
|
13
18
|
default_executable:
|
14
19
|
dependencies: []
|
15
20
|
|
@@ -49,18 +54,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
54
|
requirements:
|
50
55
|
- - ">="
|
51
56
|
- !ruby/object:Gem::Version
|
57
|
+
segments:
|
58
|
+
- 0
|
52
59
|
version: "0"
|
53
|
-
version:
|
54
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
61
|
requirements:
|
56
62
|
- - ">="
|
57
63
|
- !ruby/object:Gem::Version
|
64
|
+
segments:
|
65
|
+
- 0
|
58
66
|
version: "0"
|
59
|
-
version:
|
60
67
|
requirements: []
|
61
68
|
|
62
69
|
rubyforge_project:
|
63
|
-
rubygems_version: 1.3.
|
70
|
+
rubygems_version: 1.3.6
|
64
71
|
signing_key:
|
65
72
|
specification_version: 3
|
66
73
|
summary: Make gems. Simple.
|