ritual 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/Rakefile +2 -0
- data/lib/ritual/version.rb +1 -1
- data/lib/ritual/version_file.rb +25 -16
- metadata +4 -4
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/lib/ritual/version.rb
CHANGED
data/lib/ritual/version_file.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Ritual
|
2
2
|
class VersionFile
|
3
|
+
VERSION_REGEXP = /^\s*VERSION\s*=\s*(\[.*?\])/
|
4
|
+
|
3
5
|
def initialize(path, library_name)
|
4
6
|
@path = path
|
5
7
|
@library_name = library_name
|
@@ -13,21 +15,28 @@ module Ritual
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def write
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
18
|
+
if File.exist?(path)
|
19
|
+
source = File.read(path).sub(VERSION_REGEXP) do |s|
|
20
|
+
"#{s[/\s*/]}VERSION = [#{@value.join(', ')}]"
|
21
|
+
end
|
22
|
+
open(path, 'w') { |f| f.puts source}
|
23
|
+
else
|
24
|
+
FileUtils.mkdir_p File.dirname(path)
|
25
|
+
open(path, 'w') do |file|
|
26
|
+
file.puts <<-EOS.gsub(/^ *\|/, '')
|
27
|
+
|module #{module_name}
|
28
|
+
| VERSION = #{value.inspect}
|
29
|
+
|
|
30
|
+
| class << VERSION
|
31
|
+
| include Comparable
|
32
|
+
|
|
33
|
+
| def to_s
|
34
|
+
| join('.')
|
35
|
+
| end
|
36
|
+
| end
|
37
|
+
|end
|
38
|
+
EOS
|
39
|
+
end
|
31
40
|
end
|
32
41
|
end
|
33
42
|
|
@@ -41,7 +50,7 @@ module Ritual
|
|
41
50
|
|
42
51
|
def read
|
43
52
|
if File.exist?(path)
|
44
|
-
File.read(path) =~
|
53
|
+
File.read(path) =~ VERSION_REGEXP and
|
45
54
|
eval $1
|
46
55
|
else
|
47
56
|
[0, 0, 0]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ritual
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- George Ogata
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-21 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|