autoparse 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/LICENSE +202 -0
- data/README.md +25 -0
- data/Rakefile +60 -0
- data/lib/autoparse/inflection.rb +23 -0
- data/lib/autoparse/instance.rb +422 -0
- data/lib/autoparse/version.rb +26 -0
- data/lib/autoparse.rb +203 -0
- data/spec/autoparse/instance_spec.rb +904 -0
- data/spec/data/account.json +8 -0
- data/spec/data/address.json +20 -0
- data/spec/data/adult.json +5 -0
- data/spec/data/calendar.json +49 -0
- data/spec/data/card.json +105 -0
- data/spec/data/geo.json +9 -0
- data/spec/data/hyper-schema.json +60 -0
- data/spec/data/interfaces.json +23 -0
- data/spec/data/json-ref.json +26 -0
- data/spec/data/links.json +35 -0
- data/spec/data/person.json +11 -0
- data/spec/data/positive.json +5 -0
- data/spec/data/schema.json +174 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +7 -0
- data/tasks/clobber.rake +2 -0
- data/tasks/gem.rake +72 -0
- data/tasks/git.rake +40 -0
- data/tasks/metrics.rake +22 -0
- data/tasks/rdoc.rake +26 -0
- data/tasks/rubyforge.rake +103 -0
- data/tasks/spec.rake +71 -0
- data/tasks/yard.rake +26 -0
- data/website/index.html +95 -0
- metadata +212 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"description" : "An Address following the convention of http://microformats.org/wiki/hcard",
|
3
|
+
"type" : "object",
|
4
|
+
"properties" : {
|
5
|
+
"post-office-box" : { "type" : "string" },
|
6
|
+
"extended-address" : { "type" : "string" },
|
7
|
+
"street-address" : { "type":"string" },
|
8
|
+
"locality" : { "type" : "string", "required" : true },
|
9
|
+
"region" : { "type" : "string", "required" : true },
|
10
|
+
"postal-code" : { "type" : "string" },
|
11
|
+
"country-name" : { "type" : "string", "required" : true }
|
12
|
+
},
|
13
|
+
"dependencies" : {
|
14
|
+
"post-office-box" : "street-address",
|
15
|
+
"extended-address" : "street-address",
|
16
|
+
"street-address" : "region",
|
17
|
+
"locality" : "region",
|
18
|
+
"region" : "country-name"
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"description" : "A representation of an event",
|
3
|
+
"type" : "object",
|
4
|
+
"properties" : {
|
5
|
+
"dtstart" : {
|
6
|
+
"format" : "date-time",
|
7
|
+
"type" : "string",
|
8
|
+
"description" : "Event starting time",
|
9
|
+
"required":true
|
10
|
+
},
|
11
|
+
"summary" : {
|
12
|
+
"type":"string",
|
13
|
+
"required":true
|
14
|
+
},
|
15
|
+
"location" : {
|
16
|
+
"type" : "string"
|
17
|
+
},
|
18
|
+
"url" : {
|
19
|
+
"type" : "string",
|
20
|
+
"format" : "url"
|
21
|
+
},
|
22
|
+
"dtend" : {
|
23
|
+
"format" : "date-time",
|
24
|
+
"type" : "string",
|
25
|
+
"description" : "Event ending time"
|
26
|
+
},
|
27
|
+
"duration" : {
|
28
|
+
"format" : "date",
|
29
|
+
"type" : "string",
|
30
|
+
"description" : "Event duration"
|
31
|
+
},
|
32
|
+
"rdate" : {
|
33
|
+
"format" : "date-time",
|
34
|
+
"type" : "string",
|
35
|
+
"description" : "Recurrence date"
|
36
|
+
},
|
37
|
+
"rrule" : {
|
38
|
+
"type" : "string",
|
39
|
+
"description" : "Recurrence rule"
|
40
|
+
},
|
41
|
+
"category" : {
|
42
|
+
"type" : "string"
|
43
|
+
},
|
44
|
+
"description" : {
|
45
|
+
"type" : "string"
|
46
|
+
},
|
47
|
+
"geo" : { "$ref" : "geo.json" }
|
48
|
+
}
|
49
|
+
}
|
data/spec/data/card.json
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
{
|
2
|
+
"description":"A representation of a person, company, organization, or place",
|
3
|
+
"type":"object",
|
4
|
+
"properties":{
|
5
|
+
"fn":{
|
6
|
+
"description":"Formatted Name",
|
7
|
+
"type":"string"
|
8
|
+
},
|
9
|
+
"familyName":{
|
10
|
+
"type":"string",
|
11
|
+
"required":true
|
12
|
+
},
|
13
|
+
"givenName":{
|
14
|
+
"type":"string",
|
15
|
+
"required":true
|
16
|
+
},
|
17
|
+
"additionalName":{
|
18
|
+
"type":"array",
|
19
|
+
"items":{
|
20
|
+
"type":"string"
|
21
|
+
}
|
22
|
+
},
|
23
|
+
"honorificPrefix":{
|
24
|
+
"type":"array",
|
25
|
+
"items":{
|
26
|
+
"type":"string"
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"honorificSuffix":{
|
30
|
+
"type":"array",
|
31
|
+
"items":{
|
32
|
+
"type":"string"
|
33
|
+
}
|
34
|
+
},
|
35
|
+
"nickname":{
|
36
|
+
"type":"string"
|
37
|
+
},
|
38
|
+
"url":{
|
39
|
+
"type":"string",
|
40
|
+
"format":"url"
|
41
|
+
},
|
42
|
+
"email":{
|
43
|
+
"type":"object",
|
44
|
+
"properties":{
|
45
|
+
"type":{
|
46
|
+
"type":"string"
|
47
|
+
},
|
48
|
+
"value":{
|
49
|
+
"type":"string",
|
50
|
+
"format":"email"
|
51
|
+
}
|
52
|
+
}
|
53
|
+
},
|
54
|
+
"tel":{
|
55
|
+
"type":"object",
|
56
|
+
"properties":{
|
57
|
+
"type":{
|
58
|
+
"type":"string"
|
59
|
+
},
|
60
|
+
"value":{
|
61
|
+
"type":"string",
|
62
|
+
"format":"phone"
|
63
|
+
}
|
64
|
+
}
|
65
|
+
},
|
66
|
+
"adr":{"$ref" : "address.json"},
|
67
|
+
"geo":{"$ref" : "geo.json"},
|
68
|
+
"tz":{
|
69
|
+
"type":"string"
|
70
|
+
},
|
71
|
+
"photo":{
|
72
|
+
"format":"image",
|
73
|
+
"type":"string"
|
74
|
+
},
|
75
|
+
"logo":{
|
76
|
+
"format":"image",
|
77
|
+
"type":"string"
|
78
|
+
},
|
79
|
+
"sound":{
|
80
|
+
"format":"attachment",
|
81
|
+
"type":"string"
|
82
|
+
},
|
83
|
+
"bday":{
|
84
|
+
"type":"string",
|
85
|
+
"format":"date"
|
86
|
+
},
|
87
|
+
"title":{
|
88
|
+
"type":"string"
|
89
|
+
},
|
90
|
+
"role":{
|
91
|
+
"type":"string"
|
92
|
+
},
|
93
|
+
"org":{
|
94
|
+
"type":"object",
|
95
|
+
"properties":{
|
96
|
+
"organizationName":{
|
97
|
+
"type":"string"
|
98
|
+
},
|
99
|
+
"organizationUnit":{
|
100
|
+
"type":"string"
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
data/spec/data/geo.json
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
{
|
2
|
+
"$schema" : "http://json-schema.org/draft-03/hyper-schema#",
|
3
|
+
"extends" : {"$ref" : "http://json-schema.org/draft-03/schema#"},
|
4
|
+
"id" : "http://json-schema.org/draft-03/hyper-schema#",
|
5
|
+
|
6
|
+
"properties" : {
|
7
|
+
"links" : {
|
8
|
+
"type" : "array",
|
9
|
+
"items" : {"$ref" : "http://json-schema.org/draft-03/links#"}
|
10
|
+
},
|
11
|
+
|
12
|
+
"fragmentResolution" : {
|
13
|
+
"type" : "string",
|
14
|
+
"default" : "slash-delimited"
|
15
|
+
},
|
16
|
+
|
17
|
+
"root" : {
|
18
|
+
"type" : "boolean",
|
19
|
+
"default" : false
|
20
|
+
},
|
21
|
+
|
22
|
+
"readonly" : {
|
23
|
+
"type" : "boolean",
|
24
|
+
"default" : false
|
25
|
+
},
|
26
|
+
|
27
|
+
"contentEncoding" : {
|
28
|
+
"type" : "string"
|
29
|
+
},
|
30
|
+
|
31
|
+
"pathStart" : {
|
32
|
+
"type" : "string",
|
33
|
+
"format" : "uri"
|
34
|
+
},
|
35
|
+
|
36
|
+
"mediaType" : {
|
37
|
+
"type" : "string",
|
38
|
+
"format" : "media-type"
|
39
|
+
}
|
40
|
+
},
|
41
|
+
|
42
|
+
"links" : [
|
43
|
+
{
|
44
|
+
"href" : "{id}",
|
45
|
+
"rel" : "self"
|
46
|
+
},
|
47
|
+
|
48
|
+
{
|
49
|
+
"href" : "{$ref}",
|
50
|
+
"rel" : "full"
|
51
|
+
},
|
52
|
+
|
53
|
+
{
|
54
|
+
"href" : "{$schema}",
|
55
|
+
"rel" : "describedby"
|
56
|
+
}
|
57
|
+
],
|
58
|
+
|
59
|
+
"fragmentResolution" : "slash-delimited"
|
60
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"extends":"http://json-schema.org/hyper-schema",
|
3
|
+
"description":"A schema for schema interface definitions that describe programmatic class structures using JSON schema syntax",
|
4
|
+
"properties":{
|
5
|
+
"methods":{
|
6
|
+
"type":"object",
|
7
|
+
"description":"This defines the set of methods available to the class instances",
|
8
|
+
"additionalProperties":{
|
9
|
+
"type":"object",
|
10
|
+
"description":"The definition of the method",
|
11
|
+
"properties":{
|
12
|
+
"parameters":{
|
13
|
+
"type":"array",
|
14
|
+
"description":"The set of parameters that should be passed to the method when it is called",
|
15
|
+
"items":{"$ref":"#"},
|
16
|
+
"required": true
|
17
|
+
},
|
18
|
+
"returns":{"$ref":"#"}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"$schema" : "http://json-schema.org/draft-03/hyper-schema#",
|
3
|
+
"id" : "http://json-schema.org/draft-03/json-ref#",
|
4
|
+
|
5
|
+
"additionalItems" : {"$ref" : "#"},
|
6
|
+
"additionalProperties" : {"$ref" : "#"},
|
7
|
+
|
8
|
+
"links" : [
|
9
|
+
{
|
10
|
+
"href" : "{id}",
|
11
|
+
"rel" : "self"
|
12
|
+
},
|
13
|
+
|
14
|
+
{
|
15
|
+
"href" : "{$ref}",
|
16
|
+
"rel" : "full"
|
17
|
+
},
|
18
|
+
|
19
|
+
{
|
20
|
+
"href" : "{$schema}",
|
21
|
+
"rel" : "describedby"
|
22
|
+
}
|
23
|
+
],
|
24
|
+
|
25
|
+
"fragmentResolution" : "dot-delimited"
|
26
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"$schema" : "http://json-schema.org/draft-03/hyper-schema#",
|
3
|
+
"id" : "http://json-schema.org/draft-03/links#",
|
4
|
+
"type" : "object",
|
5
|
+
|
6
|
+
"properties" : {
|
7
|
+
"href" : {
|
8
|
+
"type" : "string",
|
9
|
+
"required" : true,
|
10
|
+
"format" : "link-description-object-template"
|
11
|
+
},
|
12
|
+
|
13
|
+
"rel" : {
|
14
|
+
"type" : "string",
|
15
|
+
"required" : true
|
16
|
+
},
|
17
|
+
|
18
|
+
"targetSchema" : {"$ref" : "http://json-schema.org/draft-03/hyper-schema#"},
|
19
|
+
|
20
|
+
"method" : {
|
21
|
+
"type" : "string",
|
22
|
+
"default" : "GET"
|
23
|
+
},
|
24
|
+
|
25
|
+
"enctype" : {
|
26
|
+
"type" : "string",
|
27
|
+
"requires" : "method"
|
28
|
+
},
|
29
|
+
|
30
|
+
"properties" : {
|
31
|
+
"type" : "object",
|
32
|
+
"additionalProperties" : {"$ref" : "http://json-schema.org/draft-03/hyper-schema#"}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,174 @@
|
|
1
|
+
{
|
2
|
+
"$schema" : "http://json-schema.org/draft-03/schema#",
|
3
|
+
"id" : "http://json-schema.org/draft-03/schema#",
|
4
|
+
"type" : "object",
|
5
|
+
|
6
|
+
"properties" : {
|
7
|
+
"type" : {
|
8
|
+
"type" : ["string", "array"],
|
9
|
+
"items" : {
|
10
|
+
"type" : ["string", {"$ref" : "#"}]
|
11
|
+
},
|
12
|
+
"uniqueItems" : true,
|
13
|
+
"default" : "any"
|
14
|
+
},
|
15
|
+
|
16
|
+
"properties" : {
|
17
|
+
"type" : "object",
|
18
|
+
"additionalProperties" : {"$ref" : "#"},
|
19
|
+
"default" : {}
|
20
|
+
},
|
21
|
+
|
22
|
+
"patternProperties" : {
|
23
|
+
"type" : "object",
|
24
|
+
"additionalProperties" : {"$ref" : "#"},
|
25
|
+
"default" : {}
|
26
|
+
},
|
27
|
+
|
28
|
+
"additionalProperties" : {
|
29
|
+
"type" : [{"$ref" : "#"}, "boolean"],
|
30
|
+
"default" : {}
|
31
|
+
},
|
32
|
+
|
33
|
+
"items" : {
|
34
|
+
"type" : [{"$ref" : "#"}, "array"],
|
35
|
+
"items" : {"$ref" : "#"},
|
36
|
+
"default" : {}
|
37
|
+
},
|
38
|
+
|
39
|
+
"additionalItems" : {
|
40
|
+
"type" : [{"$ref" : "#"}, "boolean"],
|
41
|
+
"default" : {}
|
42
|
+
},
|
43
|
+
|
44
|
+
"required" : {
|
45
|
+
"type" : "boolean",
|
46
|
+
"default" : false
|
47
|
+
},
|
48
|
+
|
49
|
+
"dependencies" : {
|
50
|
+
"type" : "object",
|
51
|
+
"additionalProperties" : {
|
52
|
+
"type" : ["string", "array", {"$ref" : "#"}],
|
53
|
+
"items" : {
|
54
|
+
"type" : "string"
|
55
|
+
}
|
56
|
+
},
|
57
|
+
"default" : {}
|
58
|
+
},
|
59
|
+
|
60
|
+
"minimum" : {
|
61
|
+
"type" : "number"
|
62
|
+
},
|
63
|
+
|
64
|
+
"maximum" : {
|
65
|
+
"type" : "number"
|
66
|
+
},
|
67
|
+
|
68
|
+
"exclusiveMinimum" : {
|
69
|
+
"type" : "boolean",
|
70
|
+
"default" : false
|
71
|
+
},
|
72
|
+
|
73
|
+
"exclusiveMaximum" : {
|
74
|
+
"type" : "boolean",
|
75
|
+
"default" : false
|
76
|
+
},
|
77
|
+
|
78
|
+
"minItems" : {
|
79
|
+
"type" : "integer",
|
80
|
+
"minimum" : 0,
|
81
|
+
"default" : 0
|
82
|
+
},
|
83
|
+
|
84
|
+
"maxItems" : {
|
85
|
+
"type" : "integer",
|
86
|
+
"minimum" : 0
|
87
|
+
},
|
88
|
+
|
89
|
+
"uniqueItems" : {
|
90
|
+
"type" : "boolean",
|
91
|
+
"default" : false
|
92
|
+
},
|
93
|
+
|
94
|
+
"pattern" : {
|
95
|
+
"type" : "string",
|
96
|
+
"format" : "regex"
|
97
|
+
},
|
98
|
+
|
99
|
+
"minLength" : {
|
100
|
+
"type" : "integer",
|
101
|
+
"minimum" : 0,
|
102
|
+
"default" : 0
|
103
|
+
},
|
104
|
+
|
105
|
+
"maxLength" : {
|
106
|
+
"type" : "integer"
|
107
|
+
},
|
108
|
+
|
109
|
+
"enum" : {
|
110
|
+
"type" : "array",
|
111
|
+
"minItems" : 1,
|
112
|
+
"uniqueItems" : true
|
113
|
+
},
|
114
|
+
|
115
|
+
"default" : {
|
116
|
+
"type" : "any"
|
117
|
+
},
|
118
|
+
|
119
|
+
"title" : {
|
120
|
+
"type" : "string"
|
121
|
+
},
|
122
|
+
|
123
|
+
"description" : {
|
124
|
+
"type" : "string"
|
125
|
+
},
|
126
|
+
|
127
|
+
"format" : {
|
128
|
+
"type" : "string"
|
129
|
+
},
|
130
|
+
|
131
|
+
"divisibleBy" : {
|
132
|
+
"type" : "number",
|
133
|
+
"minimum" : 0,
|
134
|
+
"exclusiveMinimum" : true,
|
135
|
+
"default" : 1
|
136
|
+
},
|
137
|
+
|
138
|
+
"disallow" : {
|
139
|
+
"type" : ["string", "array"],
|
140
|
+
"items" : {
|
141
|
+
"type" : ["string", {"$ref" : "#"}]
|
142
|
+
},
|
143
|
+
"uniqueItems" : true
|
144
|
+
},
|
145
|
+
|
146
|
+
"extends" : {
|
147
|
+
"type" : [{"$ref" : "#"}, "array"],
|
148
|
+
"items" : {"$ref" : "#"},
|
149
|
+
"default" : {}
|
150
|
+
},
|
151
|
+
|
152
|
+
"id" : {
|
153
|
+
"type" : "string",
|
154
|
+
"format" : "uri"
|
155
|
+
},
|
156
|
+
|
157
|
+
"$ref" : {
|
158
|
+
"type" : "string",
|
159
|
+
"format" : "uri"
|
160
|
+
},
|
161
|
+
|
162
|
+
"$schema" : {
|
163
|
+
"type" : "string",
|
164
|
+
"format" : "uri"
|
165
|
+
}
|
166
|
+
},
|
167
|
+
|
168
|
+
"dependencies" : {
|
169
|
+
"exclusiveMinimum" : "minimum",
|
170
|
+
"exclusiveMaximum" : "maximum"
|
171
|
+
},
|
172
|
+
|
173
|
+
"default" : {}
|
174
|
+
}
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
data/tasks/clobber.rake
ADDED
data/tasks/gem.rake
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'rake/gempackagetask'
|
2
|
+
|
3
|
+
namespace :gem do
|
4
|
+
GEM_SPEC = Gem::Specification.new do |s|
|
5
|
+
unless s.respond_to?(:add_development_dependency)
|
6
|
+
puts 'The gem spec requires a newer version of RubyGems.'
|
7
|
+
exit(1)
|
8
|
+
end
|
9
|
+
|
10
|
+
s.name = PKG_NAME
|
11
|
+
s.version = PKG_VERSION
|
12
|
+
s.author = PKG_AUTHOR
|
13
|
+
s.email = PKG_AUTHOR_EMAIL
|
14
|
+
s.homepage = PKG_HOMEPAGE
|
15
|
+
s.summary = PKG_SUMMARY
|
16
|
+
s.description = PKG_DESCRIPTION
|
17
|
+
s.rubyforge_project = RUBY_FORGE_PROJECT
|
18
|
+
|
19
|
+
s.files = PKG_FILES.to_a
|
20
|
+
|
21
|
+
s.has_rdoc = true
|
22
|
+
s.extra_rdoc_files = %w( README.md )
|
23
|
+
s.rdoc_options.concat ['--main', 'README.md']
|
24
|
+
|
25
|
+
s.add_runtime_dependency('addressable', '~> 2.2.2')
|
26
|
+
s.add_runtime_dependency('json', '>= 1.4.6')
|
27
|
+
s.add_runtime_dependency('extlib', '>= 0.9.15')
|
28
|
+
|
29
|
+
s.add_development_dependency('rake', '~> 0.8.3')
|
30
|
+
s.add_development_dependency('rspec', '~> 2.6.0')
|
31
|
+
s.add_development_dependency('launchy', '~> 0.3.2')
|
32
|
+
s.add_development_dependency('diff-lcs', '~> 1.1.2')
|
33
|
+
|
34
|
+
s.require_path = 'lib'
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::GemPackageTask.new(GEM_SPEC) do |p|
|
38
|
+
p.gem_spec = GEM_SPEC
|
39
|
+
p.need_tar = true
|
40
|
+
p.need_zip = true
|
41
|
+
end
|
42
|
+
|
43
|
+
desc 'Show information about the gem'
|
44
|
+
task :debug do
|
45
|
+
puts GEM_SPEC.to_ruby
|
46
|
+
end
|
47
|
+
|
48
|
+
desc 'Install the gem'
|
49
|
+
task :install => ['clobber', 'gem:package'] do
|
50
|
+
sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
|
51
|
+
end
|
52
|
+
|
53
|
+
desc 'Uninstall the gem'
|
54
|
+
task :uninstall do
|
55
|
+
installed_list = Gem.source_index.find_name(PKG_NAME)
|
56
|
+
if installed_list &&
|
57
|
+
(installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION))
|
58
|
+
sh(
|
59
|
+
"#{SUDO} gem uninstall --version '#{PKG_VERSION}' " +
|
60
|
+
"--ignore-dependencies --executables #{PKG_NAME}"
|
61
|
+
)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
desc 'Reinstall the gem'
|
66
|
+
task :reinstall => [:uninstall, :install]
|
67
|
+
end
|
68
|
+
|
69
|
+
desc 'Alias to gem:package'
|
70
|
+
task 'gem' => 'gem:package'
|
71
|
+
|
72
|
+
task 'clobber' => ['gem:clobber_package']
|
data/tasks/git.rake
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
namespace :git do
|
2
|
+
namespace :tag do
|
3
|
+
desc 'List tags from the Git repository'
|
4
|
+
task :list do
|
5
|
+
tags = `git tag -l`
|
6
|
+
tags.gsub!("\r", '')
|
7
|
+
tags = tags.split("\n").sort {|a, b| b <=> a }
|
8
|
+
puts tags.join("\n")
|
9
|
+
end
|
10
|
+
|
11
|
+
desc 'Create a new tag in the Git repository'
|
12
|
+
task :create do
|
13
|
+
changelog = File.open('CHANGELOG', 'r') { |file| file.read }
|
14
|
+
puts '-' * 80
|
15
|
+
puts changelog
|
16
|
+
puts '-' * 80
|
17
|
+
puts
|
18
|
+
|
19
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
20
|
+
abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION
|
21
|
+
|
22
|
+
tag = "#{PKG_NAME}-#{PKG_VERSION}"
|
23
|
+
msg = "Release #{PKG_NAME}-#{PKG_VERSION}"
|
24
|
+
|
25
|
+
existing_tags = `git tag -l #{PKG_NAME}-*`.split("\n")
|
26
|
+
if existing_tags.include?(tag)
|
27
|
+
warn('Tag already exists, deleting...')
|
28
|
+
unless system "git tag -d #{tag}"
|
29
|
+
abort 'Tag deletion failed.'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
puts "Creating git tag '#{tag}'..."
|
33
|
+
unless system "git tag -a -m \"#{msg}\" #{tag}"
|
34
|
+
abort 'Tag creation failed.'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
task 'gem:release' => 'git:tag:create'
|