apprepo 0.0.4 → 0.0.5
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 +4 -4
- data/lib/apprepo/version.rb +1 -1
- data/lib/test.rb +144 -49
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3667ef79193fbb1384523584c89cfd1f6f792f2c
|
4
|
+
data.tar.gz: 0472aecb30bb7fcaedad242bc2d016199fc6d5bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba9589874abbda0b3565e3c51982a397747319e9ae817be8bd5e5065ebbe5df9e12ed6be388b27a097ce100539a555980f0856ca39257e3d9246b2bdcdac5955
|
7
|
+
data.tar.gz: 28c1141ec0fe9b08a2f1b337d4b72ba5c512f22b699f498b898b81a6ef56075f1ca05439e13199556192555e90549d1e6ea89b8ab4fd0ff15cbb664e04926975
|
data/lib/apprepo/version.rb
CHANGED
data/lib/test.rb
CHANGED
@@ -4,69 +4,164 @@ require 'rubygems'
|
|
4
4
|
require 'net/ssh'
|
5
5
|
require 'net/sftp'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
require 'fastlane'
|
8
|
+
require 'fastlane_core'
|
9
|
+
|
10
|
+
require_relative 'apprepo/options'
|
11
|
+
|
12
|
+
module AppRepo
|
13
|
+
class Test
|
14
|
+
|
15
|
+
attr_accessor :options
|
16
|
+
|
17
|
+
#
|
18
|
+
# These want to be an input parameters:
|
19
|
+
#
|
20
|
+
|
21
|
+
attr_accessor :host
|
22
|
+
attr_accessor :user
|
23
|
+
attr_accessor :password
|
24
|
+
attr_accessor :rsa_keypath
|
25
|
+
attr_accessor :ipa_path
|
26
|
+
attr_accessor :manifest_path
|
27
|
+
attr_accessor :appcode
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
Fastlane::UI.message('[AppRepo:Test] Initializing...')
|
31
|
+
self.host = 'repo.teacloud.net'
|
32
|
+
self.user = 'circle'
|
33
|
+
self.password = 'circle'
|
34
|
+
self.rsa_keypath = '../assets/circle.key'
|
35
|
+
self.ipa_path = '../sampleapp.ipa'
|
36
|
+
self.manifest_path = '../assets/example_manifest.json'
|
37
|
+
self.appcode = 'APPREPO'
|
38
|
+
#self.options = options
|
39
|
+
#AppRepo::Test.new.run!
|
40
|
+
#FastlaneCore::PrintTable.print_values(config: nil , hide_keys: [:app], mask_keys: ['app_review_information.demo_password'], title: "deliver #{AppRepo::VERSION} Summary") # options
|
41
|
+
end
|
15
42
|
|
16
|
-
|
17
|
-
|
43
|
+
# upload an ipa and manifest file or directory to the remote host
|
44
|
+
def ssh_sftp_upload(ssh, local_ipa_path, manifest_path)
|
45
|
+
ssh.sftp.connect do |sftp|
|
18
46
|
|
19
|
-
|
20
|
-
# TODO: Enable SSH when key will work on circle@repo.tecloud.net
|
21
|
-
# Net::SSH.start( host, user, :key_data => rsa_key, :keys_only => true) do |ssh|
|
47
|
+
ipa_name = File.basename(local_ipa_path)
|
22
48
|
|
23
|
-
|
24
|
-
|
25
|
-
|
49
|
+
if File.exist?(local_ipa_path)
|
50
|
+
Fastlane::UI.message("Local IPA found at "+local_ipa_path)
|
51
|
+
else
|
52
|
+
Fastlane::UI.message("IPA at given path does not exist!")
|
53
|
+
return
|
54
|
+
end
|
26
55
|
|
27
|
-
|
56
|
+
# Check/create remote directories
|
28
57
|
|
29
|
-
|
58
|
+
remote_path = get_remote_path() + self.appcode
|
59
|
+
Fastlane::UI.message("Checking APPCODE at: "+ remote_path )
|
30
60
|
|
31
|
-
|
32
|
-
local = '/Users/sychram/test.data.from-remote'
|
61
|
+
remote_mkdir(sftp, remote_path)
|
33
62
|
|
34
|
-
|
35
|
-
sftp.download!(remote, local)
|
63
|
+
# Check/delete remote (rename from metadata later) IPA
|
36
64
|
|
37
|
-
|
38
|
-
|
65
|
+
remote_ipa_path = get_remote_ipa_path(local_ipa_path)
|
66
|
+
Fastlane::UI.message("Checking remote IPA.")
|
67
|
+
begin
|
68
|
+
sftp.stat!(remote_ipa_path) do |response|
|
69
|
+
if response.ok?
|
70
|
+
Fastlane::UI.message("Removing existing IPA...")
|
71
|
+
sftp.remove!(remote_ipa_path)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
rescue
|
75
|
+
Fastlane::UI.message("No previous IPA found.")
|
76
|
+
end
|
39
77
|
|
40
|
-
|
41
|
-
|
42
|
-
|
78
|
+
Fastlane::UI.message("Will upload IPA...")
|
79
|
+
|
80
|
+
path = File.dirname(__FILE__) + '/' + local_ipa_path
|
81
|
+
Fastlane::UI.message("Uploading IPA: " + path + " to path " + remote_ipa_path)
|
82
|
+
sftp.upload!(path, remote_ipa_path)
|
83
|
+
|
84
|
+
remote_manifest_path = remote_path + '/manifest.json'
|
85
|
+
|
86
|
+
Fastlane::UI.message("Checking remote Manifest.")
|
87
|
+
begin
|
88
|
+
sftp.stat!(remote_manifest_path) do |response|
|
89
|
+
if response.ok?
|
90
|
+
Fastlane::UI.message("Reading existing Manifest.")
|
91
|
+
sftp.file.open(remote_manifest_path, 'w') do |f|
|
92
|
+
UI.message("opened file from sftp")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
rescue
|
97
|
+
Fastlane::UI.message("No previous Manifest found.")
|
98
|
+
end
|
99
|
+
|
100
|
+
Fastlane::UI.message("Uploading Manifest: " + manifest_path + " to path " + remote_manifest_path)
|
101
|
+
sftp.upload!(manifest_path, remote_manifest_path)
|
102
|
+
|
103
|
+
# list the entries in a directory for verification
|
104
|
+
sftp.dir.foreach(remote_path) do |entry|
|
105
|
+
Fastlane::UI.message(entry.longname)
|
106
|
+
end
|
43
107
|
end
|
108
|
+
end
|
44
109
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
110
|
+
def remote_mkdir(sftp, remote_path)
|
111
|
+
begin
|
112
|
+
sftp.mkdir remote_path
|
113
|
+
rescue Net::SFTP::StatusException => e
|
114
|
+
if e.code == 11
|
115
|
+
Fastlane::UI.message('Remote directory' + remote_path + ' already exists. OK...')
|
116
|
+
else
|
117
|
+
raise
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
49
121
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
rescue Net::SFTP::StatusException => e
|
56
|
-
# verify if this returns 11. Your server may return
|
57
|
-
# something different like 4.
|
58
|
-
if e.code == 11
|
59
|
-
puts 'directory already exists. Carry on...'
|
60
|
-
sftp.rmdir!('/home/' + user + '/ruby-test')
|
61
|
-
else
|
62
|
-
raise
|
122
|
+
def load_rsa_key(rsa_keypath)
|
123
|
+
File.open(File.dirname(__FILE__) + '/' + rsa_keypath, 'r') do |file|
|
124
|
+
rsa_key = [file.read]
|
125
|
+
if rsa_key != nil
|
126
|
+
Fastlane::UI.message("Successfully loaded RSA key...")
|
63
127
|
end
|
128
|
+
return rsa_key
|
64
129
|
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def get_remote_ipa_path(ipa_path)
|
133
|
+
path = get_remote_path() + self.appcode + '/' + File.basename(ipa_path)
|
134
|
+
Fastlane::UI.message("remote_ipa_path: " + path)
|
135
|
+
return path
|
136
|
+
end
|
137
|
+
|
138
|
+
def get_remote_path()
|
139
|
+
path = '/home/' + user + '/repo/apps/'
|
140
|
+
Fastlane::UI.message("get_remote_path: " + path)
|
141
|
+
return path
|
142
|
+
end
|
65
143
|
|
66
|
-
|
67
|
-
|
68
|
-
|
144
|
+
def run
|
145
|
+
# Login & Upload IPA with metadata using RSA key or username/password
|
146
|
+
rsa_key = nil # load_rsa_key(self.rsa_keypath)
|
147
|
+
if rsa_key != nil
|
148
|
+
Fastlane::UI.message("Logging in with RSA key " + self.rsa_keypath)
|
149
|
+
Net::SSH.start( self.host, self.user, :key_data => rsa_key, :keys_only => true) do |ssh|
|
150
|
+
Fastlane::UI.message("Logged in, uploading UPA & Manifest...")
|
151
|
+
ssh_sftp_upload(ssh, self.ipa_path, self.manifest_path)
|
152
|
+
end
|
153
|
+
else
|
154
|
+
# Login with
|
155
|
+
Fastlane::UI.message("Logging in with username " + self.user + " and password *****...")
|
156
|
+
Net::SSH.start(self.host, self.user, password: self.password) do |ssh|
|
157
|
+
Fastlane::UI.message("Logged in, uploading UPA & Manifest...")
|
158
|
+
ssh_sftp_upload(ssh, self.ipa_path, self.manifest_path)
|
159
|
+
end
|
69
160
|
end
|
70
161
|
end
|
71
|
-
|
72
|
-
|
162
|
+
|
163
|
+
# test
|
164
|
+
Test.new.run
|
165
|
+
|
166
|
+
end # class
|
167
|
+
end # module
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apprepo
|
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
|
- Felix Krause
|
@@ -73,6 +73,20 @@ dependencies:
|
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: json
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.8.1
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.8.1
|
76
90
|
- !ruby/object:Gem::Dependency
|
77
91
|
name: fastimage
|
78
92
|
requirement: !ruby/object:Gem::Requirement
|