apprepo 0.0.2 → 0.0.4

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.
@@ -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
- def initialize (host, login, keypath)
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
- puts 'Initializing "AppRepo:Uploader"'
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
- File.open(self.keypath, "r") do |file|
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
- puts '[AppRepo:Uploader] reading private key...'
50
+ File.open(keypath, 'r') do |file|
51
+ UI.message('[AppRepo:Uploader] reading private key...')
29
52
 
30
- rsa_key = [ file.read ]
53
+ rsa_key = [file.read]
31
54
 
32
- puts '[AppRepo:Uploader] starting SSH connection...'
55
+ UI.message('[AppRepo:Uploader] starting SSH connection...')
33
56
 
34
- Net::SSH.start( self.host, self.login, :key_data => rsa_key, :keys_only => true) do |ssh|
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
- puts '[AppRepo:Uploader] logging to AppRepo...'
60
+ UI.message('[AppRepo:Uploader] logging to AppRepo...')
37
61
 
38
62
  ssh.sftp.connect do |sftp|
39
63
 
40
- puts '[AppRepo:Uploader] AppRepo successfully connected...'
64
+ UI.message('[AppRepo:Uploader] AppRepo successfully connected...')
41
65
 
42
- puts '[AppRepo:Uploader] TODO: Traverse to correct "APPCODE" folder...'
66
+ UI.message('[AppRepo:Uploader] TODO: Traverse to correct "APPCODE" folder...')
43
67
 
44
- result = ssh.exec!('cd repo/apps; ls')
45
- puts result
68
+ result = ssh.exec!('cd repo/apps/' + self.appcode + '; ls')
69
+ UI.message(result)
46
70
 
47
- # upload a file or directory to the remote host
48
- sftp.upload!("/Users/sychram/test.data", "/home/ubuntu/repo/test.data")
71
+ UI.message('Will try to upload ' + self.ipa )
49
72
 
50
- result = ssh.exec!('ls')
73
+ # upload a file or directory to the remote host
74
+ sftp.upload!( self.ipa , '/home/circle/repo/test.data')
51
75
 
52
- puts result
76
+ result = ssh.exec!('ls')
53
77
 
54
- remote = '/home/ubuntu/repo/test.data'
55
- local = '/Users/sychram/test.data.from-remote'
78
+ UI.message(result)
56
79
 
57
- # download a file or directory from the remote host
58
- sftp.download!(remote, local)
80
+ remote = '/home/circle/repo/test.data'
81
+ local = '/Users/sychram/test.data.from-remote'
59
82
 
60
- # grab data off the remote host directly to a buffer
61
- data = sftp.download!(remote)
83
+ # download a file or directory from the remote host
84
+ sftp.download!(remote, local)
62
85
 
63
- # open and write to a pseudo-IO for a remote file
64
- sftp.file.open(remote, "w") do |f|
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
- # open and read from a pseudo-IO for a remote file
69
- sftp.file.open(remote, "r") do |f|
70
- puts f.gets
71
- end
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
- directory = '/home/ubuntu/ruby-test'
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
- # safely make a directory
76
- begin
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
- # verify if this returns 11. Your server may return
80
- # something different like 4.
81
- if e.code == 11
82
- puts "directory already exists. Carry on..."
83
- sftp.rmdir!("/home/ubuntu/ruby-test")
84
- else
85
- raise
86
- end
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
- end
115
+ end
89
116
 
90
- # list the entries in a directory
91
- sftp.dir.foreach(".") do |entry|
92
- puts entry.longname
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', 'ubuntu', '/Users/sychram/.ssh/REPOKey.pem')
100
-
126
+ # upload = new AppRepo:Upload('repo.teacloud.net', 'circle', '/Users/sychram/.ssh/REPOKey.pem')
127
+ end
101
128
  end
102
- end
@@ -1,4 +1,4 @@
1
1
  module AppRepo
2
- VERSION = "0.0.2"
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
@@ -9,25 +9,26 @@ require 'net/sftp'
9
9
  #
10
10
 
11
11
  host = 'repo.teacloud.net'
12
- user = 'ubuntu'
13
- keypath = '/Users/sychram/.ssh/REPOKey.pem'
12
+ user = 'circle'
13
+ password = 'circle'
14
+ keypath = '../assets/circle.key'
14
15
 
15
- File.open(keypath, "r") do |file|
16
+ File.open(File.dirname(__FILE__) + '/' + keypath, 'r') do |file|
17
+ rsa_key = [file.read]
16
18
 
17
- rsa_key = [ file.read ]
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!("/Users/sychram/test.data", "/home/ubuntu/repo/test.data")
25
+ sftp.upload!('~/test.data', '/home/circle/repo/test.data')
25
26
 
26
27
  result = ssh.exec!('ls')
27
28
 
28
- puts result
29
+ UI.message(result)
29
30
 
30
- remote = '/home/ubuntu/repo/test.data'
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, "w") do |f|
41
- f.puts "Hello, world!\n"
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, "r") do |f|
46
+ sftp.file.open(remote, 'r') do |f|
46
47
  puts f.gets
47
48
  end
48
49
 
49
- directory = '/home/ubuntu/ruby-test'
50
+ directory = '/home/' + user + '/ruby-test'
50
51
 
51
- # safely make a directory
52
+ # safely make a directory
52
53
  begin
53
- sftp.mkdir directory
54
+ sftp.mkdir directory
54
55
  rescue Net::SFTP::StatusException => e
55
- # verify if this returns 11. Your server may return
56
- # something different like 4.
57
- if e.code == 11
58
- puts "directory already exists. Carry on..."
59
- sftp.rmdir!("/home/ubuntu/ruby-test")
60
- else
61
- raise
62
- end
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(".") do |entry|
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.2
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-20 00:00:00.000000000 Z
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: net-ssh
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-sftp
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: fastimage
63
+ name: net-sftp
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.6'
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: '1.6'
75
+ version: '0'
76
76
  - !ruby/object:Gem::Dependency
77
- name: plist
77
+ name: fastimage
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.1'
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: '3.1'
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