gpig 0.0.1 → 0.0.2
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/README.md +11 -1
- data/bin/gpig +33 -4
- data/lib/gpig/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
GPig
|
2
2
|
====
|
3
3
|
|
4
|
-
Usage: gpig
|
4
|
+
Usage: gpig <version_file> <git_repo_url>
|
5
5
|
|
6
6
|
This tool helps with gem development. It allows a developer to quickly develop gems by doing the following:
|
7
7
|
|
@@ -15,11 +15,21 @@ This tool helps with gem development. It allows a developer to quickly develop
|
|
15
15
|
Assumptions:
|
16
16
|
|
17
17
|
- Your gemspec references a VERSION variable.
|
18
|
+
|
19
|
+
<pre>
|
20
|
+
Gem::Specification.new do |s|
|
21
|
+
s.name = "gpig"
|
22
|
+
s.version = Gpig::VERSION
|
23
|
+
...
|
24
|
+
</pre>
|
25
|
+
|
18
26
|
- That VERSION variable is referenced in a version file that you give to gpig.
|
19
27
|
|
28
|
+
<pre>
|
20
29
|
module Gpig
|
21
30
|
VERSION = '0.0.1'
|
22
31
|
end
|
32
|
+
</pre>
|
23
33
|
|
24
34
|
Example:
|
25
35
|
|
data/bin/gpig
CHANGED
@@ -17,16 +17,45 @@ def increment_version(vfile)
|
|
17
17
|
File.open(vfile, 'w') { |file| file.write(str2) }
|
18
18
|
end
|
19
19
|
|
20
|
+
class PigConfig
|
21
|
+
def self.vfile=(str)
|
22
|
+
@@vfile = str
|
23
|
+
end
|
24
|
+
def self.vfile
|
25
|
+
return @@vfile
|
26
|
+
end
|
27
|
+
def self.repo=(str)
|
28
|
+
@@repo = str
|
29
|
+
end
|
30
|
+
def self.repo
|
31
|
+
return @@repo
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
20
35
|
#===============================================================================
|
21
36
|
|
22
|
-
vfile = ARGV.count > 0 ? ARGV[0] : false
|
23
|
-
repo = ARGV.count > 1 ? ARGV[1] : false
|
37
|
+
PigConfig.vfile = ARGV.count > 0 ? ARGV[0] : false
|
38
|
+
PigConfig.repo = ARGV.count > 1 ? ARGV[1] : false
|
24
39
|
|
25
|
-
if (
|
40
|
+
if (ARGV.count == 0 && File.exists?(File.join(Dir.pwd, '.gpig')))
|
41
|
+
load File.join(Dir.pwd, '.gpig')
|
42
|
+
end
|
43
|
+
|
44
|
+
vfile = PigConfig.vfile
|
45
|
+
repo = PigConfig.repo
|
46
|
+
|
47
|
+
if (!vfile || !repo || vfile.strip.length == 0 || repo.strip.length == 0)
|
26
48
|
puts "Usage: gpig <version_file> <git_repo_url>\n\n"
|
49
|
+
puts " or have a .gpig config file with those arguments on the first line."
|
27
50
|
exit
|
28
51
|
elsif (!File.exists?(vfile))
|
29
|
-
puts "Error: the version file
|
52
|
+
puts "Error: the version file (#{vfile}) doesn't seem to exist.\n";
|
53
|
+
exit
|
54
|
+
end
|
55
|
+
|
56
|
+
str = `git status`
|
57
|
+
if (!str.index('nothing to commit').nil?)
|
58
|
+
puts "There aren't any changes in the working directory.\n\n"
|
30
59
|
exit
|
31
60
|
end
|
32
61
|
|
data/lib/gpig/version.rb
CHANGED