deploygate 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ea4f6b63f5d815dfdafe48ffe77075788948750
4
- data.tar.gz: 8b78a6d1b0349c865cebc44949ad246da681884f
3
+ metadata.gz: f0ca9d51938056afdd86e937f610767e6b06ac79
4
+ data.tar.gz: d14b7d8dc7432c667aeb9dddf8f7ac5f0cf8eb9a
5
5
  SHA512:
6
- metadata.gz: 7f4f98f50124b312c8711f00edab761d7e7bb54ea1db50862186a142af7fabe1f7040aa7b69a2ac6f508dc7bcd18125a0bf818b29c2cd88e23e15c26c6408874
7
- data.tar.gz: 9f5df21e0f83ff2d40c0324253c9ec50f0ebe1b0ddf6749005b2cc6a6bf972110b541a66130a93cdacbc09277c54d0b9649aeb10950e3a6fd838f4e5f2a90a29
6
+ metadata.gz: b3912ca85a734e6a69cef97d3f065140834e181cdfa83abb5350df2e638fdfd0c0dd2eb8b7c8ba9f26c97a8493fe3656b0fbb109eedd8f28b596efe1a97da712
7
+ data.tar.gz: 2c3fc20c52ed851af13ac4929898f9ec1ef2ab1cab22a7a35c69ed5c78b3b8bad1c29be40dd8cc77cac752968df8329eac74b9fec1bbf6852ab48b79d8601844
@@ -6,6 +6,7 @@ module DeployGate
6
6
 
7
7
  class << self
8
8
 
9
+ # @param [String] command
9
10
  # @param [String] file_path
10
11
  # @param [String] target_user
11
12
  # @param [String] token
@@ -14,12 +15,19 @@ module DeployGate
14
15
  # @param [Boolean] disable_notify
15
16
  # @yield Upload process block
16
17
  # @return [Hash]
17
- def upload(file_path, target_user, token, message, distribution_key, disable_notify = false, &process_block)
18
+ def upload(command, file_path, target_user, token, message, distribution_key, disable_notify = false, &process_block)
18
19
  res = nil
20
+ env_ci = ENV['CI']
19
21
  open(file_path) do |file|
20
22
  res = Base.new(token).post(
21
23
  sprintf(ENDPOINT, target_user),
22
- { :file => file , :message => message, :distribution_key => distribution_key, :disable_notify => disable_notify ? 'yes' : 'no' }) { process_block.call unless process_block.nil? }
24
+ { :file => file ,
25
+ :message => message,
26
+ :distribution_key => distribution_key,
27
+ :disable_notify => disable_notify ? 'yes' : 'no',
28
+ :dg_command => command || '',
29
+ :env_ci => env_ci
30
+ }) { process_block.call unless process_block.nil? }
23
31
  end
24
32
 
25
33
  upload_results = {
@@ -63,7 +63,7 @@ module DeployGate
63
63
  c.option '--open', I18n.t('command_builder.deploy.open')
64
64
  c.option '--disable_notify', I18n.t('command_builder.deploy.disable_notify')
65
65
  c.action do |args, options|
66
- options.default :message => '', :user => nil, :open => false, 'disable_notify' => false
66
+ options.default :message => '', :user => nil, :open => false, 'disable_notify' => false, :command => nil
67
67
  begin
68
68
  Commands::Deploy.run(args, options)
69
69
  rescue => e
@@ -83,7 +83,7 @@ module DeployGate
83
83
  c.option '--distribution-key STRING', String, I18n.t('command_builder.add_devices.distribution_key')
84
84
  c.option '--server', I18n.t('command_builder.add_devices.server.description')
85
85
  c.action do |args, options|
86
- options.default :user => nil, :server => false
86
+ options.default :user => nil, :server => false, :command => 'add_devices'
87
87
  begin
88
88
  Commands::AddDevices.run(args, options)
89
89
  rescue => e
@@ -2,6 +2,8 @@ module DeployGate
2
2
  module Commands
3
3
  module Deploy
4
4
  class Build
5
+ COMMAND = 'build'
6
+
5
7
  class << self
6
8
 
7
9
  # @param [Array] args
@@ -11,6 +13,9 @@ module DeployGate
11
13
  # android/ios build
12
14
  work_dir = args.empty? ? Dir.pwd : args.first
13
15
 
16
+ # override options command
17
+ options.command = options.command || COMMAND
18
+
14
19
  if DeployGate::Project.ios?(work_dir)
15
20
  root_path = DeployGate::Xcode::Ios.project_root_path(work_dir)
16
21
  workspaces = DeployGate::Xcode::Ios.find_workspaces(root_path)
@@ -3,6 +3,7 @@ module DeployGate
3
3
  module Deploy
4
4
  class Push
5
5
  BASE_URL = 'https://deploygate.com'
6
+ COMMAND = 'push'
6
7
 
7
8
  class << self
8
9
 
@@ -21,12 +22,13 @@ module DeployGate
21
22
  distribution_key = options.distribution_key
22
23
  open = options.open
23
24
  disable_notify = options.disable_notify
25
+ command = options.command || COMMAND
24
26
  file_path = args.first
25
27
 
26
28
  data = nil
27
29
  print I18n.t('commands.deploy.push.upload.loading', owner: owner)
28
30
  begin
29
- data = DeployGate::Deploy.push(file_path, owner, message, distribution_key, disable_notify) {
31
+ data = DeployGate::Deploy.push(command, file_path, owner, message, distribution_key, disable_notify) {
30
32
  print '.'
31
33
  sleep 0.2
32
34
  }
@@ -9,6 +9,7 @@ module DeployGate
9
9
 
10
10
  class << self
11
11
 
12
+ # @param [String] command
12
13
  # @param [String] file_path
13
14
  # @param [String] target_user
14
15
  # @param [String] message
@@ -16,15 +17,14 @@ module DeployGate
16
17
  # @param [Boolean] disable_notify
17
18
  # @yield Upload process block
18
19
  # @return [Hash]
19
- def push(file_path, target_user, message, distribution_key, disable_notify = false, &process_block)
20
+ def push(command, file_path, target_user, message, distribution_key, disable_notify = false, &process_block)
20
21
  raise NotFileExistError, 'Target file is not found' if file_path.nil? || !File.exist?(file_path)
21
22
 
22
23
  session = DeployGate::Session.new()
23
24
  raise NotLoginError, 'Must login user' unless session.login?
24
25
  token = session.token
25
26
 
26
-
27
- data = API::V1::Push.upload(file_path, target_user, token, message, distribution_key || '', disable_notify) { process_block.call unless process_block.nil? }
27
+ data = API::V1::Push.upload(command, file_path, target_user, token, message, distribution_key || '', disable_notify) { process_block.call unless process_block.nil? }
28
28
  raise UploadError, data[:message] if data[:error]
29
29
 
30
30
  data
@@ -1,3 +1,3 @@
1
1
  module DeployGate
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.2'
3
3
  end
@@ -5,13 +5,13 @@ describe DeployGate::Deploy do
5
5
  allow_any_instance_of(DeployGate::Session).to receive(:login?) { false }
6
6
 
7
7
  expect {
8
- DeployGate::Deploy.push(test_file_path, 'test', 'message', nil)
8
+ DeployGate::Deploy.push('push', test_file_path, 'test', 'message', nil)
9
9
  }.to raise_error DeployGate::Deploy::NotLoginError
10
10
  end
11
11
 
12
12
  it "NotFileExistError" do
13
13
  expect {
14
- DeployGate::Deploy.push('no_file_path', 'test', 'message', nil)
14
+ DeployGate::Deploy.push('push', 'no_file_path', 'test', 'message', nil)
15
15
  }.to raise_error DeployGate::Deploy::NotFileExistError
16
16
  end
17
17
 
@@ -20,7 +20,7 @@ describe DeployGate::Deploy do
20
20
  allow(DeployGate::API::V1::Push).to receive(:upload).and_return({:error => true, :message => 'error message'})
21
21
 
22
22
  expect {
23
- DeployGate::Deploy.push(test_file_path, 'test', 'message', nil)
23
+ DeployGate::Deploy.push('push', test_file_path, 'test', 'message', nil)
24
24
  }.to raise_error DeployGate::Deploy::UploadError
25
25
  end
26
26
  end
@@ -31,7 +31,7 @@ describe DeployGate::Deploy do
31
31
  allow_any_instance_of(DeployGate::Session).to receive(:login?) { true }
32
32
 
33
33
  expect {
34
- DeployGate::Deploy.push(test_file_path, 'test', 'message', nil)
34
+ DeployGate::Deploy.push('push', test_file_path, 'test', 'message', nil)
35
35
  }.not_to raise_error
36
36
  end
37
37
  end
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.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - deploygate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-31 00:00:00.000000000 Z
11
+ date: 2017-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json