mercure 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mercure.rb +8 -0
- data/lib/mercure/changelog.rb +39 -0
- data/lib/mercure/changelog.sh +42 -0
- data/lib/mercure/deploy.rb +4 -2
- data/lib/mercure/git.rb +0 -1
- data/lib/mercure/parse.rb +1 -0
- data/lib/mercure/paths.rb +47 -0
- data/lib/mercure/upload.rb +18 -60
- data/lib/mercure/version.rb +1 -1
- data/mercure.gemspec +6 -2
- data/spec/mercure_helper.rb +17 -0
- data/spec/spec_helper.rb +11 -0
- metadata +50 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00bfb25b6832250ab5a1b8f5233574fca200e404
|
4
|
+
data.tar.gz: 4ad55e297ff2e568be4eb87dd9bc59ef99ead58b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e39deac709acdef5e439f112c00743c3a5738b285f1bd8c529906a1f81c645a5de2792db34eca2b2017d8d8915ef6910548d11d650542991c0b348aebe0a5d76
|
7
|
+
data.tar.gz: 222b0999d810280d963eba4766e8f2c875b9dd6756a4ec616e73db80ff3a702c446a445502981ff0989874f100d837d27fbded06f3b15f137a54b3adcc01634e
|
data/lib/mercure.rb
CHANGED
@@ -3,6 +3,7 @@ require 'thor'
|
|
3
3
|
require 'plist'
|
4
4
|
|
5
5
|
require 'mercure/deploy'
|
6
|
+
require 'mercure/changelog'
|
6
7
|
|
7
8
|
module Mercure
|
8
9
|
|
@@ -58,6 +59,13 @@ module Mercure
|
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
62
|
+
desc "changelog JOB", "will build, upload and deploy the job"
|
63
|
+
option :p, :type => :boolean
|
64
|
+
option :pinailleur, :type => :boolean
|
65
|
+
def changelog(plist)
|
66
|
+
generateChangelogs plist
|
67
|
+
end
|
68
|
+
|
61
69
|
end
|
62
70
|
|
63
71
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'plist'
|
5
|
+
require 'parse-ruby-client'
|
6
|
+
require 'cfpropertylist'
|
7
|
+
|
8
|
+
require_relative 'paths.rb'
|
9
|
+
|
10
|
+
def generateChangelogs (plist_path)
|
11
|
+
|
12
|
+
plist_content = CFPropertyList::List.new(file: plist_path)
|
13
|
+
deployments = CFPropertyList.native_types(plist_content.value)
|
14
|
+
|
15
|
+
deployments.each do |deploy|
|
16
|
+
|
17
|
+
generateChangelog deploy
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def generateChangelog (deploy)
|
25
|
+
|
26
|
+
settings = load_settings deploy
|
27
|
+
changelogPath = changelogPath(settings)
|
28
|
+
previousTag = settings[:deploy]["build"]["previousGitTag"]
|
29
|
+
currentTag = settings[:deploy]["build"]["currentGitTag"]
|
30
|
+
|
31
|
+
name = 'mercure'
|
32
|
+
g = Gem::Specification.find_by_name( name )
|
33
|
+
script_path = File.join( g.full_gem_path, 'lib/mercure/changelog.sh' )
|
34
|
+
|
35
|
+
puts "#{script_path} #{previousTag} #{currentTag} #{changelogPath}"
|
36
|
+
|
37
|
+
system("#{script_path} #{previousTag} #{currentTag} #{changelogPath}")
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env zsh
|
2
|
+
|
3
|
+
output="$3.markdown"
|
4
|
+
html_output="$3"
|
5
|
+
css_stylesheet="/tmp/mercure_changelog.css"
|
6
|
+
gitlab_url="http://mobigitlab.pj.fr"
|
7
|
+
|
8
|
+
pretty_format="| [%cr]($gitlab_url/commits/%h) | [%an]($gitlab_url/u/%cn) | %s |"
|
9
|
+
pretty_format="| %cr | %an | (%h) | %s |"
|
10
|
+
|
11
|
+
echo '<style type="text/css">' > $css_stylesheet
|
12
|
+
echo 'body { line-height: 1.6em; color:#333333; font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; }' >> $css_stylesheet
|
13
|
+
echo 'table { font-size: 12px; margin: 45px; text-align: left; border-collapse: collapse; }' >> $css_stylesheet
|
14
|
+
echo 'table th { font-size: 14px; font-weight: normal; padding: 10px 8px; color: #039; }' >> $css_stylesheet
|
15
|
+
echo 'table td { padding: 8px; color: #669; }' >> $css_stylesheet
|
16
|
+
echo 'table .odd { background: #e8edff; }' >> $css_stylesheet
|
17
|
+
echo '</style>' >> $css_stylesheet
|
18
|
+
|
19
|
+
|
20
|
+
echo "# Changelog from $1 to $2" > $output
|
21
|
+
echo "" >> $output
|
22
|
+
|
23
|
+
echo "## Dev" >> $output
|
24
|
+
echo "" >> $output
|
25
|
+
echo "|---|---|---|---|" >> $output
|
26
|
+
git log --pretty=format:$pretty_format --abbrev-commit --date=relative $1..$2 | grep -i -v -e "mantis" -e "fix" -e "merge" -e "pod" | sed 's/Dev/dev/' >> $output
|
27
|
+
|
28
|
+
echo "" >> $output
|
29
|
+
|
30
|
+
echo "## Mantis" >> $output
|
31
|
+
echo "" >> $output
|
32
|
+
echo "|---|---|---|---|" >> $output
|
33
|
+
git log --pretty=format:$pretty_format --abbrev-commit --date=relative $1..$2 | grep -i "mantis" | grep -v -i -e "merge" >> $output
|
34
|
+
echo "" >> $output
|
35
|
+
|
36
|
+
echo "## Pods" >> $output
|
37
|
+
echo "" >> $output
|
38
|
+
echo "|---|---|---|---|" >> $output
|
39
|
+
git log --pretty=format:$pretty_format --abbrev-commit --date=relative $1..$2 | grep -i "pod" | grep -v -i -e "merge" >> $output
|
40
|
+
echo "" >> $output
|
41
|
+
|
42
|
+
pandoc -H $css_stylesheet -s $output -o $html_output
|
data/lib/mercure/deploy.rb
CHANGED
@@ -15,6 +15,7 @@ require_relative 'parse.rb'
|
|
15
15
|
require_relative 'paths.rb'
|
16
16
|
require_relative 'git.rb'
|
17
17
|
require_relative 'upload.rb'
|
18
|
+
require_relative 'changelog.rb'
|
18
19
|
|
19
20
|
#
|
20
21
|
# Build
|
@@ -224,8 +225,9 @@ end
|
|
224
225
|
|
225
226
|
|
226
227
|
def buildArtefacts (xcode_settings)
|
227
|
-
generateIpa
|
228
|
-
generatePlist
|
228
|
+
generateIpa xcode_settings
|
229
|
+
generatePlist xcode_settings
|
230
|
+
generateChangelog xcode_settings
|
229
231
|
end
|
230
232
|
|
231
233
|
# def unlock_keychain
|
data/lib/mercure/git.rb
CHANGED
data/lib/mercure/parse.rb
CHANGED
@@ -29,6 +29,7 @@ def updateParse (settings)
|
|
29
29
|
appVersion["versionChangeLog"] = parseInfos["versionChangeLog"]
|
30
30
|
appVersion["versionLevel"] = parseInfos["versionLevel"].to_i
|
31
31
|
appVersion["versionUrl"] = publicPlistURL settings
|
32
|
+
appVersion["changelogUrl"] = publicChangelogURL settings
|
32
33
|
|
33
34
|
result = appVersion.save
|
34
35
|
|
data/lib/mercure/paths.rb
CHANGED
@@ -155,6 +155,53 @@ def remoteDsymPath (settings , destination)
|
|
155
155
|
|
156
156
|
end
|
157
157
|
|
158
|
+
#
|
159
|
+
# IPA
|
160
|
+
#
|
161
|
+
|
162
|
+
def changelogName (settings)
|
163
|
+
|
164
|
+
buildDirectory = settings[:buildDirectory]
|
165
|
+
buildConfiguration = settings[:buildConfiguration]
|
166
|
+
buildNumber = settings[:buildNumber]
|
167
|
+
applicationName = settings[:applicationName]
|
168
|
+
|
169
|
+
pjServerConf = settings[:deploy]["infosPlist"]["PJServerConf"]
|
170
|
+
|
171
|
+
"changelog.#{applicationName}.#{buildNumber}.html"
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
def changelogPath (settings)
|
176
|
+
|
177
|
+
buildDirectory = settings[:buildDirectory]
|
178
|
+
buildConfiguration = settings[:buildConfiguration]
|
179
|
+
buildNumber = settings[:buildNumber]
|
180
|
+
applicationName = settings[:applicationName]
|
181
|
+
changelogName = changelogName(settings)
|
182
|
+
|
183
|
+
"#{buildDirectory}/#{buildConfiguration}-iphoneos/#{changelogName}"
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
def remoteChangelogPath (settings , destination)
|
188
|
+
|
189
|
+
changelogName = changelogName(settings)
|
190
|
+
remotePath = destination["path"]
|
191
|
+
|
192
|
+
"#{remotePath}/#{changelogName}"
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
def publicChangelogURL (settings)
|
197
|
+
|
198
|
+
publicURL = settings[:deploy]["uploadServer"]["plist"][0]["publicURL"]
|
199
|
+
changelogName = changelogName (settings)
|
200
|
+
|
201
|
+
"#{publicURL}/#{changelogName}"
|
202
|
+
|
203
|
+
end
|
204
|
+
|
158
205
|
#
|
159
206
|
# Extra
|
160
207
|
#
|
data/lib/mercure/upload.rb
CHANGED
@@ -12,11 +12,9 @@ require_relative 'paths.rb'
|
|
12
12
|
|
13
13
|
def uploadArtefacts(settings)
|
14
14
|
|
15
|
-
uploadPlist
|
16
|
-
uploadIPA
|
17
|
-
|
18
|
-
# legacy, shouldn't be needed when the old DTAppStore will no more be used.
|
19
|
-
updateDTMobXML settings
|
15
|
+
uploadPlist settings
|
16
|
+
uploadIPA settings
|
17
|
+
uploadChangelog settings
|
20
18
|
|
21
19
|
end
|
22
20
|
|
@@ -73,6 +71,21 @@ def uploadPlist(settings)
|
|
73
71
|
|
74
72
|
end
|
75
73
|
|
74
|
+
def uploadChangelog(settings)
|
75
|
+
|
76
|
+
settings[:deploy]["uploadServer"]["plist"].each do |destination|
|
77
|
+
|
78
|
+
changelogPath = changelogPath (settings)
|
79
|
+
remoteChangelogPath = remoteChangelogPath (settings , destination)
|
80
|
+
|
81
|
+
files_to_upload = [[changelogPath , remoteChangelogPath]]
|
82
|
+
|
83
|
+
uploadFiles(settings , destination , files_to_upload)
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
76
89
|
# files_to_upload is an array of arrays
|
77
90
|
# that must be like [local_file_path , remote_file_path]
|
78
91
|
def uploadViaSSH(host , login , path, files_to_upload)
|
@@ -161,58 +174,3 @@ def uploadViaFTP(host, usermame , password , path, files_to_upload)
|
|
161
174
|
|
162
175
|
end
|
163
176
|
|
164
|
-
|
165
|
-
def updateDTMobXML (settings)
|
166
|
-
|
167
|
-
# après upload des artefacts, on peut mettre à jour le fichier dtmob.xml
|
168
|
-
# et pourquoi pas dsem.xml
|
169
|
-
|
170
|
-
puts "Pas de mise à jour du dtmob.xml pour le moment"
|
171
|
-
|
172
|
-
return
|
173
|
-
|
174
|
-
host = settings[:deploy]["uploadServer"]["ipa"][0]["host"]
|
175
|
-
login = settings[:deploy]["uploadServer"]["ipa"][0]["login"]
|
176
|
-
path = settings[:deploy]["uploadServer"]["ipa"][0]["path"]
|
177
|
-
buildNumber = settings[:buildNumber]
|
178
|
-
|
179
|
-
dtmobApplicationName = settings[:deploy]["uploadServer"]["ipa"][0]["applicationTitle"]
|
180
|
-
dtmobApplicationVersion = settings[:deploy]["uploadServer"]["ipa"][0]["applicationVersion"]
|
181
|
-
|
182
|
-
Net::SCP.start(host, login) do |scp|
|
183
|
-
puts 'Mise-à-jour du fichier dtmob.xml'
|
184
|
-
scp.download!(remoteDTMobFile, localDTMobFile)
|
185
|
-
|
186
|
-
file = File.read(localDTMobFile)
|
187
|
-
dtmob = Nokogiri::XML(file)
|
188
|
-
|
189
|
-
timeFormat = "%Y-%m-%d %H-%M-%S"
|
190
|
-
lastUpdate = DateTime.now.strftime(timeFormat)
|
191
|
-
applicationXPath = "//application[title='#{dtmobApplicationName}']"
|
192
|
-
versionXPath = "version[numero='#{dtmobApplicationVersion}']"
|
193
|
-
changeLogXPath = "changelog"
|
194
|
-
changeLogContent = <<-EOXML
|
195
|
-
<![CDATA[
|
196
|
-
<ul>
|
197
|
-
<li>Last update: #{lastUpdate}</li>
|
198
|
-
<li>Build number: #{buildNumber}</li>
|
199
|
-
</ul>]]>
|
200
|
-
EOXML
|
201
|
-
|
202
|
-
application = dtmob.xpath(applicationXPath)
|
203
|
-
version = application.xpath(versionXPath)
|
204
|
-
|
205
|
-
changeLog = version.xpath(changeLogXPath).first
|
206
|
-
changeLog.inner_html = changeLogContent
|
207
|
-
|
208
|
-
# save the output into a new file
|
209
|
-
File.open(localDTMobFile, "w") do |f|
|
210
|
-
f.write dtmob.to_xml
|
211
|
-
end
|
212
|
-
|
213
|
-
|
214
|
-
scp.upload(localDTMobFile , remoteDTMobFile)
|
215
|
-
end
|
216
|
-
|
217
|
-
end
|
218
|
-
|
data/lib/mercure/version.rb
CHANGED
data/mercure.gemspec
CHANGED
@@ -21,8 +21,12 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
23
|
spec.require_paths = ["lib"]
|
24
|
-
|
25
|
-
spec.
|
24
|
+
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'rspec-mocks'
|
27
|
+
spec.add_development_dependency 'simplecov'
|
28
|
+
|
29
|
+
spec.add_runtime_dependency 'bundler'
|
26
30
|
spec.add_runtime_dependency "rake"
|
27
31
|
spec.add_runtime_dependency 'thor'
|
28
32
|
spec.add_runtime_dependency 'plist'
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mercure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Meuel
|
@@ -10,6 +10,48 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-mocks
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simplecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
13
55
|
- !ruby/object:Gem::Dependency
|
14
56
|
name: bundler
|
15
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,6 +193,8 @@ files:
|
|
151
193
|
- bin/mercure
|
152
194
|
- lib/mercure.rb
|
153
195
|
- lib/mercure/build.rb
|
196
|
+
- lib/mercure/changelog.rb
|
197
|
+
- lib/mercure/changelog.sh
|
154
198
|
- lib/mercure/deploy.rb
|
155
199
|
- lib/mercure/git.rb
|
156
200
|
- lib/mercure/ipa.rb
|
@@ -162,6 +206,8 @@ files:
|
|
162
206
|
- lib/mercure/upload.rb
|
163
207
|
- lib/mercure/version.rb
|
164
208
|
- mercure.gemspec
|
209
|
+
- spec/mercure_helper.rb
|
210
|
+
- spec/spec_helper.rb
|
165
211
|
homepage: https://github.com/teriiehina/mercure
|
166
212
|
licenses:
|
167
213
|
- MIT
|
@@ -186,4 +232,6 @@ rubygems_version: 2.4.4
|
|
186
232
|
signing_key:
|
187
233
|
specification_version: 4
|
188
234
|
summary: Build and distribute iOS app
|
189
|
-
test_files:
|
235
|
+
test_files:
|
236
|
+
- spec/mercure_helper.rb
|
237
|
+
- spec/spec_helper.rb
|