is-build 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.yardopts +9 -0
- data/lib/is/build.rb +55 -0
- metadata +48 -0
data/.yardopts
ADDED
data/lib/is/build.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'digest/sha1'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'is/monkey/sandbox'
|
6
|
+
|
7
|
+
module Is
|
8
|
+
|
9
|
+
module Build
|
10
|
+
|
11
|
+
VERSION = '0.2.0'
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
class Gem::Specification
|
18
|
+
|
19
|
+
def mkhash
|
20
|
+
s = ''
|
21
|
+
files.each do |f|
|
22
|
+
s += File.read f
|
23
|
+
end
|
24
|
+
Digest::SHA1.hexdigest s
|
25
|
+
end
|
26
|
+
|
27
|
+
def mkbuild prefix = ''
|
28
|
+
file = "./.#{name}.vers"
|
29
|
+
if File.exists? file
|
30
|
+
data = File.read(file)
|
31
|
+
vers = sandbox { eval(data) }
|
32
|
+
else
|
33
|
+
vers = {}
|
34
|
+
end
|
35
|
+
hash = mkhash
|
36
|
+
vx = version.to_s + '.' + prefix
|
37
|
+
if vers[vx]
|
38
|
+
current = vers[vx]
|
39
|
+
if current[:hash] != hash
|
40
|
+
current[:build] += 1
|
41
|
+
current[:hash] = hash
|
42
|
+
end
|
43
|
+
else
|
44
|
+
current = { :hash => hash, :build => 0 }
|
45
|
+
end
|
46
|
+
vers[vx] = current
|
47
|
+
File.open file, 'w' do |f|
|
48
|
+
f.puts vers.inspect
|
49
|
+
end
|
50
|
+
if current[:build] && (current[:build] != 0 || prefix != '')
|
51
|
+
self.version = vx + current[:build].to_s
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: is-build
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ivan Shikhalev
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-15 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Autoincrement build number.
|
15
|
+
email: shikhalev@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/is/build.rb
|
21
|
+
- .yardopts
|
22
|
+
homepage: https://github.com/shikhalev/gems
|
23
|
+
licenses:
|
24
|
+
- GNU LGPL
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.9.2
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 1.8.25
|
44
|
+
signing_key:
|
45
|
+
specification_version: 3
|
46
|
+
summary: Autoincrement build number
|
47
|
+
test_files: []
|
48
|
+
has_rdoc:
|