capkin 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/capkin.gemspec +1 -0
- data/lib/capkin.rb +1 -0
- data/lib/capkin/cli.rb +10 -2
- data/lib/capkin/robot.rb +46 -6
- data/lib/capkin/version.rb +2 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3f1e5b9f964f0ec5930d4d0e56bff97e3246046
|
4
|
+
data.tar.gz: e47ecad436d9f7cc7db493012e6a1582ae6fd937
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d435acdc8eeb8cb52656d94c19c5d9b9f07934aff31fdfe2eb804089be34f56001a85ac3fa5c2456ee7dfab8a5f0ef7733c379c53d15edc8dfca7f17a0ef7dc
|
7
|
+
data.tar.gz: b68473a84285b8b9dfb25f83e002454408efc6475d4edaad0a420472a8b0c461abb13889256f32fb6c3b0c34cdc48688e344faf642e06cb6bc2732f036673436
|
data/README.md
CHANGED
data/capkin.gemspec
CHANGED
data/lib/capkin.rb
CHANGED
data/lib/capkin/cli.rb
CHANGED
@@ -16,14 +16,22 @@ module Capkin
|
|
16
16
|
|
17
17
|
def read_file
|
18
18
|
@config = YAML.load_file('Capkin')
|
19
|
-
msg = "✓ Config file OK! '#{@config['app']}'
|
19
|
+
msg = "✓ Config file OK! '#{@config['app']}'"
|
20
20
|
puts Paint[msg, :green]
|
21
21
|
end
|
22
22
|
|
23
23
|
def work!(params)
|
24
24
|
check_capkin_file
|
25
25
|
read_file
|
26
|
-
|
26
|
+
|
27
|
+
robot = Capkin::Robot.new(@config, params)
|
28
|
+
case params.join
|
29
|
+
when 'list' then robot.list
|
30
|
+
when 'info' then robot.info
|
31
|
+
else
|
32
|
+
puts Paint["Publishing new APK: ./#{source} ➔ '#{@stage}'", :blue]
|
33
|
+
robot.upload_apk!
|
34
|
+
end
|
27
35
|
end
|
28
36
|
end
|
29
37
|
end
|
data/lib/capkin/robot.rb
CHANGED
@@ -22,19 +22,18 @@ module Capkin
|
|
22
22
|
|
23
23
|
def initialize(config, stage = nil)
|
24
24
|
@app = config['app']
|
25
|
-
@pkg = config['name']
|
26
25
|
@source ||= File.join(config['build'], "#{@app}.apk")
|
27
26
|
stage = stage.join if stage.respond_to?(:join)
|
28
27
|
@stage = stage.strip.empty? ? STAGE : stage.strip
|
29
28
|
|
29
|
+
@pkg = namespace
|
30
30
|
init_google
|
31
|
-
puts Paint["Publishing new APK: ./#{source} ➔ '#{@stage}'", :blue]
|
32
31
|
end
|
33
32
|
|
34
33
|
def init_google
|
35
34
|
# Get authorization!
|
36
35
|
@auth = Google::Auth.get_application_default(SCOPE)
|
37
|
-
#
|
36
|
+
# Create a publisher object
|
38
37
|
@pub = Google::Apis::AndroidpublisherV2::AndroidPublisherService.new
|
39
38
|
@pub.authorization = @auth
|
40
39
|
end
|
@@ -48,12 +47,54 @@ module Capkin
|
|
48
47
|
@track ||= pub.get_track(pkg, edit.id, stage)
|
49
48
|
end
|
50
49
|
|
50
|
+
def subject # the apk
|
51
|
+
@current_apk ||= Android::Apk.new(source)
|
52
|
+
end
|
53
|
+
|
54
|
+
def app_name
|
55
|
+
subject.manifest.label
|
56
|
+
end
|
57
|
+
|
58
|
+
def namespace
|
59
|
+
subject.manifest.package_name
|
60
|
+
end
|
61
|
+
|
62
|
+
def current_version
|
63
|
+
subject.manifest.version_code
|
64
|
+
end
|
65
|
+
|
66
|
+
def apk_date
|
67
|
+
subject.time.strftime('%Y-%m-%d')
|
68
|
+
end
|
69
|
+
|
70
|
+
#
|
71
|
+
#
|
72
|
+
# pub.list_listings -> Info about the app
|
73
|
+
# def all_listings ??
|
74
|
+
|
75
|
+
#
|
76
|
+
# pub.list_apks -> Lists with idcode and sha1
|
77
|
+
def list
|
78
|
+
puts "➔ Listing all APK! Current #{current_version} - #{apk_date}"
|
79
|
+
pub.list_apks(pkg, edit.id).apks.each do |a|
|
80
|
+
color = current_version == a.version_code ? :green : :black
|
81
|
+
puts Paint["#{a.version_code} ➔ #{a.binary.sha1}", color]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def info
|
86
|
+
a = pub.get_listing(pkg, edit.id, 'pt-BR')
|
87
|
+
puts "\n#{a.title} - #{a.short_description}"
|
88
|
+
puts '---'
|
89
|
+
puts a.full_description
|
90
|
+
puts
|
91
|
+
end
|
92
|
+
|
51
93
|
# Uploads the APK
|
52
94
|
def upload_apk!
|
53
95
|
@apk = pub.upload_apk(pkg, edit.id, upload_source: source)
|
54
|
-
puts Paint["✓ APK uploaded! ##{apk.version_code}", :green]
|
55
96
|
track!
|
56
|
-
puts Paint["✓
|
97
|
+
puts Paint["✓ APK uploaded! ##{apk.version_code}", :green]
|
57
98
|
rescue Google::Apis::ClientError => e
|
58
99
|
if e.to_s =~ /apkUpgradeVersionConflict/
|
59
100
|
puts Paint['✓ Version already exists on play store!', :yellow]
|
@@ -66,7 +107,6 @@ module Capkin
|
|
66
107
|
# Update the alpha track to point to this APK
|
67
108
|
# You need to use a track object to change this
|
68
109
|
def track!
|
69
|
-
puts Paint["Pushing APK ➔ '#{track.track}'", :blue]
|
70
110
|
track.update!(version_codes: [apk.version_code])
|
71
111
|
|
72
112
|
# Save the modified track object
|
data/lib/capkin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capkin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcos Piccinini
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -39,6 +39,20 @@ dependencies:
|
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: ruby_apk
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: google-api-client
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|