i0n_rails3_generators 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +9 -9
- data/config/version.yml +1 -1
- data/lib/i0n_rails3_generators.rb +3 -3
- data/test/helper.rb +12 -0
- data/test/test_i0n_rails3_generators.rb +52 -52
- metadata +4 -4
- data/test/i0n_rails3_generators/test_base.rb +0 -20
data/Rakefile
CHANGED
@@ -30,21 +30,21 @@ namespace :bump do
|
|
30
30
|
|
31
31
|
desc "Bumps major version number by 1"
|
32
32
|
task :major do
|
33
|
-
|
33
|
+
I0n.bump_version_major
|
34
34
|
git_actions
|
35
35
|
rubygems_actions
|
36
36
|
end
|
37
37
|
|
38
38
|
desc "Bumps minor version number by 1"
|
39
39
|
task :minor do
|
40
|
-
|
40
|
+
I0n.bump_version_minor
|
41
41
|
git_actions
|
42
42
|
rubygems_actions
|
43
43
|
end
|
44
44
|
|
45
45
|
desc "Bumps patch version number by 1"
|
46
46
|
task :patch do
|
47
|
-
|
47
|
+
I0n.bump_version_patch
|
48
48
|
git_actions
|
49
49
|
rubygems_actions
|
50
50
|
end
|
@@ -52,20 +52,20 @@ namespace :bump do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
task :version do
|
55
|
-
puts "\
|
55
|
+
puts "\nI0n Version: #{I0n::VERSION}"
|
56
56
|
end
|
57
57
|
|
58
58
|
def git_actions
|
59
|
-
Dir.chdir("#{
|
59
|
+
Dir.chdir("#{I0n::ROOT_PATH}")
|
60
60
|
system "git add ."
|
61
|
-
system "git commit -v -a -m 'commit for version: #{
|
62
|
-
system "git tag #{
|
61
|
+
system "git commit -v -a -m 'commit for version: #{I0n.version}'"
|
62
|
+
system "git tag #{I0n.version}"
|
63
63
|
system "git push"
|
64
64
|
system "git push --tags"
|
65
65
|
end
|
66
66
|
|
67
67
|
def rubygems_actions
|
68
|
-
Dir.chdir("#{
|
68
|
+
Dir.chdir("#{I0n::ROOT_PATH}")
|
69
69
|
system "gem build i0n_rails3_generators.gemspec"
|
70
|
-
system "gem push i0n_rails3_generators-#{
|
70
|
+
system "gem push i0n_rails3_generators-#{I0n.version}.gem"
|
71
71
|
end
|
data/config/version.yml
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'yaml'
|
4
4
|
|
5
|
-
module
|
5
|
+
module I0n
|
6
6
|
|
7
7
|
ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
8
8
|
LIB_PATH = File.expand_path(File.dirname(__FILE__))
|
@@ -10,7 +10,7 @@ module I0nRails3Generators
|
|
10
10
|
IGNORE_DIRS = ['.','..']
|
11
11
|
LAUNCH_PATH = FileUtils.pwd
|
12
12
|
|
13
|
-
@version_yaml = YAML.load_file("#{
|
13
|
+
@version_yaml = YAML.load_file("#{I0n::CONFIG_PATH}/version.yml")
|
14
14
|
|
15
15
|
@version_major = @version_yaml[:version_major]
|
16
16
|
@version_minor = @version_yaml[:version_minor]
|
@@ -22,7 +22,7 @@ module I0nRails3Generators
|
|
22
22
|
|
23
23
|
# Method for writing to config/jumpstart_version.yml
|
24
24
|
def dump_version_yaml
|
25
|
-
File.open( "#{
|
25
|
+
File.open( "#{I0n::CONFIG_PATH}/version.yml", 'w' ) do |out|
|
26
26
|
YAML.dump( {:version_major => @version_major, :version_minor => @version_minor, :version_patch => @version_patch}, out )
|
27
27
|
end
|
28
28
|
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'shoulda'
|
4
|
+
require 'mocha'
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
7
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
8
|
+
require 'i0n_rails3_generators'
|
9
|
+
|
10
|
+
class Test::Unit::TestCase
|
11
|
+
|
12
|
+
end
|
@@ -1,108 +1,108 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class TestI0n < Test::Unit::TestCase
|
4
4
|
|
5
5
|
should "be able to find version.yml" do
|
6
|
-
assert(File.exists?("#{
|
6
|
+
assert(File.exists?("#{I0n::CONFIG_PATH}/version.yml"))
|
7
7
|
end
|
8
8
|
|
9
|
-
context "Test for
|
9
|
+
context "Test for I0n.version class instance method" do
|
10
10
|
should "return 1.1.1" do
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
assert_equal "1.1.1",
|
11
|
+
I0n.version_major = 1
|
12
|
+
I0n.version_minor = 1
|
13
|
+
I0n.version_patch = 1
|
14
|
+
assert_equal "1.1.1", I0n.version
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
context "Tests for the
|
18
|
+
context "Tests for the I0n#dump_version_yaml class method." do
|
19
19
|
should "call File.open and Yaml.dump for version.yml" do
|
20
20
|
YAML.stubs(:dump)
|
21
21
|
File.stubs(:open)
|
22
22
|
File.expects(:open).once
|
23
|
-
|
23
|
+
I0n.dump_version_yaml
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
context "Tests for the
|
27
|
+
context "Tests for the I0n#bump class method." do
|
28
28
|
|
29
29
|
setup do
|
30
|
-
|
30
|
+
I0n.stubs(:dump_version_yaml)
|
31
31
|
end
|
32
32
|
|
33
|
-
should "add 1 to @version_major class instance variable, set @version_minor and @version_patch to 0 and call
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
assert_equal 2,
|
38
|
-
assert_equal 0,
|
39
|
-
assert_equal 0,
|
33
|
+
should "add 1 to @version_major class instance variable, set @version_minor and @version_patch to 0 and call dump_I0n_version_yaml" do
|
34
|
+
I0n.module_eval {@version_major = 1; @version_minor = 1; @version_patch = 1 }
|
35
|
+
I0n.expects(:dump_version_yaml).once
|
36
|
+
I0n.bump("version_major")
|
37
|
+
assert_equal 2, I0n.version_major
|
38
|
+
assert_equal 0, I0n.version_minor
|
39
|
+
assert_equal 0, I0n.version_patch
|
40
40
|
end
|
41
41
|
|
42
|
-
should "add 1 to @version_minor class instance variable, set @version_patch to 0 and call
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
assert_equal 1,
|
47
|
-
assert_equal 2,
|
48
|
-
assert_equal 0,
|
42
|
+
should "add 1 to @version_minor class instance variable, set @version_patch to 0 and call dump_I0n_version_yaml" do
|
43
|
+
I0n.module_eval {@version_major = 1; @version_minor = 1; @version_patch = 1 }
|
44
|
+
I0n.expects(:dump_version_yaml).once
|
45
|
+
I0n.bump("version_minor")
|
46
|
+
assert_equal 1, I0n.version_major
|
47
|
+
assert_equal 2, I0n.version_minor
|
48
|
+
assert_equal 0, I0n.version_patch
|
49
49
|
|
50
50
|
end
|
51
51
|
|
52
|
-
should "add 1 to @version_patch class instance variable and call
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
assert_equal 1,
|
57
|
-
assert_equal 1,
|
58
|
-
assert_equal 2,
|
52
|
+
should "add 1 to @version_patch class instance variable and call dump_I0n_version_yaml" do
|
53
|
+
I0n.module_eval {@version_major = 1; @version_minor = 1; @version_patch = 1 }
|
54
|
+
I0n.expects(:dump_version_yaml).once
|
55
|
+
I0n.bump("version_patch")
|
56
|
+
assert_equal 1, I0n.version_major
|
57
|
+
assert_equal 1, I0n.version_minor
|
58
|
+
assert_equal 2, I0n.version_patch
|
59
59
|
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
63
63
|
|
64
|
-
context "Tests for the
|
64
|
+
context "Tests for the I0n#const_missing class method." do
|
65
65
|
|
66
66
|
setup do
|
67
|
-
|
67
|
+
I0n.stubs(:version)
|
68
68
|
end
|
69
69
|
|
70
|
-
should "return the value of
|
71
|
-
|
72
|
-
|
70
|
+
should "return the value of I0n Version if I0n::VERSION is called" do
|
71
|
+
I0n.expects(:version).once
|
72
|
+
I0n::VERSION
|
73
73
|
end
|
74
74
|
|
75
75
|
should "return to super if an unknown constant is called" do
|
76
|
-
assert_raises(NameError) {
|
77
|
-
assert_raises(NameError) {
|
76
|
+
assert_raises(NameError) {I0n::VERSIONS}
|
77
|
+
assert_raises(NameError) {I0n::AVERSION}
|
78
78
|
end
|
79
79
|
|
80
80
|
end
|
81
81
|
|
82
|
-
context "Tests for the
|
82
|
+
context "Tests for the I0n#method_missing class method." do
|
83
83
|
|
84
84
|
setup do
|
85
|
-
|
86
|
-
|
85
|
+
I0n.stubs(:bump).returns(:result)
|
86
|
+
I0n.stubs(:dump_version_yaml)
|
87
87
|
end
|
88
88
|
|
89
|
-
should "recognise
|
90
|
-
|
91
|
-
|
89
|
+
should "recognise I0n#bump_version_major class instance method calls and forward them to I0n#bump to set @version_major." do
|
90
|
+
I0n.expects(:bump).with("version_major").once
|
91
|
+
I0n.bump_version_major
|
92
92
|
end
|
93
93
|
|
94
|
-
should "recognise
|
95
|
-
|
96
|
-
|
94
|
+
should "recognise I0n#bump_version_minor class instance method calls and forward them to I0n#bump to set @version_minor." do
|
95
|
+
I0n.expects(:bump).with("version_minor").once
|
96
|
+
I0n.bump_version_minor
|
97
97
|
end
|
98
98
|
|
99
|
-
should "recognise
|
100
|
-
|
101
|
-
|
99
|
+
should "recognise I0n#bump_version_patch class instance method calls and forward them to I0n#bump to set @version_patch." do
|
100
|
+
I0n.expects(:bump).with("version_patch").once
|
101
|
+
I0n.bump_version_patch
|
102
102
|
end
|
103
103
|
|
104
104
|
should "return method_missing to super as normal if method name is not recognised." do
|
105
|
-
assert_raises(NoMethodError) {
|
105
|
+
assert_raises(NoMethodError) {I0n.bump_version_blarg}
|
106
106
|
end
|
107
107
|
|
108
108
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ian Alexander Wood (i0n)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-08 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -72,7 +72,7 @@ files:
|
|
72
72
|
- lib/generators/authlogic/complete/templates/users_controller.rb
|
73
73
|
- lib/generators/authlogic/complete/templates/users_controller_test.rb
|
74
74
|
- lib/i0n_rails3_generators.rb
|
75
|
-
- test/
|
75
|
+
- test/helper.rb
|
76
76
|
- test/test_i0n_rails3_generators.rb
|
77
77
|
- LICENSE
|
78
78
|
- Rakefile
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestJumpstartBase < Test::Unit::TestCase
|
4
|
-
|
5
|
-
context "Testing I0n_rails3_generators::Base\n" do
|
6
|
-
|
7
|
-
setup do
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
teardown do
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
context "Tests for the I0n_rails3_generators::Base#intialize instance method. \n" do
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|