codebase4 1.0.17 → 1.0.18

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 69d1aa0de1625370fc98a74c82c91204ccabe8ba5883f8556b41c5d5ee12618e
4
+ data.tar.gz: 364199de786d68bc7eba2b0f765b9c6a0c0303f4d52ede8fe8abf9cd39817b83
5
+ SHA512:
6
+ metadata.gz: 67b897a3c76534a083d0a59a116b8c131246ed2eda66c277061d6a6926a88639cf4c280db3fb971f636c31e758ed8c6eefa413113fa1529286112a394ec12095
7
+ data.tar.gz: d71944a8b5408e607201aa7645562f7ced2b3a44ef34dae7dc507922733a7e0f5bf2c3c0b6866c219a46e86b643b6104cd7474a292534945f31e600a9f2120d7
data/lib/codebase.rb CHANGED
@@ -6,26 +6,25 @@ require 'json'
6
6
  require 'codebase/config'
7
7
 
8
8
  module Codebase
9
-
9
+
10
10
  class << self
11
11
 
12
12
  # Return the current configuration for the current machine
13
13
  def config
14
14
  @config ||= Config.init
15
15
  end
16
-
16
+
17
17
  ## Make an HTTP request
18
18
  def request(url, data)
19
19
  uri = URI.parse(url)
20
20
  req = Net::HTTP::Post.new(uri.path)
21
21
  req.set_form_data(data, ';')
22
22
  res = Net::HTTP.new(uri.host, uri.port)
23
-
23
+
24
24
  if uri.scheme == 'https'
25
25
  res.use_ssl = true
26
- res.verify_mode = OpenSSL::SSL::VERIFY_NONE
27
26
  end
28
-
27
+
29
28
  case res = res.request(req)
30
29
  when Net::HTTPSuccess
31
30
  JSON.parse(res.body)
@@ -36,8 +35,8 @@ module Codebase
36
35
  raise "An HTTP error occured (#{res.class})"
37
36
  end
38
37
  end
39
-
38
+
40
39
  end
41
-
40
+
42
41
  end
43
42
 
@@ -16,11 +16,11 @@ namespace :codebase do
16
16
  end
17
17
 
18
18
  cmd = ["cb deploy #{previous_revision or "0000000000000000000000000000000000000000"} #{current_revision}"]
19
-
19
+
20
20
  cmd << "-s #{servers.uniq.join(',') rescue ''}"
21
21
  cmd << "-b #{branch}"
22
22
  cmd << "-e #{environment}"
23
-
23
+
24
24
  ## get the repo and project name etc...
25
25
  account, project, repo = nil, nil, nil
26
26
  case repository
@@ -39,7 +39,6 @@ namespace :codebase do
39
39
 
40
40
  cmd << "-r #{project}:#{repo}"
41
41
  cmd << "-h #{account}.codebasehq.com"
42
- cmd << "--protocol https"
43
42
 
44
43
  puts " running: #{cmd.join(' ')}"
45
44
  system(cmd.join(' ') + "; true")
@@ -47,4 +46,4 @@ namespace :codebase do
47
46
 
48
47
  after 'deploy:finished', 'codebase:log_deployment'
49
48
 
50
- end
49
+ end
data/lib/codebase/cli.rb CHANGED
@@ -2,9 +2,9 @@ require 'codebase'
2
2
 
3
3
  module Codebase
4
4
  class CLI
5
-
5
+
6
6
  class Error < StandardError; end
7
-
7
+
8
8
  def self.invoke(*args)
9
9
  command = args.shift
10
10
  cmd = self.new
@@ -22,7 +22,7 @@ module Codebase
22
22
  $stderr.puts "Invalid arguments provided for command ('#{command}')"
23
23
  Process.exit(1)
24
24
  end
25
-
25
+
26
26
  def token(account_name, token)
27
27
  Codebase.config.set(:tokens, Hash.new) unless Codebase.config.tokens.is_a?(Hash)
28
28
  Codebase.config.tokens[account_name] = token
@@ -43,10 +43,10 @@ module Codebase
43
43
  puts "Test failed, are your credentials in ~/.codebase4 correct?"
44
44
  end
45
45
  end
46
-
46
+
47
47
  def deploy(start_ref, end_ref, *options)
48
48
  options = options_to_hash(options)
49
-
49
+
50
50
  hash = {
51
51
  :start_ref => start_ref,
52
52
  :end_ref => end_ref,
@@ -54,39 +54,37 @@ module Codebase
54
54
  :servers => options['s'] || options['servers'],
55
55
  :branch => options['b'] || options['branch']
56
56
  }
57
-
57
+
58
58
  host = options['h'] || options['host']
59
59
  repo = options['r'] || options['repo']
60
-
60
+
61
61
  raise Error, "You must specify at least one server using the -s or --servers flag" if blank?(hash[:servers])
62
62
  raise Error, "You must specify the repo using the -r or --repo flag (as project:repo)" if blank?(repo)
63
63
  raise Error, "You must specify the host using the -h or --host flag" if blank?(host)
64
-
64
+
65
65
  project, repo = repo.split(':')
66
-
66
+
67
67
  puts "Sending deployment information to #{host} (project: '#{project}' repo: '#{repo}')"
68
-
68
+
69
69
  puts " Commits......: #{hash[:start_ref]} ... #{hash[:end_ref]}"
70
70
  puts " Environment..: #{hash[:environment] || '-'}"
71
71
  puts " Branch.......: #{hash[:branch] || '-'}"
72
72
  puts " Server(s)....: #{hash[:servers]}"
73
-
73
+
74
74
  token = Codebase.config.tokens.is_a?(Hash) && Codebase.config.tokens[host]
75
75
  if token.nil?
76
76
  raise Error, "This account has no token configured locally, use 'codebase token [account] [token]' to configure it"
77
77
  end
78
-
78
+
79
79
  puts " Token........: #{token[0,7]}******"
80
80
  hash[:access_token] = token
81
-
82
- protocol = options['protocol'] || 'http'
83
-
84
- Codebase.request("#{protocol}://#{host}/projects/#{project}/repositories/#{repo}/deployments/add", hash)
81
+
82
+ Codebase.request("https://#{host}/projects/#{project}/repositories/#{repo}/deployments/add", hash)
85
83
  puts "Deployment added successfully"
86
84
  end
87
85
 
88
86
  private
89
-
87
+
90
88
  def options_to_hash(options)
91
89
  hash = Hash.new
92
90
  key = nil
@@ -101,10 +99,10 @@ module Codebase
101
99
  end
102
100
  hash
103
101
  end
104
-
102
+
105
103
  def blank?(*array)
106
104
  array.any? {|a| a.nil? || a.length == 0 }
107
105
  end
108
-
106
+
109
107
  end
110
108
  end
@@ -1,6 +1,6 @@
1
1
  module Codebase
2
2
  class Config
3
-
3
+
4
4
  def self.init(path = File.join(ENV['HOME'], '.codebase4'))
5
5
  if File.exist?(path)
6
6
  self.new(path, YAML.load_file(path))
@@ -8,25 +8,25 @@ module Codebase
8
8
  self.new(path)
9
9
  end
10
10
  end
11
-
11
+
12
12
  def initialize(filename, hash = {})
13
13
  @filename = filename
14
14
  @hash = hash
15
15
  end
16
-
16
+
17
17
  def method_missing(name)
18
18
  @hash[name.to_s]
19
19
  end
20
-
20
+
21
21
  def set(name, value)
22
22
  @hash[name.to_s] = value
23
23
  save
24
24
  value
25
25
  end
26
-
26
+
27
27
  def save
28
28
  File.open(@filename, 'w') { |f| f.write(YAML.dump(@hash)) }
29
29
  end
30
-
30
+
31
31
  end
32
32
  end
@@ -12,19 +12,19 @@ Capistrano::Configuration.instance(:must_exist).load do
12
12
  end
13
13
 
14
14
  cmd = ["cb deploy #{previous_revision or "0000000000000000000000000000000000000000"} #{current_revision}"]
15
-
15
+
16
16
  set :branch, (respond_to?(:branch) ? branch : 'master')
17
-
17
+
18
18
  if respond_to?(:environment)
19
19
  set :environment, environment
20
20
  elsif respond_to?(:rails_env)
21
21
  set :environment, rails_env
22
22
  end
23
-
23
+
24
24
  cmd << "-s #{roles.values.collect{|r| r.servers}.flatten.collect{|s| s.host}.uniq.join(',') rescue ''}"
25
25
  cmd << "-b #{branch}"
26
26
  cmd << "-e #{environment}" if respond_to?(:environment)
27
-
27
+
28
28
  ## get the repo and project name etc...
29
29
  account, project, repo = nil, nil, nil
30
30
  case fetch(:repository)
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codebase4
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
5
- prerelease:
4
+ version: 1.0.18
6
5
  platform: ruby
7
6
  authors:
8
7
  - Adam Cooke
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-07-31 00:00:00.000000000 Z
11
+ date: 2018-03-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: json
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: 1.1.5
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 1.1.5
30
27
  description:
@@ -37,35 +34,33 @@ extra_rdoc_files: []
37
34
  files:
38
35
  - bin/cb
39
36
  - bin/codebase
37
+ - lib/codebase.rb
40
38
  - lib/codebase/capistrano3.rb
41
39
  - lib/codebase/cli.rb
42
40
  - lib/codebase/config.rb
43
41
  - lib/codebase/recipes.rb
44
- - lib/codebase.rb
45
42
  homepage: http://atechmedia.com
46
43
  licenses: []
44
+ metadata: {}
47
45
  post_install_message:
48
46
  rdoc_options: []
49
47
  require_paths:
50
48
  - lib
51
49
  required_ruby_version: !ruby/object:Gem::Requirement
52
- none: false
53
50
  requirements:
54
- - - ! '>='
51
+ - - ">="
55
52
  - !ruby/object:Gem::Version
56
53
  version: '0'
57
54
  required_rubygems_version: !ruby/object:Gem::Requirement
58
- none: false
59
55
  requirements:
60
- - - ! '>='
56
+ - - ">="
61
57
  - !ruby/object:Gem::Version
62
58
  version: '0'
63
59
  requirements: []
64
60
  rubyforge_project:
65
- rubygems_version: 1.8.23.2
61
+ rubygems_version: 2.7.4
66
62
  signing_key:
67
- specification_version: 3
63
+ specification_version: 4
68
64
  summary: The RubyGem for Codebase v4 Deployment Tracking (replaces previous codebase
69
65
  gems)
70
66
  test_files: []
71
- has_rdoc: false