deploygate 0.2.0 → 0.2.1
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 +8 -8
- data/config/locales/en.yml +2 -0
- data/deploygate.gemspec +4 -3
- data/lib/deploygate/command_builder.rb +23 -1
- data/lib/deploygate/commands/deploy/push.rb +1 -1
- data/lib/deploygate/session.rb +15 -0
- data/lib/deploygate/version.rb +1 -1
- data/lib/deploygate/xcode/analyze.rb +39 -4
- data/lib/deploygate/xcode/export.rb +4 -3
- data/lib/deploygate.rb +1 -0
- data/spec/deploygate/session_spec.rb +37 -0
- data/spec/spec_helper.rb +0 -2
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGFkNTU4ZTMxMzRiZDY2NjFmMjcwMDc0YWViODBjNzMyYWRiNTg1OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWQ3OWI4YjVjYTRmMTdiN2NlZGMzM2FhNGNhYThiM2YxMTJlYjE2Mg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Yzg4MmY0ZTQ2MTQzMzEzYzlkNmI5OWUyZjkzOWE1NGJmNzQ4MzRkMDZiZGU3
|
10
|
+
OGVhZmVkYTM3MjdjMTQ5NTk0N2FhMGY0NzgzYzY0MGUzNmQwM2YxYTllMGE2
|
11
|
+
NTM5ZTRjMTAxYzA3MDZjZGYyMzJmMDU0ZGE0MDQ1ZDA1ZjIxZjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTA4OGNlMmZmM2NkMGJhZmI0ZjMzMGMwNTIxNTcyMjA0YzMzOGIxODY3OGJh
|
14
|
+
YzQ2OTFiZjZkY2ZmMjRkYjkzMzg2Mjk5NDVkMjI5ZjE1ZDU1ZjU0ZjM0ZGMz
|
15
|
+
MWEyMTc3OTEzNTRlYzJiOWVlN2YzYjlkOWYyZWNlNzA5YWEwZGY=
|
data/config/locales/en.yml
CHANGED
@@ -40,6 +40,7 @@ en:
|
|
40
40
|
# It is recommended to use the latest version.
|
41
41
|
# You can update it by running 'gem update %{gem_name}'.
|
42
42
|
#################################################################
|
43
|
+
not_internet_connection_error: 'Error: Not internet connection. Please by connecting to the internet'
|
43
44
|
commands:
|
44
45
|
deploy:
|
45
46
|
build:
|
@@ -145,6 +146,7 @@ en:
|
|
145
146
|
finish: 'Finish cleaning local Provisionig Profiles'
|
146
147
|
analyze:
|
147
148
|
target_bundle_identifier:
|
149
|
+
bundle_identifier_different: 'This xcode project Bundle Identifier has been two registered. "%{plist_id}" and "%{product_id}"'
|
148
150
|
prompt: |
|
149
151
|
Please input your app bundle identifier
|
150
152
|
Example: com.example.ios
|
data/deploygate.gemspec
CHANGED
@@ -33,11 +33,12 @@ POST_INSTALL_MESSAGE
|
|
33
33
|
spec.add_dependency 'i18n'
|
34
34
|
spec.add_dependency 'launchy'
|
35
35
|
spec.add_dependency 'locale'
|
36
|
+
spec.add_dependency 'net-ping'
|
36
37
|
|
37
38
|
# ios build
|
38
|
-
spec.add_dependency 'gym', '~> 1.
|
39
|
-
spec.add_dependency 'spaceship', '~> 0.
|
40
|
-
spec.add_dependency 'sigh', '~> 1.
|
39
|
+
spec.add_dependency 'gym', '~> 1.6.2'
|
40
|
+
spec.add_dependency 'spaceship', '~> 0.23.0'
|
41
|
+
spec.add_dependency 'sigh', '~> 1.4.1'
|
41
42
|
|
42
43
|
spec.add_development_dependency "bundler", "~> 1.3"
|
43
44
|
spec.add_development_dependency "rake"
|
@@ -3,20 +3,37 @@ module DeployGate
|
|
3
3
|
include Commander::Methods
|
4
4
|
attr_reader :arguments
|
5
5
|
|
6
|
+
class NotInternetConnectionError < DeployGate::NotIssueError
|
7
|
+
end
|
8
|
+
|
9
|
+
PING_URL = 'https://deploygate.com'
|
10
|
+
|
6
11
|
LOGIN = 'login'
|
7
12
|
LOGOUT = 'logout'
|
8
13
|
DEPLOY = 'deploy'
|
9
14
|
ADD_DEVICES = 'add-devices'
|
10
15
|
CONFIG = 'config'
|
11
16
|
|
12
|
-
def
|
17
|
+
def setup
|
18
|
+
# set Ctrl-C trap
|
13
19
|
Signal.trap(:INT){
|
14
20
|
puts ''
|
15
21
|
exit 0
|
16
22
|
}
|
17
23
|
|
24
|
+
# check internet connection
|
25
|
+
unless internet_connection?
|
26
|
+
STDERR.puts HighLine.color(I18n.t('command_builder.not_internet_connection_error'), HighLine::RED)
|
27
|
+
exit
|
28
|
+
end
|
29
|
+
|
30
|
+
# check update
|
18
31
|
GithubIssueRequest::Url.config('deploygate', 'deploygate-cli')
|
19
32
|
check_update()
|
33
|
+
end
|
34
|
+
|
35
|
+
def run
|
36
|
+
setup()
|
20
37
|
|
21
38
|
program :name, I18n.t('command_builder.name')
|
22
39
|
program :version, VERSION
|
@@ -209,5 +226,10 @@ EOF
|
|
209
226
|
STDERR.puts HighLine.color(I18n.t('command_builder.show_update_message', gem_name: gem_name, latest_version: latest_version, current_version: current_version), HighLine::YELLOW)
|
210
227
|
STDERR.puts ''
|
211
228
|
end
|
229
|
+
|
230
|
+
# @return [Boolean]
|
231
|
+
def internet_connection?
|
232
|
+
Net::Ping::HTTP.new(PING_URL).ping?
|
233
|
+
end
|
212
234
|
end
|
213
235
|
end
|
data/lib/deploygate/session.rb
CHANGED
@@ -5,6 +5,11 @@ module DeployGate
|
|
5
5
|
|
6
6
|
attr_reader :name, :token
|
7
7
|
|
8
|
+
module ENVKey
|
9
|
+
DG_USER_NAME = 'DG_USER_NAME'
|
10
|
+
DG_TOKEN = 'DG_TOKEN'
|
11
|
+
end
|
12
|
+
|
8
13
|
@@login = nil
|
9
14
|
|
10
15
|
# @return [DeployGate::Session]
|
@@ -55,11 +60,21 @@ module DeployGate
|
|
55
60
|
|
56
61
|
# @return [void]
|
57
62
|
def load_setting
|
63
|
+
return if load_env
|
58
64
|
return unless Config::Credential.exist?
|
59
65
|
settings = Config::Credential.read
|
66
|
+
|
60
67
|
@name = settings['name']
|
61
68
|
@token = settings['token']
|
62
69
|
end
|
63
70
|
|
71
|
+
# @return [Boolean]
|
72
|
+
def load_env
|
73
|
+
@name = ENV[ENVKey::DG_USER_NAME]
|
74
|
+
@token = ENV[ENVKey::DG_TOKEN]
|
75
|
+
|
76
|
+
@name.present? && @token.present?
|
77
|
+
end
|
78
|
+
|
64
79
|
end
|
65
80
|
end
|
data/lib/deploygate/version.rb
CHANGED
@@ -6,6 +6,9 @@ module DeployGate
|
|
6
6
|
BASE_WORK_DIR_NAME = 'project.xcworkspace'
|
7
7
|
BUILD_CONFIGRATION = 'Release'
|
8
8
|
|
9
|
+
class BundleIdentifierDifferentError < DeployGate::NotIssueError
|
10
|
+
end
|
11
|
+
|
9
12
|
# @param [Array] workspaces
|
10
13
|
# @return [DeployGate::Xcode::Analyze]
|
11
14
|
def initialize(workspaces)
|
@@ -29,13 +32,45 @@ module DeployGate
|
|
29
32
|
def target_bundle_identifier
|
30
33
|
begin
|
31
34
|
product_name = target_product_name
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
+
product_bundle_identifier = target_build_configration.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
|
36
|
+
product_bundle_identifier = convert_bundle_identifier(product_bundle_identifier)
|
37
|
+
|
38
|
+
info_plist_file_path = target_build_configration.build_settings['INFOPLIST_FILE']
|
39
|
+
root_path = DeployGate::Xcode::Ios.project_root_path(@scheme_workspace)
|
40
|
+
plist_bundle_identifier =
|
41
|
+
File.open(File.join(root_path, info_plist_file_path)) do |file|
|
42
|
+
plist = Plist.parse_xml file.read
|
43
|
+
plist['CFBundleIdentifier']
|
44
|
+
end
|
45
|
+
plist_bundle_identifier = convert_bundle_identifier(plist_bundle_identifier)
|
46
|
+
|
47
|
+
if product_bundle_identifier != plist_bundle_identifier
|
48
|
+
raise BundleIdentifierDifferentError,
|
49
|
+
I18n.t('xcode.analyze.target_bundle_identifier.bundle_identifier_different', plist_id: plist_bundle_identifier, product_id: product_bundle_identifier)
|
50
|
+
end
|
51
|
+
|
52
|
+
bundle_identifier = product_bundle_identifier
|
53
|
+
bundle_identifier.gsub!(/\$\(PRODUCT_NAME:.+\)/, product_name)
|
54
|
+
rescue BundleIdentifierDifferentError => e
|
55
|
+
raise e
|
56
|
+
rescue => e
|
35
57
|
cli = HighLine.new
|
36
58
|
puts I18n.t('xcode.analyze.target_bundle_identifier.prompt')
|
37
|
-
|
59
|
+
bundle_identifier = cli.ask(I18n.t('xcode.analyze.target_bundle_identifier.ask')) { |q| q.validate = /^(\w+)\.(\w+).*\w$/ }
|
60
|
+
end
|
61
|
+
|
62
|
+
bundle_identifier
|
63
|
+
end
|
64
|
+
|
65
|
+
# @param [String] bundle_identifier
|
66
|
+
# @return [String]
|
67
|
+
def convert_bundle_identifier(bundle_identifier)
|
68
|
+
identifier = bundle_identifier
|
69
|
+
if match = bundle_identifier.match(/\$\((.+)\)/)
|
70
|
+
custom_id = match[1]
|
71
|
+
identifier = target_build_configration.build_settings[custom_id]
|
38
72
|
end
|
73
|
+
identifier = convert_bundle_identifier(identifier) if bundle_identifier.match(/\$\((.+)\)/)
|
39
74
|
|
40
75
|
identifier
|
41
76
|
end
|
@@ -39,15 +39,16 @@ module DeployGate
|
|
39
39
|
profiles.reject! {|profile| profile['UUID'] != uuid} unless uuid.nil?
|
40
40
|
|
41
41
|
profiles.each do |profile|
|
42
|
+
next if DateTime.now >= profile['ExpirationDate'] || !installed_certificate?(profile['Path'])
|
43
|
+
|
42
44
|
entities = profile['Entitlements']
|
43
45
|
unless entities['get-task-allow']
|
44
46
|
team_id = entities['com.apple.developer.team-identifier']
|
45
47
|
application_id = entities['application-identifier']
|
46
48
|
application_id.slice!(/^#{team_id}\./)
|
47
49
|
application_id = '.' + application_id if application_id == '*'
|
48
|
-
if bundle_identifier.match(application_id)
|
49
|
-
|
50
|
-
installed_certificate?(profile['Path'])
|
50
|
+
if match = bundle_identifier.match(application_id)
|
51
|
+
next if match[0] != bundle_identifier
|
51
52
|
|
52
53
|
local_teams.add(team_id, profile['TeamName'], profile['Path'])
|
53
54
|
end
|
data/lib/deploygate.rb
CHANGED
@@ -1,4 +1,41 @@
|
|
1
1
|
describe DeployGate::Session do
|
2
|
+
describe "use env" do
|
3
|
+
let(:name) { 'name' }
|
4
|
+
let(:env_name) { 'env_name' }
|
5
|
+
let(:token) { 'token' }
|
6
|
+
let(:env_token) { 'env_token' }
|
7
|
+
|
8
|
+
it "not set env" do
|
9
|
+
ENV[DeployGate::Session::ENVKey::DG_USER_NAME] = nil
|
10
|
+
ENV[DeployGate::Session::ENVKey::DG_TOKEN] = nil
|
11
|
+
|
12
|
+
DeployGate::Session.save(name, token)
|
13
|
+
session = DeployGate::Session.new
|
14
|
+
expect(session.name).to eq name
|
15
|
+
expect(session.token).to eq token
|
16
|
+
end
|
17
|
+
|
18
|
+
it "set env blank" do
|
19
|
+
ENV[DeployGate::Session::ENVKey::DG_USER_NAME] = ''
|
20
|
+
ENV[DeployGate::Session::ENVKey::DG_TOKEN] = ''
|
21
|
+
|
22
|
+
DeployGate::Session.save(name, token)
|
23
|
+
session = DeployGate::Session.new
|
24
|
+
expect(session.name).to eq name
|
25
|
+
expect(session.token).to eq token
|
26
|
+
end
|
27
|
+
|
28
|
+
it "set env" do
|
29
|
+
ENV[DeployGate::Session::ENVKey::DG_USER_NAME] = env_name
|
30
|
+
ENV[DeployGate::Session::ENVKey::DG_TOKEN] = env_token
|
31
|
+
|
32
|
+
DeployGate::Session.save(name, token)
|
33
|
+
session = DeployGate::Session.new
|
34
|
+
expect(session.name).to eq env_name
|
35
|
+
expect(session.token).to eq env_token
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
2
39
|
describe "#login?" do
|
3
40
|
it "call check api" do
|
4
41
|
call_check = false
|
data/spec/spec_helper.rb
CHANGED
@@ -7,8 +7,6 @@ RSpec.configure do |config|
|
|
7
7
|
config.before :each do
|
8
8
|
# config file mock
|
9
9
|
allow(DeployGate::Config::Credential).to receive(:file_path).and_return(File.join(SPEC_FILE_PATH, 'test_files/.dg/credentials'))
|
10
|
-
# config dir mock
|
11
|
-
allow(FileUtils).to receive(:mkdir_p) {}
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deploygate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- deploygate
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -192,48 +192,62 @@ dependencies:
|
|
192
192
|
- - ! '>='
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: net-ping
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ! '>='
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ! '>='
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
195
209
|
- !ruby/object:Gem::Dependency
|
196
210
|
name: gym
|
197
211
|
requirement: !ruby/object:Gem::Requirement
|
198
212
|
requirements:
|
199
213
|
- - ~>
|
200
214
|
- !ruby/object:Gem::Version
|
201
|
-
version: 1.
|
215
|
+
version: 1.6.2
|
202
216
|
type: :runtime
|
203
217
|
prerelease: false
|
204
218
|
version_requirements: !ruby/object:Gem::Requirement
|
205
219
|
requirements:
|
206
220
|
- - ~>
|
207
221
|
- !ruby/object:Gem::Version
|
208
|
-
version: 1.
|
222
|
+
version: 1.6.2
|
209
223
|
- !ruby/object:Gem::Dependency
|
210
224
|
name: spaceship
|
211
225
|
requirement: !ruby/object:Gem::Requirement
|
212
226
|
requirements:
|
213
227
|
- - ~>
|
214
228
|
- !ruby/object:Gem::Version
|
215
|
-
version: 0.
|
229
|
+
version: 0.23.0
|
216
230
|
type: :runtime
|
217
231
|
prerelease: false
|
218
232
|
version_requirements: !ruby/object:Gem::Requirement
|
219
233
|
requirements:
|
220
234
|
- - ~>
|
221
235
|
- !ruby/object:Gem::Version
|
222
|
-
version: 0.
|
236
|
+
version: 0.23.0
|
223
237
|
- !ruby/object:Gem::Dependency
|
224
238
|
name: sigh
|
225
239
|
requirement: !ruby/object:Gem::Requirement
|
226
240
|
requirements:
|
227
241
|
- - ~>
|
228
242
|
- !ruby/object:Gem::Version
|
229
|
-
version: 1.
|
243
|
+
version: 1.4.1
|
230
244
|
type: :runtime
|
231
245
|
prerelease: false
|
232
246
|
version_requirements: !ruby/object:Gem::Requirement
|
233
247
|
requirements:
|
234
248
|
- - ~>
|
235
249
|
- !ruby/object:Gem::Version
|
236
|
-
version: 1.
|
250
|
+
version: 1.4.1
|
237
251
|
- !ruby/object:Gem::Dependency
|
238
252
|
name: bundler
|
239
253
|
requirement: !ruby/object:Gem::Requirement
|