rialto 0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 89f076f0ffee03ddac3b305b82c2003575354d06
4
+ data.tar.gz: 0e8b3c9fd051af49e4b75dfbb4541e230ad0b635
5
+ SHA512:
6
+ metadata.gz: bad37f9d65fec51be19e15848d4762f4ee422c30e16af262fad42eb9f032d82cc2d202fb2524ec919ee63860b1ed9c12c16abeeb416be0c7646d37b453c71af6
7
+ data.tar.gz: b98078d92057010c3dcf538bcef011bb82e470ddad746a99d61696026d908e40eb6c42f38394d5aecb0e294cebf478cbf727ab3a7caddf941010d78a2840307f
data/.DS_Store ADDED
Binary file
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 dashcash
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ Rialto
2
+ ====================
3
+
4
+ A gem that helps shipping Android applications
5
+
6
+ It is composed of three main features:
7
+
8
+ 1/ Binary build (coming soon)
9
+
10
+ 2/ Parse MBaaS related (really specfic one - can not be used as it is)
11
+ - Database update
12
+ - Notification system
13
+ - Binary files to server upload
14
+
15
+ 3/ Play store related (coming soon)
16
+ - Metadata upload
17
+ - Binary upload
data/bin/rialto ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require "rialto"
5
+ rescue LoadError
6
+ require "rubygems"
7
+ require "rialto"
8
+ end
data/lib/rialto.rb ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ require "rialto/main"
3
+
4
+ case ARGV[0]
5
+
6
+ #when "build"
7
+
8
+ when "parseUpdate"
9
+
10
+ if (ARGV.length == 2)
11
+ version = Rialto::Version.new()
12
+ version.parseUpdate(ARGV[1])
13
+ else
14
+ puts "Usage: rialto parseUpdate [versionFilepath]"
15
+ end
16
+
17
+ #when "deploy"
18
+
19
+ when "parseNotify"
20
+
21
+ if (ARGV.length == 2)
22
+ version = Rialto::Version.new()
23
+ version.parseNotify(ARGV[1])
24
+ else
25
+ puts "Usage: rialto parseNotify [notificationFilepath]"
26
+ end
27
+
28
+ else
29
+ puts "Usage: build | storeDeploy | playStoreDeploy | parseUpdate | parseNotify"
30
+ end
Binary file
@@ -0,0 +1,222 @@
1
+ #!/usr/bin/env ruby
2
+ require 'parse-ruby-client'
3
+ require 'nokogiri'
4
+
5
+ module Rialto
6
+
7
+ # An application
8
+
9
+ class Application
10
+ end
11
+
12
+ # A version of an application
13
+
14
+ class Version
15
+
16
+ # Constants
17
+
18
+ # Parse DB related
19
+
20
+ APPLICATION_CLASSNAME = "Application"
21
+ APPLICATION_VERSION_CLASSNAME = "ApplicationVersion"
22
+
23
+ APPLICATION_ID_PROPERTYNAME = "applicationId"
24
+ APPLICATION_TITLE_PROPERTYNAME = "applicationTitle"
25
+
26
+ APPLICATION_VERSIONNUMBER_PROPERTYNAME = "versionNumber"
27
+ APPLICATION_VERSIONCODE_PROPERTYNAME = "versionCode"
28
+ APPLICATION_VERSIONCHANGELOG_PROPERTYNAME = "versionChangeLog"
29
+ APPLICATION_VERSIONURL_PROPERTYNAME = "versionURL"
30
+ APPLICATION_VERSIONLEVEL_PROPERTYNAME = "versionLevel"
31
+
32
+ APPLICATION_TYPE = "android"
33
+
34
+ # Attributes
35
+ attr_reader :parseId, :parseKey, :appId, :versionLog, :versionNumber, :versionCode, :versionLevel, :versionUrl
36
+
37
+ # Methods
38
+
39
+ def initialize()
40
+ end
41
+
42
+ def initVersion(file)
43
+
44
+ f = File.open(file)
45
+ doc = Nokogiri::XML(f)
46
+ f.close
47
+
48
+ version = doc.xpath("//version/item").map do |i|
49
+ {"key" => i.xpath("key"), "value" => i.xpath("value")}
50
+ end
51
+
52
+ version.each { |item|
53
+
54
+ key = item["key"][0].content
55
+ value = item["value"][0].content
56
+
57
+ case key
58
+ when "parseId"
59
+ @parseId = value
60
+ when "apiKey"
61
+ @parseKey = value
62
+ when "appId"
63
+ @appId = value
64
+ when "versionCode"
65
+ @versionCode = value
66
+ when "versionLog"
67
+ @versionLog = value
68
+ when "versionNumber"
69
+ @versionNumber = value
70
+ when "versionLevel"
71
+ @versionLevel = value
72
+ when "versionUrl"
73
+ @versionUrl = value
74
+ end
75
+ }
76
+
77
+ end
78
+
79
+ def initParse(id, key)
80
+ Parse.init :application_id => id,
81
+ :api_key => key
82
+ end
83
+
84
+ def build
85
+ puts "build: coming soon"
86
+ end
87
+
88
+ def deploy
89
+ puts "deploy: coming soon"
90
+ end
91
+
92
+ def parseUpdate(file)
93
+
94
+ initVersion(file)
95
+ initParse(@parseId, @parseKey)
96
+
97
+ parseApplication = Parse.get APPLICATION_CLASSNAME, @appId
98
+
99
+ if parseApplication != nil
100
+ puts parseApplication[APPLICATION_TITLE_PROPERTYNAME] + " loaded from Parse.com"
101
+ else
102
+ puts "No Application with id #{appId} found"
103
+ exit -1
104
+ end
105
+
106
+ parseAppVersion = Parse::Query.new(APPLICATION_VERSION_CLASSNAME)
107
+ .eq(APPLICATION_ID_PROPERTYNAME, parseApplication.pointer)
108
+ .eq(APPLICATION_VERSIONNUMBER_PROPERTYNAME, @versionNumber)
109
+ .get
110
+
111
+ if (parseAppVersion != nil && parseAppVersion.length > 0)
112
+ puts "Versions found: #{parseAppVersion.length}"
113
+ puts "Updating existing ApplicationVersion"
114
+
115
+ version = parseAppVersion[0]
116
+
117
+ version[APPLICATION_VERSIONURL_PROPERTYNAME] = @versionUrl
118
+ version[APPLICATION_VERSIONCHANGELOG_PROPERTYNAME] = @versionLog
119
+ version[APPLICATION_VERSIONCODE_PROPERTYNAME] = @versionCode.to_i
120
+
121
+ version.save
122
+
123
+ puts "Application updated"
124
+
125
+ else
126
+ puts "No version found. Creating it."
127
+
128
+ newVersion = Parse::Object.new(APPLICATION_VERSION_CLASSNAME)
129
+
130
+ newVersion[APPLICATION_ID_PROPERTYNAME] = parseApplication.pointer
131
+ newVersion[APPLICATION_VERSIONCODE_PROPERTYNAME] = @versionCode.to_i
132
+ newVersion[APPLICATION_VERSIONNUMBER_PROPERTYNAME] = @versionNumber
133
+ newVersion[APPLICATION_VERSIONCHANGELOG_PROPERTYNAME] = @versionLog
134
+ newVersion[APPLICATION_VERSIONURL_PROPERTYNAME] = @versionUrl
135
+ newVersion[APPLICATION_VERSIONLEVEL_PROPERTYNAME] = @versionLevel
136
+
137
+ newVersion.save
138
+
139
+ puts "Application created"
140
+
141
+ end
142
+
143
+ end
144
+
145
+ def parseNotify(file)
146
+
147
+ f = File.open(file)
148
+ doc = Nokogiri::XML(f)
149
+ f.close
150
+
151
+ notification = doc.xpath("//notification/item").map do |i|
152
+ {"key" => i.xpath("key"), "value" => i.xpath("value")}
153
+ end
154
+
155
+ title = ""
156
+ message = ""
157
+ action = ""
158
+ channel = ""
159
+
160
+ notification.each { |item|
161
+
162
+ key = item["key"][0].content
163
+ value = item["value"][0].content
164
+
165
+ case key
166
+ when "parseId"
167
+ @parseId = value
168
+ when "apiKey"
169
+ @parseKey = value
170
+ when "appId"
171
+ @appId = value
172
+ when "versionCode"
173
+ @versionCode = value
174
+ when "title"
175
+ title = value
176
+ when "message"
177
+ message = value
178
+ when "action"
179
+ action = value
180
+ when "channel"
181
+ channel = value
182
+ end
183
+ }
184
+
185
+ initParse(@parseId, @parseKey)
186
+
187
+ parseApplication = Parse.get APPLICATION_CLASSNAME, @appId
188
+
189
+ if parseApplication != nil
190
+ puts parseApplication[APPLICATION_TITLE_PROPERTYNAME] + " found in Parse.com"
191
+ else
192
+ puts "No Application with id #{appId} found"
193
+ exit -1
194
+ end
195
+
196
+ # Default value for title
197
+ if (title.length == 0)
198
+ puts "Title is set to default: Application name & version"
199
+ finTitle = "#{parseApplication[APPLICATION_TITLE_PROPERTYNAME]} - #{versionNumber}"
200
+ else
201
+ puts "Title is set to: #{title}"
202
+ finTitle = title
203
+ end
204
+
205
+ push = Parse::Push.new(
206
+ {
207
+ "title" => finTitle,
208
+ "alert" => message,
209
+ "action" => action,
210
+ "parseAppID" => @appId,
211
+ "newVersionCode" => @versionCode
212
+ }, channel)
213
+
214
+ push.type = APPLICATION_TYPE
215
+ push.save
216
+
217
+
218
+ end
219
+
220
+ end
221
+
222
+ end
@@ -0,0 +1,3 @@
1
+ module Rialto
2
+ VERSION = "0.0.3"
3
+ end
data/rialto.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "rialto/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'rialto'
7
+ s.version = Rialto::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+
10
+ s.date = '2015-03-09'
11
+
12
+ s.summary = "Gem that manages Android apps shipping"
13
+ s.description = "The gem builds, manages metadata, ships & notifies users"
14
+
15
+ s.authors = ["htquach"]
16
+ s.email = 'ht@quach.com'
17
+
18
+ s.files = ["lib/main.rb"]
19
+
20
+ s.homepage = 'http://github.com/dashcash/rialto'
21
+ s.license = 'MIT'
22
+
23
+ s.files = `git ls-files`.split("\n")
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
+ s.require_paths = ["lib"]
27
+
28
+ end
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rialto
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - htquach
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-09 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: The gem builds, manages metadata, ships & notifies users
14
+ email: ht@quach.com
15
+ executables:
16
+ - rialto
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".DS_Store"
21
+ - LICENSE
22
+ - README.md
23
+ - bin/rialto
24
+ - lib/rialto.rb
25
+ - lib/rialto/.DS_Store
26
+ - lib/rialto/main.rb
27
+ - lib/rialto/version.rb
28
+ - rialto.gemspec
29
+ homepage: http://github.com/dashcash/rialto
30
+ licenses:
31
+ - MIT
32
+ metadata: {}
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubyforge_project:
49
+ rubygems_version: 2.2.2
50
+ signing_key:
51
+ specification_version: 4
52
+ summary: Gem that manages Android apps shipping
53
+ test_files: []