maestro-plugin-rake-tasks 1.0.2 → 1.0.3
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/Gemfile.lock
CHANGED
@@ -95,11 +95,8 @@ module Maestro
|
|
95
95
|
abort "ERROR: Plugin name is missing" unless @plugin_name
|
96
96
|
abort "ERROR: Plugin version is missing" unless @version
|
97
97
|
|
98
|
-
# Add the commit hash to the version if it's available
|
99
|
-
git_version! if File.exists?('.git')
|
100
|
-
|
101
98
|
# If we use a template, use it to create the manifest
|
102
|
-
update_manifest
|
99
|
+
update_manifest(git_version)
|
103
100
|
|
104
101
|
# Create the zip file
|
105
102
|
create_zip_file("#{@plugin_name}-#{@version}.zip")
|
@@ -116,25 +113,27 @@ module Maestro
|
|
116
113
|
@version ||= doc.at_xpath('/xmlns:project/xmlns:version').text
|
117
114
|
end
|
118
115
|
|
119
|
-
def git_version
|
116
|
+
def git_version
|
120
117
|
git = Git.open('.')
|
121
118
|
# check if there are modified files
|
122
119
|
if git.status.select { |s| s.type == 'M' }.empty?
|
123
120
|
commit = git.log.first.sha[0..5]
|
124
|
-
|
121
|
+
"#{@version}-#{commit}"
|
125
122
|
else
|
126
123
|
warn "WARNING: There are modified files, not using commit hash in version"
|
124
|
+
@version
|
127
125
|
end
|
128
|
-
@version
|
129
126
|
end
|
130
127
|
|
131
128
|
# update the version number in the manifest file.
|
132
|
-
def update_manifest
|
129
|
+
def update_manifest(manifest_version)
|
130
|
+
return @version unless File.exists?('.git')
|
131
|
+
|
133
132
|
manifest = JSON.parse(IO.read(@manifest_template_path))
|
134
133
|
if manifest.instance_of? Array
|
135
|
-
manifest.each { |m| m['version'] =
|
134
|
+
manifest.each { |m| m['version'] = manifest_version }
|
136
135
|
else
|
137
|
-
manifest['version'] =
|
136
|
+
manifest['version'] = manifest_version
|
138
137
|
end
|
139
138
|
|
140
139
|
File.open('manifest.json','w'){ |f| f.write(JSON.pretty_generate(manifest)) }
|
@@ -65,7 +65,7 @@ describe Maestro::Plugin::RakeTasks::PackageTask do
|
|
65
65
|
manifest_path = File.dirname(__FILE__) + '/../../../../manifest.json'
|
66
66
|
File.exists?(manifest_path).should be_true
|
67
67
|
manifest = JSON.parse(IO.read(manifest_path))
|
68
|
-
manifest.first['version'].should
|
68
|
+
manifest.first['version'].should start_with 'X.Y.Z'
|
69
69
|
|
70
70
|
end
|
71
71
|
|
@@ -78,7 +78,7 @@ describe Maestro::Plugin::RakeTasks::PackageTask do
|
|
78
78
|
manifest_path = File.dirname(__FILE__) + '/../../../../manifest.json'
|
79
79
|
File.exists?(manifest_path).should be_true
|
80
80
|
manifest = JSON.parse(IO.read(manifest_path))
|
81
|
-
manifest['version'].should
|
81
|
+
manifest['version'].should start_with 'X.Y.Z'
|
82
82
|
|
83
83
|
end
|
84
84
|
|