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 CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake/gempackagetask'
3
3
  require 'rake/testtask'
4
4
 
5
- require 'lib/simple_gem/version'
5
+ require File.join(File.dirname(__FILE__), %w(lib simple_gem version))
6
6
 
7
7
  task :default => :test
8
8
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'simple_gem/gem'
3
+ require 'simple_gem'
4
4
 
5
5
  if ARGV[0]
6
6
  gem = SimpleGem::Gem.new(`pwd`.strip, ARGV[0])
@@ -1,2 +1,5 @@
1
+ require 'erb'
2
+ require 'fileutils'
3
+
1
4
  require 'simple_gem/version'
2
5
  require 'simple_gem/gem'
@@ -1,5 +1,3 @@
1
- require 'erb'
2
-
3
1
  module SimpleGem
4
2
  class Gem
5
3
 
@@ -3,7 +3,7 @@ module SimpleGem
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 5
6
- TINY = 0
6
+ TINY = 1
7
7
 
8
8
  def self.to_s
9
9
  [MAJOR, MINOR, TINY].join('.')
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake/gempackagetask'
3
3
  require 'rake/testtask'
4
4
 
5
- require 'lib/<%= self.ruby_name %>/version'
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 = ['--text-report', "-x #{Gem.path}", '-x /Library/Ruby', '-x /usr/lib/ruby']
45
+ t.rcov_opts = options
41
46
  end
42
47
 
43
48
  task :default => :coverage
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
1
+ require File.expand_path(File.join(File.dirname(__FILE__), %w(.. test_helper)))
2
2
 
3
3
  class <%= self.module_name %>Test < Test::Unit::TestCase
4
4
 
@@ -1,16 +1,17 @@
1
1
  require 'rubygems'
2
- require 'context'
2
+ require 'test/unit'
3
+ require 'shoulda'
3
4
  require 'matchy'
4
5
 
5
- require File.dirname(__FILE__) + '/../../lib/simple_gem/gem'
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
- describe "An instance of Gem when given the name: #{name} name" do
13
- before do
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
- it "should know its #{k}" do
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
- describe "An instance of Gem" do
51
- before { @path = '/this/path' }
51
+ context "An instance of the Gem class" do
52
+ setup { @path = '/this/path' }
52
53
 
53
- it "should know its root path" do
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
- before do
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
- after do
68
+ teardown do
68
69
  FileUtils.rm_rf(@tmp_dir)
69
70
  end
70
71
 
71
- it "should be able to make the root directory" do
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
- it "should create the #{dir} subdirectory" do
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
- it "should create the main library file" do
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
- it "should create the version file" do
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
- it "should create the main Rakefile" do
90
+ should "create the main Rakefile" do
90
91
  File.exist?("#{@tmp_dir}/#{@name}/Rakefile").should == true
91
92
  end
92
93
 
93
- it "should create the README file" do
94
+ should "create the README file" do
94
95
  File.exist?("#{@tmp_dir}/#{@name}/README.rdoc").should == true
95
96
  end
96
97
 
97
- it "should generate the test helper file" do
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
- it "should generate the test file" do
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
- it "should generate the .gitignore file" do
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
- version: 0.5.0
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-01-31 00:00:00 -05:00
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.5
70
+ rubygems_version: 1.3.6
64
71
  signing_key:
65
72
  specification_version: 3
66
73
  summary: Make gems. Simple.