apprepo 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -23
- data/lib/Repofile +40 -0
- data/lib/apprepo.rb +39 -11
- data/lib/apprepo/commands_generator.rb +108 -0
- data/lib/apprepo/detect_values.rb +38 -0
- data/lib/apprepo/download_metadata.rb +44 -0
- data/lib/apprepo/loader.rb +11 -0
- data/lib/apprepo/manifest.rb +26 -30
- data/lib/apprepo/options.rb +98 -0
- data/lib/apprepo/runner.rb +77 -0
- data/lib/apprepo/setup.rb +49 -0
- data/lib/apprepo/upload_assets.rb +22 -0
- data/lib/apprepo/upload_descriptor.rb +8 -9
- data/lib/apprepo/upload_metadata.rb +192 -0
- data/lib/apprepo/uploader.rb +80 -54
- data/lib/apprepo/version.rb +2 -2
- data/lib/test.rb +27 -26
- metadata +21 -31
data/lib/apprepo/uploader.rb
CHANGED
@@ -5,98 +5,124 @@ require 'fastlane_core/languages'
|
|
5
5
|
require_relative 'upload_descriptor'
|
6
6
|
|
7
7
|
module AppRepo
|
8
|
-
|
9
|
-
class Uploader
|
8
|
+
class Uploader
|
10
9
|
|
11
10
|
attr_accessor :host
|
12
|
-
|
13
11
|
attr_accessor :login
|
14
|
-
|
15
12
|
attr_accessor :keypath
|
13
|
+
attr_accessor :appcode
|
14
|
+
attr_accessor :upload_descriptor
|
16
15
|
|
17
|
-
|
16
|
+
attr_accessor :ipa
|
17
|
+
|
18
|
+
|
19
|
+
def initialize(host, login, keypath, appcode)
|
18
20
|
self.host = host
|
19
21
|
self.login = login
|
20
22
|
self.keypath = keypath
|
21
|
-
|
23
|
+
self.appcode = appcode
|
24
|
+
|
25
|
+
UI.message('[AppRepo:Uploader] Initializing...')
|
26
|
+
|
27
|
+
|
28
|
+
path = File.dirname(__FILE__)+'/../../*.ipa'
|
29
|
+
puts path
|
30
|
+
|
31
|
+
self.ipa = Dir.glob(path).last
|
32
|
+
puts ipa
|
33
|
+
|
34
|
+
|
35
|
+
UI.message('[DEBUG]:' + self.host + ' | ' + self.login + ' | ' + self.keypath + ' | ' + self.appcode )
|
22
36
|
end
|
23
37
|
|
24
38
|
def run
|
25
39
|
|
26
|
-
|
40
|
+
if !appcode
|
41
|
+
UI.user_error('APPCODE value missing.')
|
42
|
+
exit 0
|
43
|
+
end
|
44
|
+
|
45
|
+
if !ipa
|
46
|
+
UI.user_error('IPA value missing.')
|
47
|
+
exit 0
|
48
|
+
end
|
27
49
|
|
28
|
-
|
50
|
+
File.open(keypath, 'r') do |file|
|
51
|
+
UI.message('[AppRepo:Uploader] reading private key...')
|
29
52
|
|
30
|
-
rsa_key = [
|
53
|
+
rsa_key = [file.read]
|
31
54
|
|
32
|
-
|
55
|
+
UI.message('[AppRepo:Uploader] starting SSH connection...')
|
33
56
|
|
34
|
-
Net::SSH.start(
|
57
|
+
Net::SSH.start(host, login, password: 'circle') do |ssh|
|
58
|
+
# Net::SSH.start( self.host, self.login, :key_data => rsa_key, :keys_only => true) do |ssh|
|
35
59
|
|
36
|
-
|
60
|
+
UI.message('[AppRepo:Uploader] logging to AppRepo...')
|
37
61
|
|
38
62
|
ssh.sftp.connect do |sftp|
|
39
63
|
|
40
|
-
|
64
|
+
UI.message('[AppRepo:Uploader] AppRepo successfully connected...')
|
41
65
|
|
42
|
-
|
66
|
+
UI.message('[AppRepo:Uploader] TODO: Traverse to correct "APPCODE" folder...')
|
43
67
|
|
44
|
-
result = ssh.exec!('cd repo/apps; ls')
|
45
|
-
|
68
|
+
result = ssh.exec!('cd repo/apps/' + self.appcode + '; ls')
|
69
|
+
UI.message(result)
|
46
70
|
|
47
|
-
|
48
|
-
sftp.upload!("/Users/sychram/test.data", "/home/ubuntu/repo/test.data")
|
71
|
+
UI.message('Will try to upload ' + self.ipa )
|
49
72
|
|
50
|
-
|
73
|
+
# upload a file or directory to the remote host
|
74
|
+
sftp.upload!( self.ipa , '/home/circle/repo/test.data')
|
51
75
|
|
52
|
-
|
76
|
+
result = ssh.exec!('ls')
|
53
77
|
|
54
|
-
|
55
|
-
local = '/Users/sychram/test.data.from-remote'
|
78
|
+
UI.message(result)
|
56
79
|
|
57
|
-
|
58
|
-
|
80
|
+
remote = '/home/circle/repo/test.data'
|
81
|
+
local = '/Users/sychram/test.data.from-remote'
|
59
82
|
|
60
|
-
|
61
|
-
|
83
|
+
# download a file or directory from the remote host
|
84
|
+
sftp.download!(remote, local)
|
62
85
|
|
63
|
-
|
64
|
-
|
65
|
-
f.puts "Hello, world!\n"
|
66
|
-
end
|
86
|
+
# grab data off the remote host directly to a buffer
|
87
|
+
data = sftp.download!(remote)
|
67
88
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
89
|
+
# open and write to a pseudo-IO for a remote file
|
90
|
+
sftp.file.open(remote, 'w') do |f|
|
91
|
+
f.puts "Hello, world!\n"
|
92
|
+
end
|
72
93
|
|
73
|
-
|
94
|
+
# open and read from a pseudo-IO for a remote file
|
95
|
+
sftp.file.open(remote, 'r') do |f|
|
96
|
+
puts f.gets
|
97
|
+
end
|
74
98
|
|
75
|
-
|
76
|
-
|
99
|
+
directory = '/home/circle/ruby-test'
|
100
|
+
|
101
|
+
# safely make a directory
|
102
|
+
begin
|
77
103
|
sftp.mkdir directory
|
78
104
|
rescue Net::SFTP::StatusException => e
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
105
|
+
# verify if this returns 11. Your server may return
|
106
|
+
# something different like 4.
|
107
|
+
if e.code == 11
|
108
|
+
# warning?
|
109
|
+
UI.user_error('directory already exists. Carry on...')
|
110
|
+
sftp.rmdir!('/home/circle/ruby-test')
|
111
|
+
else
|
112
|
+
raise
|
113
|
+
end
|
87
114
|
|
88
|
-
|
115
|
+
end
|
89
116
|
|
90
|
-
|
91
|
-
|
92
|
-
|
117
|
+
# list the entries in a directory
|
118
|
+
sftp.dir.foreach('.') do |entry|
|
119
|
+
puts entry.longname
|
120
|
+
end
|
121
|
+
end
|
93
122
|
end
|
94
123
|
end
|
95
|
-
end
|
96
|
-
end
|
97
124
|
end
|
98
125
|
|
99
|
-
#upload = new AppRepo:Upload('repo.teacloud.net', '
|
100
|
-
|
126
|
+
# upload = new AppRepo:Upload('repo.teacloud.net', 'circle', '/Users/sychram/.ssh/REPOKey.pem')
|
127
|
+
end
|
101
128
|
end
|
102
|
-
end
|
data/lib/apprepo/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
module AppRepo
|
2
|
-
VERSION =
|
3
|
-
DESCRIPTION = 'Upload icon, metadata and your app to the T-Mobile Enterprise AppRepo and notify users on updaet using a single command'
|
2
|
+
VERSION = '0.0.4'.freeze
|
3
|
+
DESCRIPTION = 'Upload icon, metadata and your app to the T-Mobile Enterprise AppRepo and notify users on updaet using a single command'.freeze
|
4
4
|
end
|
data/lib/test.rb
CHANGED
@@ -9,25 +9,26 @@ require 'net/sftp'
|
|
9
9
|
#
|
10
10
|
|
11
11
|
host = 'repo.teacloud.net'
|
12
|
-
user = '
|
13
|
-
|
12
|
+
user = 'circle'
|
13
|
+
password = 'circle'
|
14
|
+
keypath = '../assets/circle.key'
|
14
15
|
|
15
|
-
File.open(keypath,
|
16
|
+
File.open(File.dirname(__FILE__) + '/' + keypath, 'r') do |file|
|
17
|
+
rsa_key = [file.read]
|
16
18
|
|
17
|
-
|
19
|
+
Net::SSH.start(host, user, password: 'circle') do |ssh|
|
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|
|
18
22
|
|
19
|
-
Net::SSH.start( host, user, :key_data => rsa_key, :keys_only => true) do |ssh|
|
20
|
-
|
21
23
|
ssh.sftp.connect do |sftp|
|
22
|
-
|
23
24
|
# upload a file or directory to the remote host
|
24
|
-
sftp.upload!(
|
25
|
+
sftp.upload!('~/test.data', '/home/circle/repo/test.data')
|
25
26
|
|
26
27
|
result = ssh.exec!('ls')
|
27
28
|
|
28
|
-
|
29
|
+
UI.message(result)
|
29
30
|
|
30
|
-
remote = '/home/
|
31
|
+
remote = '/home/' + user + '/repo/test.data'
|
31
32
|
local = '/Users/sychram/test.data.from-remote'
|
32
33
|
|
33
34
|
# download a file or directory from the remote host
|
@@ -37,35 +38,35 @@ File.open(keypath, "r") do |file|
|
|
37
38
|
data = sftp.download!(remote)
|
38
39
|
|
39
40
|
# open and write to a pseudo-IO for a remote file
|
40
|
-
sftp.file.open(remote,
|
41
|
-
|
41
|
+
sftp.file.open(remote, 'w') do |f|
|
42
|
+
UI.message("opened file from sftp")
|
42
43
|
end
|
43
44
|
|
44
45
|
# open and read from a pseudo-IO for a remote file
|
45
|
-
sftp.file.open(remote,
|
46
|
+
sftp.file.open(remote, 'r') do |f|
|
46
47
|
puts f.gets
|
47
48
|
end
|
48
49
|
|
49
|
-
directory = '/home/
|
50
|
+
directory = '/home/' + user + '/ruby-test'
|
50
51
|
|
51
|
-
# safely make a directory
|
52
|
+
# safely make a directory
|
52
53
|
begin
|
53
|
-
|
54
|
+
sftp.mkdir directory
|
54
55
|
rescue Net::SFTP::StatusException => e
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
63
|
+
end
|
63
64
|
end
|
64
65
|
|
65
66
|
# list the entries in a directory
|
66
|
-
sftp.dir.foreach(
|
67
|
+
sftp.dir.foreach('.') do |entry|
|
67
68
|
puts entry.longname
|
68
69
|
end
|
69
70
|
end
|
70
71
|
end
|
71
|
-
end
|
72
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Matej Sychra
|
8
7
|
- Felix Krause
|
8
|
+
- Matej Sychra
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-05-
|
12
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fastlane
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 2.0.0
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
35
|
+
name: fastlane_core
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name: net-
|
49
|
+
name: net-ssh
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
@@ -60,39 +60,33 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: net-sftp
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
type: :runtime
|
70
70
|
prerelease: false
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
77
|
+
name: fastimage
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
83
|
-
- - ">="
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 3.1.0
|
82
|
+
version: '1.6'
|
86
83
|
type: :runtime
|
87
84
|
prerelease: false
|
88
85
|
version_requirements: !ruby/object:Gem::Requirement
|
89
86
|
requirements:
|
90
87
|
- - "~>"
|
91
88
|
- !ruby/object:Gem::Version
|
92
|
-
version: '
|
93
|
-
- - ">="
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: 3.1.0
|
89
|
+
version: '1.6'
|
96
90
|
- !ruby/object:Gem::Dependency
|
97
91
|
name: bundler
|
98
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,20 +211,6 @@ dependencies:
|
|
217
211
|
- - "~>"
|
218
212
|
- !ruby/object:Gem::Version
|
219
213
|
version: '0'
|
220
|
-
- !ruby/object:Gem::Dependency
|
221
|
-
name: fastlane
|
222
|
-
requirement: !ruby/object:Gem::Requirement
|
223
|
-
requirements:
|
224
|
-
- - "~>"
|
225
|
-
- !ruby/object:Gem::Version
|
226
|
-
version: '0'
|
227
|
-
type: :development
|
228
|
-
prerelease: false
|
229
|
-
version_requirements: !ruby/object:Gem::Requirement
|
230
|
-
requirements:
|
231
|
-
- - "~>"
|
232
|
-
- !ruby/object:Gem::Version
|
233
|
-
version: '0'
|
234
214
|
- !ruby/object:Gem::Dependency
|
235
215
|
name: rubocop
|
236
216
|
requirement: !ruby/object:Gem::Requirement
|
@@ -269,9 +249,19 @@ extra_rdoc_files: []
|
|
269
249
|
files:
|
270
250
|
- LICENSE
|
271
251
|
- README.md
|
252
|
+
- lib/Repofile
|
272
253
|
- lib/apprepo.rb
|
254
|
+
- lib/apprepo/commands_generator.rb
|
255
|
+
- lib/apprepo/detect_values.rb
|
256
|
+
- lib/apprepo/download_metadata.rb
|
257
|
+
- lib/apprepo/loader.rb
|
273
258
|
- lib/apprepo/manifest.rb
|
259
|
+
- lib/apprepo/options.rb
|
260
|
+
- lib/apprepo/runner.rb
|
261
|
+
- lib/apprepo/setup.rb
|
262
|
+
- lib/apprepo/upload_assets.rb
|
274
263
|
- lib/apprepo/upload_descriptor.rb
|
264
|
+
- lib/apprepo/upload_metadata.rb
|
275
265
|
- lib/apprepo/uploader.rb
|
276
266
|
- lib/apprepo/version.rb
|
277
267
|
- lib/test.data
|