apprepo 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3667ef79193fbb1384523584c89cfd1f6f792f2c
4
- data.tar.gz: 0472aecb30bb7fcaedad242bc2d016199fc6d5bd
3
+ metadata.gz: 8ac2808072cad819af871a257b85448c8d76645d
4
+ data.tar.gz: 2ba4d48bcf6063feebc6bbc8055bc24572389b47
5
5
  SHA512:
6
- metadata.gz: ba9589874abbda0b3565e3c51982a397747319e9ae817be8bd5e5065ebbe5df9e12ed6be388b27a097ce100539a555980f0856ca39257e3d9246b2bdcdac5955
7
- data.tar.gz: 28c1141ec0fe9b08a2f1b337d4b72ba5c512f22b699f498b898b81a6ef56075f1ca05439e13199556192555e90549d1e6ea89b8ab4fd0ff15cbb664e04926975
6
+ metadata.gz: 2786029914e35e0ee85cdcf0f284798663759d472bf995e897a8cf36c1c269d5250fe4ac586882334228ea740318d3ec04cb0699690109fb0d705e687b0999be
7
+ data.tar.gz: da794c44e80a59c549eca53140c1e7b483e78ad5aef98dc841ecafb6e518edeb0707a481080cfd46395fa2e129c2d961c076930e340fa7125776074a0fb84d7c
@@ -39,15 +39,14 @@ module AppRepo
39
39
 
40
40
  # Setup descriptor (appcode, ipa, metadata - from repofile)!
41
41
  UI.message('[AppRepoTest] UploadDescriptor.new')
42
- uploadDescriptor = UploadDescriptor.new(appcode) # not used yet
43
- uploadDescriptor.appcode = appcode
42
+ uploadDescriptor = UploadDescriptor.new(appcode) # not used yet
43
+ uploadDescriptor.appcode = appcode
44
44
 
45
45
  # Test Uploader (OK)
46
- #UI.message('[AppRepoTest] Uploader.new')
47
- #upload = Uploader.new('repo.teacloud.net', 'circle', File.dirname(__FILE__) + '/../assets/circle.key', appcode)
48
- #upload.run
46
+ # UI.message('[AppRepoTest] Uploader.new')
47
+ # upload = Uploader.new('repo.teacloud.net', 'circle', File.dirname(__FILE__) + '/../assets/circle.key', appcode)
48
+ # upload.run
49
49
 
50
50
  UI.message('[AppRepoTest] AppRepo::CommandsGenerator.new.run')
51
- CommandsGenerator.new.run
52
-
51
+ CommandsGenerator.new.run
53
52
  end
@@ -16,6 +16,9 @@ module AppRepo
16
16
  # rubocop:disable Metrics/AbcSize
17
17
  # rubocop:disable Metrics/MethodLength
18
18
  def run
19
+
20
+ puts "[AppRepo::CommandsGenerator] run"
21
+
19
22
  program :version, AppRepo::VERSION
20
23
  program :description, AppRepo::DESCRIPTION
21
24
  program :help, 'Author', 'Matej Sychra <suculent@me.com>'
@@ -36,11 +39,13 @@ module AppRepo
36
39
  options = FastlaneCore::Configuration.create(AppRepo::Options.available_options, options.__hash__)
37
40
  loaded = options.load_configuration_file('Repofile')
38
41
  loaded = true if options[:repo_description] || options[:ipa]
42
+
39
43
  unless loaded
44
+ puts "[AppRepo::CommandsGenerator] configuration file not loaded"
40
45
  if UI.confirm('No AppRepo configuration found in the current directory. Do you want to setup apprepo?')
41
- require 'apprepo/setup'
42
- # AppRepo::Runner.new(options) # to login...
46
+ require 'apprepo/setup'
43
47
  AppRepo::Setup.new.run(options)
48
+ puts "[AppRepo::CommandsGenerator] exiting."
44
49
  return 0
45
50
  end
46
51
  end
@@ -48,6 +53,7 @@ module AppRepo
48
53
  AppRepo::Runner.new(options).run
49
54
  end
50
55
  end
56
+
51
57
  command :submit_build do |c|
52
58
  c.syntax = 'apprepo submit_build'
53
59
  c.description = 'Submit a specific build-nr for review, use latest for the latest build'
@@ -59,6 +65,7 @@ module AppRepo
59
65
  AppRepo::Runner.new(options).run
60
66
  end
61
67
  end
68
+
62
69
  command :init do |c|
63
70
  c.syntax = 'apprepo init'
64
71
  c.description = 'Create the initial `apprepo` configuration based on an existing app'
@@ -89,7 +96,7 @@ module AppRepo
89
96
  res ||= UI.confirm("Do you want to overwrite existing metadata on path '#{File.expand_path(path)}'?")
90
97
  if res
91
98
  require 'apprepo/setup'
92
- # TODO: Fetch version from IPA or else
99
+ #  TODO: Fetch version from IPA or else
93
100
  v = options[:app_version].latest_version
94
101
  AppRepo::Setup.new.generate_metadata_files(v, path)
95
102
  else
@@ -1,7 +1,7 @@
1
1
  module AppRepo
2
2
  class DetectValues
3
3
  def run!(options)
4
- #find_app_identifier(options
4
+ # find_app_identifier(options
5
5
  find_folders(options)
6
6
  find_version(options)
7
7
  end
@@ -20,17 +20,17 @@ module AppRepo
20
20
  end
21
21
 
22
22
  def find_folders(options)
23
- containing = Helper.fastlane_enabled? ? './fastlane' : '.'
24
- if options[:metadata_path] != nil
25
- puts "Containing: '"+options[:metadata_path]+"' folder for TODO RENAME example_manifest.json"
26
- options[:metadata_path] ||= File.join(containing, '/../manifest.json')
27
- puts "Options: '"+options[:metadata_path]+"'"
28
- FileUtils.mkdir_p(options[:metadata_path])
23
+ containing = Helper.fastlane_enabled? ? './fastlane' : '.'
24
+ unless options[:metadata_path].nil?
25
+ puts "Containing: '" + options[:metadata_path] + "' folder for TODO RENAME example_manifest.json"
26
+ options[:metadata_path] ||= File.join(containing, '/../manifest.json')
27
+ puts "Options: '" + options[:metadata_path] + "'"
28
+ FileUtils.mkdir_p(options[:metadata_path])
29
29
  end
30
30
  end
31
31
 
32
32
  def find_version(options)
33
- if options[:ipa] != nil
33
+ unless options[:ipa].nil?
34
34
  options[:app_version] ||= FastlaneCore::IpaFileAnalyser.fetch_app_version(options[:ipa])
35
35
  end
36
36
  end
@@ -23,7 +23,7 @@ module AppRepo
23
23
  optional: false,
24
24
  env_name: 'APPREPO_APP_ID',
25
25
  description: 'Your bundle identifier',
26
- default_value: ""),
26
+ default_value: ''),
27
27
  FastlaneCore::ConfigItem.new(key: :app_code,
28
28
  short_option: '-c',
29
29
  optional: true,
@@ -70,7 +70,7 @@ module AppRepo
70
70
  is_string: false,
71
71
  default_value: false),
72
72
  FastlaneCore::ConfigItem.new(key: :notify,
73
- description: "Notify AppRepo users on update",
73
+ description: 'Notify AppRepo users on update',
74
74
  is_string: false,
75
75
  default_value: false),
76
76
  FastlaneCore::ConfigItem.new(key: :build_number,
@@ -1,3 +1,5 @@
1
+ require_relative 'uploader'
2
+
1
3
  module AppRepo
2
4
  class Runner
3
5
  attr_accessor :options
@@ -5,19 +7,12 @@ module AppRepo
5
7
  def initialize(options)
6
8
  UI.message('[AppRepo:Runner] Initializing...')
7
9
  self.options = options
8
- #login
9
10
  AppRepo::DetectValues.new.run!(self.options)
10
- #FastlaneCore::PrintTable.print_values(config: options, hide_keys: [:app], mask_keys: ['app_review_information.demo_password'], title: "deliver #{AppRepo::VERSION} Summary")
11
- end
12
-
13
- def login
14
- #UI.message("Login to AppRepo (#{options[:username]})")
15
- #AppRepo::Server.login(options[:username])
16
- #AppRepo::Server.select_app
17
- #UI.message('Login successful')
11
+ # FastlaneCore::PrintTable.print_values(config: options, hide_keys: [:app], mask_keys: ['app_review_information.demo_password'], title: "deliver #{AppRepo::VERSION} Summary")
18
12
  end
19
13
 
20
14
  def run
15
+ UI.success('[AppRepo:Runner] Running!')
21
16
  verify_version if options[:app_version].to_s.length > 0
22
17
  upload_metadata
23
18
 
@@ -26,7 +21,7 @@ module AppRepo
26
21
  upload_binary
27
22
  end
28
23
 
29
- UI.success('Finished the upload to AppRepo')
24
+ UI.success('Finished the upload to AppRepo.')
30
25
 
31
26
  notify if options[:notify]
32
27
  end
@@ -37,12 +32,12 @@ module AppRepo
37
32
  app_version = options[:app_version]
38
33
  UI.message("TODO: Make sure the latest version on AppRepo matches '#{app_version}' from the ipa file...")
39
34
 
40
- #changed = options[:app].ensure_version!(app_version)
41
- #if changed
35
+ # changed = options[:app].ensure_version!(app_version)
36
+ # if changed
42
37
  # UI.success("Successfully set the version to '#{app_version}'")
43
- #else
38
+ # else
44
39
  # UI.success("'#{app_version}' is the latest version on iTunes Connect")
45
- #end
40
+ # end
46
41
  end
47
42
 
48
43
  # Upload all metadata, screenshots, pricing information, etc. to iTunes Connect
@@ -52,19 +47,12 @@ module AppRepo
52
47
 
53
48
  # Upload the binary to iTunes Connect
54
49
  def upload_binary
55
- UI.message('Uploading binary to iTunes Connect')
50
+ UI.message('Uploading binary to AppRepo')
56
51
  if options[:ipa]
57
- #package_path = FastlaneCore::IpaUploadPackageBuilder.new.generate(
58
- # app_id: options[:app].apple_id,
59
- # ipa_path: options[:ipa],
60
- # package_path: '/tmp'
61
- puts "TODO: Build package path without IpaUploadPackageBuilder"
62
-
52
+ AppRepo::Uploader.new(options)
53
+ # result = transporter.upload(options[:app].apple_id, package_path)
54
+ # UI.user_error!('Could not upload binary to iTunes Connect. Check out the error above') unless result
63
55
  end
64
-
65
- #transporter = FastlaneCore::ItunesTransporter.new(options[:username])
66
- #result = transporter.upload(options[:app].apple_id, package_path)
67
- #UI.user_error!('Could not upload binary to iTunes Connect. Check out the error above') unless result
68
56
  end
69
57
 
70
58
  def notify
@@ -72,6 +60,5 @@ module AppRepo
72
60
  end
73
61
 
74
62
  private
75
-
76
63
  end
77
64
  end
@@ -1,6 +1,5 @@
1
1
  module AppRepo
2
2
  class Setup
3
-
4
3
  def setup_apprepo(file_path, data, _apprepo_path, _options)
5
4
  UI.message('[AppRepo:Setup] Setting up...')
6
5
  File.write(file_path, data)
@@ -13,18 +12,18 @@ module AppRepo
13
12
 
14
13
  # This method takes care of creating a new 'apprepo' folder, containg the app metadata
15
14
  # and screenshots folders
16
- def generate_apprepo_file(apprepo_path, options)
15
+ def generate_apprepo_file(_apprepo_path, options)
17
16
  #
18
- #v = options[:app].latest_version
19
- #generate_metadata_files(v, File.join(apprepo_path, 'metadata'))
17
+ # v = options[:app].latest_version
18
+ # generate_metadata_files(v, File.join(apprepo_path, 'metadata'))
20
19
 
21
20
  # Generate the final Repofile here
22
21
  gem_path = Helper.gem_path('apprepo')
23
22
  apprepo = File.read("#{gem_path}/../assets/RepofileDefault")
24
- apprepo.gsub!("[[APP_IDENTIFIER]]", options[:app].bundle_id)
25
- apprepo.gsub!("[[APPREPO_IPA_PATH]]", options[:app].file_path)
26
- apprepo.gsub!("[[APP_VERSION]]", options[:app].version)
27
- apprepo.gsub!("[[APP_NAME]]", options[:app].name)
23
+ apprepo.gsub!('[[APP_IDENTIFIER]]', options[:app].bundle_id)
24
+ apprepo.gsub!('[[APPREPO_IPA_PATH]]', options[:app].file_path)
25
+ apprepo.gsub!('[[APP_VERSION]]', options[:app].version)
26
+ apprepo.gsub!('[[APP_NAME]]', options[:app].name)
28
27
  UI.user_error("TODO: ADJUST Repofile'")
29
28
  # deliver => apprepo??
30
29
  end
@@ -7,7 +7,7 @@ module AppRepo
7
7
  UI.user_error!("Could not find a version to edit for app '#{app.name}'") unless v
8
8
 
9
9
  if options[:app_icon]
10
- UI.message('Uploading app icon...')
10
+ UI.message('Uploading app icon...')
11
11
  v.upload_large_icon!(options[:app_icon])
12
12
  end
13
13
 
@@ -1,6 +1,5 @@
1
1
  module AppRepo
2
2
  class UploadDescriptor
3
-
4
3
  attr_accessor :appcode # required
5
4
  attr_accessor :ipa # can be inferred anyway (glob or metadata)
6
5
  attr_accessor :metadata # optional, allows re-uploading same binary without metadata change
@@ -1,128 +1,203 @@
1
+ #!/usr/bin/env ruby
2
+
1
3
  require 'rubygems'
4
+ require 'json'
2
5
  require 'net/ssh'
3
6
  require 'net/sftp'
7
+
8
+ require 'fastlane'
9
+ require 'fastlane_core'
4
10
  require 'fastlane_core/languages'
5
- require_relative 'upload_descriptor'
11
+
12
+ require_relative 'options'
13
+ require_relative 'upload_descriptor' # will deprecate, should have contain Repofile data but it will be in options as expected
6
14
 
7
15
  module AppRepo
8
16
  class Uploader
17
+ attr_accessor :options
18
+
19
+ #
20
+ # These want to be an input parameters:
21
+ #
9
22
 
10
23
  attr_accessor :host
11
- attr_accessor :login
12
- attr_accessor :keypath
24
+ attr_accessor :user
25
+ attr_accessor :password
26
+ attr_accessor :rsa_keypath
27
+ attr_accessor :ipa_path
28
+ attr_accessor :manifest_path
13
29
  attr_accessor :appcode
14
- attr_accessor :upload_descriptor
15
-
16
- attr_accessor :ipa
17
-
18
-
19
- def initialize(host, login, keypath, appcode)
20
- self.host = host
21
- self.login = login
22
- self.keypath = keypath
23
- self.appcode = appcode
24
30
 
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 )
31
+ def initialize
32
+ Fastlane::UI.message('[AppRepo:Uploader] Initializing...')
33
+ self.host = 'repo.teacloud.net'
34
+ self.user = 'circle'
35
+ self.password = 'circle'
36
+ self.rsa_keypath = '../assets/circle.key'
37
+ self.ipa_path = '../sampleapp.ipa'
38
+ self.manifest_path = '../assets/example_manifest.json'
39
+ self.appcode = 'APPREPO'
40
+ # self.options = options
41
+ # AppRepo::Uploader.new.run!
42
+ # FastlaneCore::PrintTable.print_values(config: nil , hide_keys: [:app], mask_keys: ['app_review_information.demo_password'], title: "deliver #{AppRepo::VERSION} Summary") # options
36
43
  end
37
44
 
38
- def run
45
+ #
46
+ # Main
47
+ #
39
48
 
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
49
+ def run
50
+ # Login & Upload IPA with metadata using RSA key or username/password
51
+ rsa_key = load_rsa_key(self.rsa_keypath)
52
+ if rsa_key?
53
+ #if !rsa_key.nil?
54
+ Fastlane::UI.message('[AppRepo:Uploader] Logging in with RSA key ' + rsa_keypath)
55
+ Net::SSH.start(host, user, key_data: rsa_key, keys_only: true) do |ssh|
56
+ Fastlane::UI.message('[AppRepo:Uploader] Logged in, uploading UPA & Manifest...')
57
+ ssh_sftp_upload(ssh, ipa_path, manifest_path)
58
+ end
59
+ else
60
+ #  Login with
61
+ Fastlane::UI.message('[AppRepo:Uploader] Logging in with username ' + user + ' and password *****...')
62
+ Net::SSH.start(host, user, password: password) do |ssh|
63
+ Fastlane::UI.message('Logged in, uploading UPA & Manifest...')
64
+ ssh_sftp_upload(ssh, ipa_path, manifest_path)
65
+ end
48
66
  end
67
+ end
49
68
 
50
- File.open(keypath, 'r') do |file|
51
- UI.message('[AppRepo:Uploader] reading private key...')
52
-
53
- rsa_key = [file.read]
54
-
55
- UI.message('[AppRepo:Uploader] starting SSH connection...')
56
-
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|
69
+ def ssh_sftp_upload(ssh, local_ipa_path, manifest_path)
70
+ ssh.sftp.connect do |sftp|
59
71
 
60
- UI.message('[AppRepo:Uploader] logging to AppRepo...')
72
+ ipa_name = File.basename(local_ipa_path)
61
73
 
62
- ssh.sftp.connect do |sftp|
74
+ if File.exist?(local_ipa_path)
75
+ Fastlane::UI.message('[AppRepo:Uploader] Local IPA found at ' + local_ipa_path)
76
+ else
77
+ Fastlane::UI.message('[AppRepo:Uploader] IPA at given path does not exist!')
78
+ return
79
+ end
63
80
 
64
- UI.message('[AppRepo:Uploader] AppRepo successfully connected...')
81
+ #
82
+ # Check/create remote APPCODE directory
83
+ # @params sftp, appcode;
84
+ # @callees remote_path()
85
+ #
86
+
87
+ remote_path = get_remote_path + appcode
88
+ Fastlane::UI.message('[AppRepo:Uploader] Checking APPCODE at: ' + remote_path)
89
+ remote_mkdir(sftp, remote_path)
90
+
91
+ #
92
+ # Check/fetch remote MANIFEST
93
+ # @params sftp, appcode;
94
+ # @callees remote_path()
95
+ #
96
+
97
+ remote_manifest_path = remote_path + '/manifest.json'
98
+
99
+ Fastlane::UI.message('[AppRepo:Uploader] Checking remote Manifest.')
100
+ begin
101
+ sftp.stat!(remote_manifest_path) do |response|
102
+ if response.ok?
103
+ Fastlane::UI.message('Reading existing Manifest.')
104
+ sftp.file.open(remote_manifest_path, 'w') do |remote_manifest|
105
+ manifest = remote_manifest.gets
106
+ json = JSON.parse(manifest)
107
+ UI.message('[AppRepo:Uploader] Opened file from sftp...')
108
+ puts '****************************************************************'
109
+ puts json
110
+ puts '****************************************************************'
111
+ end
112
+ end
113
+ end
114
+ rescue
115
+ Fastlane::UI.message('[AppRepo:Uploader] No previous Manifest found.')
116
+ end
65
117
 
66
- UI.message('[AppRepo:Uploader] TODO: Traverse to correct "APPCODE" folder...')
118
+ #
119
+ # Check/delete remote (rename from metadata later) IPA
120
+ # @params sftp, appcode, local_ipa_path, ;
121
+ # @callees get_remote_ipa_path()
122
+ #
123
+
124
+ remote_ipa_path = get_remote_ipa_path(local_ipa_path)
125
+ Fastlane::UI.message('[AppRepo:Uploader] Checking remote IPA.')
126
+ begin
127
+ sftp.stat!(remote_ipa_path) do |response|
128
+ if response.ok?
129
+ Fastlane::UI.message('[AppRepo:Uploader] Removing existing IPA...')
130
+ sftp.remove!(remote_ipa_path)
131
+ end
132
+ end
133
+ rescue
134
+ Fastlane::UI.message('[AppRepo:Uploader] No previous IPA found.')
135
+ end
67
136
 
68
- result = ssh.exec!('cd repo/apps/' + self.appcode + '; ls')
69
- UI.message(result)
137
+ Fastlane::UI.message('[AppRepo:Uploader] Will upload IPA...')
70
138
 
71
- UI.message('Will try to upload ' + self.ipa )
139
+ #
140
+ # Upload current manifest.json
141
+ # @params sftp, local_ipa_path, remote_ipa_path;
142
+ # @callees get_remote_path()
143
+ #
72
144
 
73
- # upload a file or directory to the remote host
74
- sftp.upload!( self.ipa , '/home/circle/repo/test.data')
145
+ path = File.dirname(__FILE__) + '/' + local_ipa_path
146
+ Fastlane::UI.message('[AppRepo:Uploader] Uploading IPA: ' + path + ' to path ' + remote_ipa_path)
147
+ sftp.upload!(path, remote_ipa_path)
75
148
 
76
- result = ssh.exec!('ls')
149
+ #
150
+ # Upload current manifest.json
151
+ # @params sftp, manifest_path, remote_manifest_path;
152
+ # @callees get_remote_path()
153
+ #
77
154
 
78
- UI.message(result)
155
+ Fastlane::UI.message('[AppRepo:Uploader] Uploading Manifest: ' + manifest_path + ' to path ' + remote_manifest_path)
156
+ sftp.upload!(manifest_path, remote_manifest_path)
79
157
 
80
- remote = '/home/circle/repo/test.data'
81
- local = '/Users/sychram/test.data.from-remote'
158
+ #
159
+ # Lists the entries in a directory for verification
160
+ #
82
161
 
83
- # download a file or directory from the remote host
84
- sftp.download!(remote, local)
162
+ sftp.dir.foreach(remote_path) do |entry|
163
+ Fastlane::UI.message(entry.longname)
164
+ end
165
+ end
166
+ end
85
167
 
86
- # grab data off the remote host directly to a buffer
87
- data = sftp.download!(remote)
168
+ # Private methods Remote Operations
88
169
 
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
170
+ def get_remote_ipa_path(ipa_path)
171
+ path = get_remote_path + appcode + '/' + File.basename(ipa_path)
172
+ Fastlane::UI.message('[AppRepo:Uploader] remote_ipa_path: ' + path)
173
+ path
174
+ end
93
175
 
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
176
+ def get_remote_path
177
+ path = '/home/' + user + '/repo/apps/'
178
+ Fastlane::UI.message('[AppRepo:Uploader] get_remote_path: ' + path)
179
+ path
180
+ end
98
181
 
99
- directory = '/home/circle/ruby-test'
100
-
101
- # safely make a directory
102
- begin
103
- sftp.mkdir directory
104
- rescue Net::SFTP::StatusException => e
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
182
+ def remote_mkdir(sftp, remote_path)
183
+ sftp.mkdir remote_path
184
+ rescue Net::SFTP::StatusException => e
185
+ if e.code == 11
186
+ Fastlane::UI.message('[AppRepo:Uploader] Remote directory' + remote_path + ' already exists. OK...')
187
+ else
188
+ raise
189
+ end
190
+ end
114
191
 
115
- end
192
+ # Private methods – Local Operations
116
193
 
117
- # list the entries in a directory
118
- sftp.dir.foreach('.') do |entry|
119
- puts entry.longname
120
- end
121
- end
122
- end
194
+ def load_rsa_key(rsa_keypath)
195
+ File.open(File.dirname(__FILE__) + '/' + rsa_keypath, 'r') do |file|
196
+ rsa_key = [file.read]
197
+ Fastlane::UI.message('[AppRepo:Uploader] Successfully loaded RSA key...') unless rsa_key.nil?
198
+ return rsa_key
123
199
  end
124
- end
200
+ end
125
201
 
126
- # upload = new AppRepo:Upload('repo.teacloud.net', 'circle', '/Users/sychram/.ssh/REPOKey.pem')
127
202
  end
128
203
  end
@@ -1,4 +1,5 @@
1
1
  module AppRepo
2
- VERSION = '0.0.5'.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
2
+ VERSION = '0.0.6'.freeze
3
+ DESCRIPTION = 'Upload icon, metadata and your app to the T-Mobile Enterprise AppRepo and notify users on updaet using a single command'
4
+ SUMMARY = 'Upload icon, metadata and your app to SFTP'
4
5
  end
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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-24 00:00:00.000000000 Z
12
+ date: 2016-05-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fastlane
@@ -155,14 +155,14 @@ dependencies:
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: 0.2.3
158
+ version: 0.2.2
159
159
  type: :development
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: 0.2.3
165
+ version: 0.2.2
166
166
  - !ruby/object:Gem::Dependency
167
167
  name: pry
168
168
  requirement: !ruby/object:Gem::Requirement
@@ -253,6 +253,34 @@ dependencies:
253
253
  - - "~>"
254
254
  - !ruby/object:Gem::Version
255
255
  version: '0'
256
+ - !ruby/object:Gem::Dependency
257
+ name: coverband
258
+ requirement: !ruby/object:Gem::Requirement
259
+ requirements:
260
+ - - "~>"
261
+ - !ruby/object:Gem::Version
262
+ version: '0'
263
+ type: :development
264
+ prerelease: false
265
+ version_requirements: !ruby/object:Gem::Requirement
266
+ requirements:
267
+ - - "~>"
268
+ - !ruby/object:Gem::Version
269
+ version: '0'
270
+ - !ruby/object:Gem::Dependency
271
+ name: fastlane
272
+ requirement: !ruby/object:Gem::Requirement
273
+ requirements:
274
+ - - "~>"
275
+ - !ruby/object:Gem::Version
276
+ version: '1.89'
277
+ type: :development
278
+ prerelease: false
279
+ version_requirements: !ruby/object:Gem::Requirement
280
+ requirements:
281
+ - - "~>"
282
+ - !ruby/object:Gem::Version
283
+ version: '1.89'
256
284
  description: Upload icon, metadata and your app to the T-Mobile Enterprise AppRepo
257
285
  and notify users on updaet using a single command
258
286
  email:
@@ -263,7 +291,6 @@ extra_rdoc_files: []
263
291
  files:
264
292
  - LICENSE
265
293
  - README.md
266
- - lib/Repofile
267
294
  - lib/apprepo.rb
268
295
  - lib/apprepo/commands_generator.rb
269
296
  - lib/apprepo/detect_values.rb
@@ -278,9 +305,6 @@ files:
278
305
  - lib/apprepo/upload_metadata.rb
279
306
  - lib/apprepo/uploader.rb
280
307
  - lib/apprepo/version.rb
281
- - lib/test.data
282
- - lib/test.data.from-remote
283
- - lib/test.rb
284
308
  homepage: https://github.com/suculent/apprepo
285
309
  licenses:
286
310
  - MIT
@@ -1,40 +0,0 @@
1
- # encoding: utf-8
2
-
3
- # THIS FILE IS USED FOR TESTING ONLY!
4
-
5
- ###################### More Options ######################
6
- # If you want to have even more control, check out the documentation
7
- # https://github.com/suculent/apprepo/blob/master/Repofile.md
8
-
9
-
10
- ###################### Automatically generated ######################
11
- # Feel free to remove the following line if you use fastlane (which you should)
12
-
13
- # THIS FILE IS USED FOR TESTING ONLY!
14
- app_identifier "com.apprepo.test"
15
- ipa File.dirname(__FILE__)+"/../sampleapp.ipa"
16
- app_version "1.0"
17
- meta_title "TestApp"
18
- repo_description "Some description is required for AppRepo users to know, that is this app."
19
-
20
- #
21
- # Authentication
22
- #
23
-
24
- # You can use your '~/.ssh/config' file to setup RSA keys to AppRepo, or use following options:
25
-
26
- repo_url "repo.teacloud.net"
27
- repo_user "circle"
28
- repo_key "./lib/assets/circle.pub"
29
-
30
- # app_identifier "" # your app's bundle identifier
31
-
32
- # notify true # Add this to automatically notify the AppRepo users after uploading metadata/binary.
33
-
34
- # manifest_path "./manifest.json" # Path to the manifest.json you want to use.
35
-
36
- # meta_subtitle "Some application"
37
-
38
- # meta_description "Detailed application description."
39
-
40
- # app_icon './AppIcon.png'
@@ -1 +0,0 @@
1
- testdata
@@ -1 +0,0 @@
1
- testdata
@@ -1,167 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'net/ssh'
5
- require 'net/sftp'
6
-
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
42
-
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|
46
-
47
- ipa_name = File.basename(local_ipa_path)
48
-
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
55
-
56
- # Check/create remote directories
57
-
58
- remote_path = get_remote_path() + self.appcode
59
- Fastlane::UI.message("Checking APPCODE at: "+ remote_path )
60
-
61
- remote_mkdir(sftp, remote_path)
62
-
63
- # Check/delete remote (rename from metadata later) IPA
64
-
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
77
-
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
107
- end
108
- end
109
-
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
121
-
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...")
127
- end
128
- return rsa_key
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
143
-
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
160
- end
161
- end
162
-
163
- # test
164
- Test.new.run
165
-
166
- end # class
167
- end # module