deploygate 0.0.3 → 0.0.4

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: 7c7a9d3a21ab949bc31c5c7193684a256bf72515
4
- data.tar.gz: a373351cda7d9ea2a43aa1bbb56aa7760c1d7a0c
3
+ metadata.gz: 4d4e48df0e61daf6cdbeed6389750ea02dc1d47c
4
+ data.tar.gz: 46dc7c9fd4c536b58aafd09665a5cef09992a366
5
5
  SHA512:
6
- metadata.gz: 810651a47faf6673824a467c50ec396983e227d2394edd286f1fb967c58f6e76f653fb764caead90b094f71545cfc9bb2f9687383cfe29e3623a958d5e3872f3
7
- data.tar.gz: d45e2210454cea075b77415f7a6bf8be863667bfcbd4bda275c5e9eb2cb1b05b57e12d38db91cfb2e5a855dd2b911625928ac44700775c387fdc4b105ccd1a92
6
+ metadata.gz: 8243028a3183bde7dfb72d265fad7d2a18c82be0a1db821b2dd8e34868b34d1621ba57fa31edaddf3418d45a904f6f01045bb5dff44596e34f4de6cd0bdbea3a
7
+ data.tar.gz: 7534091412ab6ceefd8c7920e10e5d2b5f19c9a47ab104775613582c6e783d889e8c3ff3ec03e88828af42910dff605f1a61398424966abf18e29d994489f3d5
data/deploygate.gemspec CHANGED
@@ -33,6 +33,8 @@ POST_INSTALL_MESSAGE
33
33
  spec.add_dependency 'github_issue_request', '~> 0.0.2'
34
34
  spec.add_dependency 'highline', '~> 1.7.8'
35
35
  spec.add_dependency 'uuid', '~> 2.3.8'
36
+ spec.add_dependency 'gem_update_checker', '~> 0.2.0'
37
+ spec.add_dependency 'activesupport', '~> 4.2.4'
36
38
 
37
39
  # ios build
38
40
  spec.add_dependency 'gym', '~> 1.0.0'
data/lib/deploygate.rb CHANGED
@@ -10,6 +10,8 @@ require "find"
10
10
  require "github_issue_request"
11
11
  require "highline"
12
12
  require "uuid"
13
+ require "gem_update_checker"
14
+ require "active_support/core_ext/time"
13
15
 
14
16
  # ios build
15
17
  require "gym"
@@ -23,20 +25,25 @@ end
23
25
  require "deploygate/api/v1/base"
24
26
  require "deploygate/api/v1/session"
25
27
  require "deploygate/api/v1/push"
28
+ require "deploygate/api/v1/user"
26
29
  require "deploygate/command_builder"
27
30
  require "deploygate/commands/init"
28
31
  require "deploygate/commands/logout"
29
32
  require "deploygate/commands/deploy"
30
33
  require "deploygate/commands/deploy/push"
31
34
  require "deploygate/commands/deploy/build"
32
- require "deploygate/config"
35
+ require "deploygate/config/base"
36
+ require "deploygate/config/credential"
37
+ require "deploygate/config/cache_version"
33
38
  require "deploygate/session"
34
39
  require "deploygate/deploy"
35
40
  require "deploygate/build"
41
+ require "deploygate/user"
36
42
  require "deploygate/builds/ios"
37
43
  require "deploygate/builds/ios/export"
38
44
  require "deploygate/builds/ios/analyze"
39
45
  require "deploygate/builds/ios/set_profile"
40
46
  require "deploygate/message/error"
41
47
  require "deploygate/message/success"
48
+ require "deploygate/message/warning"
42
49
  require "deploygate/version"
@@ -0,0 +1,43 @@
1
+ module DeployGate
2
+ module API
3
+ module V1
4
+ class User
5
+
6
+ ENDPOINT = '/users'
7
+
8
+ class << self
9
+ # @param [String] name
10
+ # @param [String] email
11
+ # @param [String] password
12
+ # @return [Hash]
13
+ def create(name, email, password)
14
+ res = Base.new().post(ENDPOINT, {:name => name, :email => email, :password => password})
15
+
16
+ user_create_results = {
17
+ :error => res['error'],
18
+ :message => res['because']
19
+ }
20
+
21
+ results = res['results']
22
+ unless results.nil?
23
+ user_create_results.merge!({
24
+ :name => results['user']['name'],
25
+ :token => results['api_token']
26
+ })
27
+ end
28
+
29
+ user_create_results
30
+ end
31
+
32
+ # @param [String] name
33
+ # @param [String] email
34
+ # @return [Boolean]
35
+ def registered?(name, email)
36
+ res = Base.new().get("#{ENDPOINT}/registered", {:name => name, :email => email})
37
+ res['results']['registered']
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -5,6 +5,7 @@ module DeployGate
5
5
 
6
6
  def run
7
7
  GithubIssueRequest::Url.config('deploygate', 'deploygate-cli')
8
+ check_update()
8
9
 
9
10
  program :name, 'dg'
10
11
  program :version, VERSION
@@ -17,7 +18,7 @@ module DeployGate
17
18
  begin
18
19
  Commands::Init.run
19
20
  rescue => e
20
- error_handling("Commands::Init Error: #{e.class}", create_error_issue_body(e), ['bug', 'Init'])
21
+ error_handling("Commands::Init Error: #{e.class}", create_error_issue_body(e))
21
22
  raise e
22
23
  end
23
24
  end
@@ -35,7 +36,7 @@ module DeployGate
35
36
  begin
36
37
  Commands::Deploy.run(args, options)
37
38
  rescue => e
38
- error_handling("Commands::Deploy Error: #{e.class}", create_error_issue_body(e), ['bug', 'Deploy'])
39
+ error_handling("Commands::Deploy Error: #{e.class}", create_error_issue_body(e))
39
40
  raise e
40
41
  end
41
42
  end
@@ -49,7 +50,7 @@ module DeployGate
49
50
  begin
50
51
  Commands::Logout.run
51
52
  rescue => e
52
- error_handling("Commands::Logout Error: #{e.class}", create_error_issue_body(e), ['bug', 'Logout'])
53
+ error_handling("Commands::Logout Error: #{e.class}", create_error_issue_body(e))
53
54
  raise e
54
55
  end
55
56
  end
@@ -62,6 +63,10 @@ module DeployGate
62
63
  # @return [String]
63
64
  def create_error_issue_body(error)
64
65
  return <<EOF
66
+
67
+ # Status
68
+ deploygate-cli ver #{DeployGate::VERSION}
69
+
65
70
  # Error message
66
71
  #{error.message}
67
72
 
@@ -75,11 +80,11 @@ EOF
75
80
  # @param [String] title
76
81
  # @param [String] body
77
82
  # @param [Array] labels
78
- def error_handling(title, body, labels)
83
+ def error_handling(title, body, labels = [])
79
84
  options = {
80
85
  :title => title,
81
86
  :body => body,
82
- :labels => labels.push("v#{DeployGate::VERSION}")
87
+ :labels => labels
83
88
  }
84
89
  url = GithubIssueRequest::Url.new(options).to_s
85
90
  puts ''
@@ -89,5 +94,59 @@ EOF
89
94
  end
90
95
  puts ''
91
96
  end
97
+
98
+ # @return [void]
99
+ def check_update
100
+ current_version = DeployGate::VERSION
101
+
102
+ # check cache
103
+ if DeployGate::Config::CacheVersion.exist?
104
+ data = DeployGate::Config::CacheVersion.read
105
+ if Time.parse(data['check_date']) > 1.day.ago
106
+ # cache available
107
+ latest_version = data['latest_version']
108
+ if Gem::Version.new(latest_version) > Gem::Version.new(current_version)
109
+ show_update_message(latest_version)
110
+ end
111
+ else
112
+ request_gem_update_checker
113
+ end
114
+ else
115
+ request_gem_update_checker
116
+ end
117
+ end
118
+
119
+ # @return [void]
120
+ def request_gem_update_checker
121
+ gem_name = DeployGate.name.downcase
122
+ current_version = DeployGate::VERSION
123
+
124
+ checker = GemUpdateChecker::Client.new(gem_name, current_version)
125
+ if checker.update_available
126
+ show_update_message(checker.latest_version)
127
+ end
128
+ cache_data = {
129
+ :latest_version => checker.latest_version,
130
+ :check_date => Time.now
131
+ }
132
+ DeployGate::Config::CacheVersion.write(cache_data)
133
+ end
134
+
135
+ # @param [String] latest_version
136
+ # @return [void]
137
+ def show_update_message(latest_version)
138
+ gem_name = DeployGate.name.downcase
139
+ current_version = DeployGate::VERSION
140
+ update_message =<<EOF
141
+
142
+ #################################################################
143
+ # #{gem_name} #{latest_version} is available. You are on #{current_version}.
144
+ # It is recommended to use the latest version.
145
+ # Update using 'gem update #{gem_name}'.
146
+ #################################################################
147
+
148
+ EOF
149
+ DeployGate::Message::Warning.print(update_message)
150
+ end
92
151
  end
93
152
  end
@@ -6,7 +6,7 @@ module DeployGate
6
6
  # @param [Array] args
7
7
  # @param [Commander::Command::Options] options
8
8
  def run(args, options)
9
- Init.login unless DeployGate::Session.new.login?
9
+ Init.start_login_or_create_account() unless DeployGate::Session.new.login?
10
10
 
11
11
  # push or build(android/ios)
12
12
  args.push(Dir.pwd) if args.empty?
@@ -17,6 +17,9 @@ module DeployGate
17
17
  ios(workspaces, options)
18
18
  elsif DeployGate::Build.android?(work_dir)
19
19
  # TODO: support android build
20
+ print_no_target
21
+ else
22
+ print_no_target
20
23
  end
21
24
  end
22
25
 
@@ -55,6 +58,8 @@ module DeployGate
55
58
  ipa_path = DeployGate::Builds::Ios.build(analyze, target_scheme, codesigning_identity, method)
56
59
  rescue => e
57
60
  # TODO: build error handling
61
+ use_xcode_path = `xcode-select -p`
62
+ DeployGate::Message::Error.print("Current Xcode used to build: #{use_xcode_path} (via xcode-select)")
58
63
  raise e
59
64
  end
60
65
 
@@ -141,6 +146,16 @@ EOF
141
146
 
142
147
  DeployGate::Builds::Ios::Export.select_profile(provisioning_profiles)
143
148
  end
149
+
150
+ def print_no_target
151
+ message = <<EOF
152
+
153
+ No deploy target found.
154
+ Please run on the root directory of iOS project or specify .apk/.ipa file to deploy.
155
+
156
+ EOF
157
+ DeployGate::Message::Warning.print(message)
158
+ end
144
159
  end
145
160
  end
146
161
  end
@@ -5,21 +5,33 @@ module DeployGate
5
5
 
6
6
  # @return [void]
7
7
  def run
8
- login unless Session.new().login?
8
+ start_login_or_create_account() unless Session.new().login?
9
9
 
10
10
  finish
11
11
  end
12
12
 
13
13
  # @return [void]
14
- def login
14
+ def start_login_or_create_account
15
15
  puts 'Welcome to DeployGate!'
16
16
  puts ''
17
- print 'Email: '
18
- email= STDIN.gets.chop
19
- print 'Password: '
20
- password = STDIN.noecho(&:gets).chop
17
+ email = ask("Email: ")
18
+
21
19
  puts ''
20
+ puts 'Checking for your account...'
21
+ if DeployGate::User.registered?('', email)
22
+ puts ''
23
+ password = input_password('Password: ')
24
+ puts ''
25
+ login(email, password)
26
+ else
27
+ create_account(email)
28
+ end
29
+ end
22
30
 
31
+ # @param [String] email
32
+ # @param [String] password
33
+ # @return [void]
34
+ def login(email, password)
23
35
  begin
24
36
  Session.login(email, password)
25
37
  rescue Session::LoginError => e
@@ -34,6 +46,61 @@ module DeployGate
34
46
  Message::Success.print("Hello #{session.name}!")
35
47
  end
36
48
 
49
+ # @param [String] email
50
+ # @return [void]
51
+ def create_account(email)
52
+ puts "Looks new to DeployGate. Let's set up your account, just choose your username and password."
53
+ puts ''
54
+
55
+ name = input_new_account_name()
56
+ puts ''
57
+
58
+ password = input_new_account_password()
59
+ puts ''
60
+
61
+ print 'Creating your account... '
62
+ if DeployGate::User.create(name, email, password).nil?
63
+ Message::Error.print('User create error')
64
+ Message::Error.print('Please try again')
65
+ raise 'User create error'
66
+ else
67
+ Message::Success.print('done! Your account has been set up successfully.')
68
+ login(email, password)
69
+ end
70
+ end
71
+
72
+ # @return [String]
73
+ def input_new_account_name
74
+ user_name = ask("Username: " )
75
+ print 'Checking for availability... '
76
+
77
+ if DeployGate::User.registered?(user_name, '')
78
+ Message::Error.print("Bad, #{user_name} is already used. Please try again.")
79
+ return input_new_account_name()
80
+ else
81
+ Message::Success.print("Good, #{user_name} is available.")
82
+ return user_name
83
+ end
84
+ end
85
+
86
+ # @return [String]
87
+ def input_new_account_password
88
+ password = input_password('Password: ')
89
+ secound_password = input_password('Type the same password: ')
90
+
91
+ if password == secound_password
92
+ return password
93
+ else
94
+ Message::Error.print("Password Please enter the same thing.")
95
+ return input_new_account_password()
96
+ end
97
+ end
98
+
99
+ # @return [String]
100
+ def input_password(message)
101
+ ask(message) { |q| q.echo = "*" }
102
+ end
103
+
37
104
  # @return [void]
38
105
  def finish
39
106
  Message::Success.print('Enjoy development!')
@@ -0,0 +1,36 @@
1
+ module DeployGate
2
+ module Config
3
+ class Base
4
+ class << self
5
+ def file_path
6
+ # Please override this method
7
+ raise NotImplementedError.new("You must implement #{self.class}##{__method__}")
8
+ end
9
+
10
+ # @param [Hash] config
11
+ # @return [void]
12
+ def write(config)
13
+ FileUtils.mkdir_p(File.dirname(file_path))
14
+
15
+ data = JSON.generate(config)
16
+ file = File.open(file_path, "w+")
17
+ file.print data
18
+ file.close
19
+ end
20
+
21
+ # @return [Hash]
22
+ def read
23
+ file = File.open(file_path)
24
+ data = file.read
25
+ file.close
26
+ JSON.parse(data)
27
+ end
28
+
29
+ # @return [Boolean]
30
+ def exist?
31
+ File.exist?(file_path)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,12 @@
1
+ module DeployGate
2
+ module Config
3
+ class CacheVersion < Base
4
+ class << self
5
+ # @return [String]
6
+ def file_path
7
+ File.join(ENV["HOME"], '.dg/version')
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module DeployGate
2
+ module Config
3
+ class Credential < Base
4
+ class << self
5
+ # @return [String]
6
+ def file_path
7
+ File.join(ENV["HOME"], '.dg/credentials')
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module DeployGate
2
+ module Message
3
+ class Warning
4
+ class << self
5
+ def print(message)
6
+ CE.once.ch :yellow
7
+ puts message
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -38,7 +38,7 @@ module DeployGate
38
38
  :name => name,
39
39
  :token => token
40
40
  }
41
- Config.write(settings)
41
+ Config::Credential.write(settings)
42
42
  end
43
43
 
44
44
  # @return [void]
@@ -51,8 +51,8 @@ module DeployGate
51
51
 
52
52
  # @return [void]
53
53
  def load_setting
54
- return unless Config.exist?
55
- settings = Config.read
54
+ return unless Config::Credential.exist?
55
+ settings = Config::Credential.read
56
56
  @name = settings['name']
57
57
  @token = settings['token']
58
58
  end
@@ -0,0 +1,28 @@
1
+ module DeployGate
2
+ class User
3
+ attr_reader :name
4
+
5
+ # @param [String] name
6
+ # @return [DeployGate::User]
7
+ def initialize(name)
8
+ @name = name
9
+ end
10
+
11
+ # @param [String] name
12
+ # @param [String] email
13
+ # @param [String] password
14
+ # @return [DeployGate::User]
15
+ def self.create(name, email, password)
16
+ results = DeployGate::API::V1::User.create(name, email, password)
17
+ return if results[:error]
18
+ DeployGate::User.new(results[:name])
19
+ end
20
+
21
+ # @param [String] name
22
+ # @param [String] email
23
+ # @return [Boolean]
24
+ def self.registered?(name, email)
25
+ DeployGate::API::V1::User.registered?(name, email)
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module DeployGate
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,58 @@
1
+ describe DeployGate::API::V1::User do
2
+ describe "#create" do
3
+ it "success" do
4
+ name = 'test'
5
+ email = 'email'
6
+ password = 'password'
7
+ token = 'token'
8
+ response = {
9
+ :error => false,
10
+ :because => '',
11
+ :results => {
12
+ :user => {:name => name},
13
+ :api_token => token
14
+ }
15
+ }
16
+ stub_request(:post, "#{API_ENDPOINT}/users").
17
+ to_return(:body => response.to_json)
18
+
19
+ results = DeployGate::API::V1::User.create(name, email, password)
20
+ expect(results).to eq({
21
+ :error => response[:error],
22
+ :message => response[:because],
23
+ :name => name,
24
+ :token => token
25
+ })
26
+ end
27
+ end
28
+
29
+ describe "#registered?" do
30
+ it "registered" do
31
+ name = 'test'
32
+ response = {
33
+ :error => false,
34
+ :because => '',
35
+ :results => {:registered => true}
36
+ }
37
+ stub_request(:get, "#{API_ENDPOINT}/users/registered?email=&name=#{name}").
38
+ to_return(:body => response.to_json)
39
+
40
+ result = DeployGate::API::V1::User.registered?(name, '')
41
+ expect(result).to be_truthy
42
+ end
43
+
44
+ it "not registered" do
45
+ name = 'test'
46
+ response = {
47
+ :error => false,
48
+ :because => '',
49
+ :results => {:registered => false}
50
+ }
51
+ stub_request(:get, "#{API_ENDPOINT}/users/registered?email=&name=#{name}").
52
+ to_return(:body => response.to_json)
53
+
54
+ result = DeployGate::API::V1::User.registered?(name, '')
55
+ expect(result).to be_falsey
56
+ end
57
+ end
58
+ end
@@ -1,4 +1,8 @@
1
- describe DeployGate::Config do
1
+ describe DeployGate::Config::Base do
2
+ before do
3
+ allow(DeployGate::Config::Base).to receive(:file_path).and_return(File.join(SPEC_FILE_PATH, 'test_files/.dg/base'))
4
+ end
5
+
2
6
  describe "#write" do
3
7
  it "write data" do
4
8
  write_data = {
@@ -6,9 +10,9 @@ describe DeployGate::Config do
6
10
  :token => 'token'
7
11
  }
8
12
  allow(File).to receive(:open).and_return(StringIO.new("", "w+"))
9
- DeployGate::Config.write(write_data)
13
+ DeployGate::Config::Base.write(write_data)
10
14
 
11
- file = File.open(DeployGate::Config.file_path)
15
+ file = File.open(DeployGate::Config::Base.file_path)
12
16
  expect(file.string).to eq(write_data.to_json.to_s)
13
17
  end
14
18
  end
@@ -20,7 +24,7 @@ describe DeployGate::Config do
20
24
  :token => 'token'
21
25
  }.to_json.to_s
22
26
  allow(File).to receive(:open).and_return(StringIO.new(write_data))
23
- data = DeployGate::Config.read
27
+ data = DeployGate::Config::Base.read
24
28
 
25
29
  expect(data).to eq(JSON.parse(write_data))
26
30
  end
@@ -48,7 +48,7 @@ describe DeployGate::Session do
48
48
  :token => 'token'
49
49
  }
50
50
  call_config_write_and_fix_config = false
51
- allow(DeployGate::Config).to receive(:write) { |c| call_config_write_and_fix_config = c == config_data}
51
+ allow(DeployGate::Config::Credential).to receive(:write) { |c| call_config_write_and_fix_config = c == config_data}
52
52
 
53
53
 
54
54
  DeployGate::Session.save(config_data[:name], config_data[:token])
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,7 @@ require "deploygate"
6
6
  RSpec.configure do |config|
7
7
  config.before :each do
8
8
  # config file mock
9
- allow(DeployGate::Config).to receive(:file_path).and_return(File.join(SPEC_FILE_PATH, 'test_files/.dg/credentials'))
9
+ allow(DeployGate::Config::Credential).to receive(:file_path).and_return(File.join(SPEC_FILE_PATH, 'test_files/.dg/credentials'))
10
10
  # config dir mock
11
11
  allow(FileUtils).to receive(:mkdir_p) {}
12
12
  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.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - deploygate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-29 00:00:00.000000000 Z
11
+ date: 2015-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -136,6 +136,34 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 2.3.8
139
+ - !ruby/object:Gem::Dependency
140
+ name: gem_update_checker
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.2.0
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.2.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: activesupport
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 4.2.4
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 4.2.4
139
167
  - !ruby/object:Gem::Dependency
140
168
  name: gym
141
169
  requirement: !ruby/object:Gem::Requirement
@@ -255,6 +283,7 @@ files:
255
283
  - lib/deploygate/api/v1/base.rb
256
284
  - lib/deploygate/api/v1/push.rb
257
285
  - lib/deploygate/api/v1/session.rb
286
+ - lib/deploygate/api/v1/user.rb
258
287
  - lib/deploygate/build.rb
259
288
  - lib/deploygate/builds/ios.rb
260
289
  - lib/deploygate/builds/ios/analyze.rb
@@ -266,20 +295,25 @@ files:
266
295
  - lib/deploygate/commands/deploy/push.rb
267
296
  - lib/deploygate/commands/init.rb
268
297
  - lib/deploygate/commands/logout.rb
269
- - lib/deploygate/config.rb
298
+ - lib/deploygate/config/base.rb
299
+ - lib/deploygate/config/cache_version.rb
300
+ - lib/deploygate/config/credential.rb
270
301
  - lib/deploygate/deploy.rb
271
302
  - lib/deploygate/message/error.rb
272
303
  - lib/deploygate/message/success.rb
304
+ - lib/deploygate/message/warning.rb
273
305
  - lib/deploygate/session.rb
306
+ - lib/deploygate/user.rb
274
307
  - lib/deploygate/version.rb
275
308
  - spec/deploygate/api/v1/push_spec.rb
276
309
  - spec/deploygate/api/v1/session_spec.rb
310
+ - spec/deploygate/api/v1/user_spec.rb
277
311
  - spec/deploygate/build_spec.rb
278
312
  - spec/deploygate/builds/ios/analyze_spec.rb
279
313
  - spec/deploygate/builds/ios/export_spec.rb
280
314
  - spec/deploygate/builds/ios/set_profile_spec.rb
281
315
  - spec/deploygate/builds/ios_spec.rb
282
- - spec/deploygate/config_spec.rb
316
+ - spec/deploygate/config/base_spec.rb
283
317
  - spec/deploygate/deploy_spec.rb
284
318
  - spec/deploygate/session_spec.rb
285
319
  - spec/spec_helper.rb
@@ -320,12 +354,13 @@ summary: A command-line interface for DeployGate
320
354
  test_files:
321
355
  - spec/deploygate/api/v1/push_spec.rb
322
356
  - spec/deploygate/api/v1/session_spec.rb
357
+ - spec/deploygate/api/v1/user_spec.rb
323
358
  - spec/deploygate/build_spec.rb
324
359
  - spec/deploygate/builds/ios/analyze_spec.rb
325
360
  - spec/deploygate/builds/ios/export_spec.rb
326
361
  - spec/deploygate/builds/ios/set_profile_spec.rb
327
362
  - spec/deploygate/builds/ios_spec.rb
328
- - spec/deploygate/config_spec.rb
363
+ - spec/deploygate/config/base_spec.rb
329
364
  - spec/deploygate/deploy_spec.rb
330
365
  - spec/deploygate/session_spec.rb
331
366
  - spec/spec_helper.rb
@@ -1,35 +0,0 @@
1
- module DeployGate
2
- class Config
3
- class << self
4
-
5
- # @return [String]
6
- def file_path
7
- File.join(ENV["HOME"], '.dg/credentials')
8
- end
9
-
10
- # @param [Hash] config
11
- # @return [void]
12
- def write(config)
13
- FileUtils.mkdir_p(File.dirname(file_path))
14
-
15
- data = JSON.generate(config)
16
- file = File.open(file_path, "w+")
17
- file.print data
18
- file.close
19
- end
20
-
21
- # @return [Hash]
22
- def read
23
- file = File.open(file_path)
24
- data = file.read
25
- file.close
26
- JSON.parse(data)
27
- end
28
-
29
- # @return [Boolean]
30
- def exist?
31
- File.exist?(file_path)
32
- end
33
- end
34
- end
35
- end