dply 0.1.8 → 0.1.9
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 +4 -4
- data/bin/drake +1 -1
- data/lib/dply/archive.rb +3 -2
- data/lib/dply/cli/status.rb +42 -0
- data/lib/dply/config_downloader.rb +18 -3
- data/lib/dply/release.rb +12 -0
- data/lib/dply/strategy/archive.rb +1 -1
- data/lib/dply/strategy/git.rb +1 -1
- data/lib/dply/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65bf4e5272b3c64dfeb0094ab9129ed83bb75979
|
4
|
+
data.tar.gz: 3864b9d7e108ca4e0ab479e6f5f7f4ae65a98799
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7a82d15260f094fbcf7794ad59cd7144943f5d6e0fff6111cc353e2ab9ca27d1c045c595a3b2f93ce41756cce2c849b6fee1f0d6c28ca140fcbdbe667aeb706
|
7
|
+
data.tar.gz: f4d927b29fa7b31e35e94095690e339938f9865e6254eee256b352db8985df3ac5ce7434324b4445e500cece8644d623b3b682a1132d59d150538d6ca3334aaf
|
data/bin/drake
CHANGED
@@ -71,7 +71,7 @@ begin
|
|
71
71
|
|
72
72
|
command = (ARGV.shift || "").to_sym
|
73
73
|
case command
|
74
|
-
when :deploy, :reload, :task, :build, :depcheck, :"install-pkgs", :reopen_logs
|
74
|
+
when :deploy, :reload, :task, :build, :depcheck, :"install-pkgs", :reopen_logs, :status
|
75
75
|
run_cli command, ARGV
|
76
76
|
when /\A[a-zA-Z_\-0-9]+[:][a-zA-Z_\-0-9]+\z/
|
77
77
|
require 'dply/tasks'
|
data/lib/dply/archive.rb
CHANGED
@@ -72,8 +72,9 @@ module Dply
|
|
72
72
|
def download(url, outfile)
|
73
73
|
logger.bullet "downloading #{url} to #{outfile}"
|
74
74
|
http_status = `curl -w "%{http_code}" -f -s -o '#{outfile}' '#{url}' `
|
75
|
-
|
76
|
-
|
75
|
+
exit_status = $?.existstatus
|
76
|
+
if (http_status != "200" || exit_status != 0)
|
77
|
+
error "failed to download #{outfile}, http status #{http_status}, exit_status #{exit_status}"
|
77
78
|
end
|
78
79
|
end
|
79
80
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'dply/logger'
|
2
|
+
require 'dply/release'
|
3
|
+
require 'dply/config'
|
4
|
+
|
5
|
+
module Dply
|
6
|
+
module Cli
|
7
|
+
class Status
|
8
|
+
|
9
|
+
include Logger
|
10
|
+
|
11
|
+
def initialize(argv)
|
12
|
+
@argv = argv
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
print_status
|
17
|
+
end
|
18
|
+
|
19
|
+
def print_status
|
20
|
+
r = current_release
|
21
|
+
color = r[:deployed] ? :green : :red
|
22
|
+
logger.info "#{r[:revision].send color} #{r[:project]} #{r[:branch]} #{r[:timestamp]}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def current_release
|
26
|
+
@current_release ||= begin
|
27
|
+
if File.symlink? current_dir
|
28
|
+
name = File.basename( File.readlink current_dir )
|
29
|
+
else
|
30
|
+
name = "NA"
|
31
|
+
end
|
32
|
+
Release.parse name
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def current_dir
|
37
|
+
@current_dir ||= "current"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'dply/helper'
|
2
|
+
require 'fileutils'
|
2
3
|
module Dply
|
3
4
|
class ConfigDownloader
|
4
5
|
|
@@ -12,12 +13,14 @@ module Dply
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def download_all
|
16
|
+
init_tmpdir
|
15
17
|
@config_files.each do |f|
|
16
18
|
if @skip_download.include? f
|
17
19
|
logger.debug "skipping to download file #{f}"
|
18
20
|
next
|
19
21
|
end
|
20
22
|
download f
|
23
|
+
FileUtils.mv "#{tmpdir}/#{f}", "config/#{f}"
|
21
24
|
end
|
22
25
|
end
|
23
26
|
|
@@ -26,11 +29,23 @@ module Dply
|
|
26
29
|
def download(file)
|
27
30
|
url = "#{@base_url}/#{file}"
|
28
31
|
logger.bullet "downloading #{file}"
|
29
|
-
http_status = `curl -w "%{http_code}" -f -s -o '
|
30
|
-
|
31
|
-
|
32
|
+
http_status = `curl -w "%{http_code}" -f -s -o '#{tmpdir}/#{file}' '#{url}' `
|
33
|
+
exitstatus = $?.exitstatus
|
34
|
+
if (http_status != "200" || exitstatus != 0 )
|
35
|
+
error "failed to download #{file}, http status #{http_status}, exitstatus #{exitstatus}"
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
39
|
+
def tmpdir
|
40
|
+
@tmpdir ||= "tmp/config_dl"
|
41
|
+
end
|
42
|
+
|
43
|
+
def init_tmpdir
|
44
|
+
if File.exists? tmpdir
|
45
|
+
FileUtils.rm_rf tmpdir
|
46
|
+
end
|
47
|
+
FileUtils.mkdir_p tmpdir
|
48
|
+
end
|
49
|
+
|
35
50
|
end
|
36
51
|
end
|
data/lib/dply/release.rb
CHANGED
@@ -25,6 +25,18 @@ module Dply
|
|
25
25
|
latest ? File.basename(latest) : nil
|
26
26
|
end
|
27
27
|
|
28
|
+
def self.parse(name)
|
29
|
+
arr = name.split("-")
|
30
|
+
deployed = File.exist? "releases/#{name}/.deployed"
|
31
|
+
release = {
|
32
|
+
revision: arr[0] || "NA",
|
33
|
+
project: arr[1] || "NA",
|
34
|
+
branch: arr[2] || "NA",
|
35
|
+
timestamp: arr[3] || "NA",
|
36
|
+
deployed: deployed
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
28
40
|
def initialize(revision, app_name: nil, branch: nil, url: nil)
|
29
41
|
@revision = revision
|
30
42
|
@branch = branch
|
@@ -75,7 +75,7 @@ module Dply
|
|
75
75
|
def download_configs
|
76
76
|
files = config_map.values.uniq
|
77
77
|
downloader = ConfigDownloader.new(files, config_download_url)
|
78
|
-
downloader.skip_download = config_skip_download
|
78
|
+
downloader.skip_download = config_skip_download if config_skip_download
|
79
79
|
downloader.download_all
|
80
80
|
end
|
81
81
|
|
data/lib/dply/strategy/git.rb
CHANGED
@@ -62,7 +62,7 @@ module Dply
|
|
62
62
|
def download_configs
|
63
63
|
files = config_map.values.uniq
|
64
64
|
downloader = ConfigDownloader.new(files, config_download_url)
|
65
|
-
downloader.skip_download = config_skip_download
|
65
|
+
downloader.skip_download = config_skip_download if config_skip_download
|
66
66
|
downloader.download_all
|
67
67
|
end
|
68
68
|
|
data/lib/dply/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dply
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neeraj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-elf
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- lib/dply/cli/install_pkgs.rb
|
102
102
|
- lib/dply/cli/reload.rb
|
103
103
|
- lib/dply/cli/reopen_logs.rb
|
104
|
+
- lib/dply/cli/status.rb
|
104
105
|
- lib/dply/cli/task.rb
|
105
106
|
- lib/dply/config.rb
|
106
107
|
- lib/dply/config_downloader.rb
|