depl 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 +4 -4
- data/README.md +1 -0
- data/bin/depl +52 -17
- data/lib/depl/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4eff59033859fce127ee93cf953d43e210b340a
|
4
|
+
data.tar.gz: 9782ae13f49e5d3da1eb6a6c54f4db759fcb535e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e596864ffcc42fb63728175e2f1d1021ecbfc8c83934590d890fe7a11bc9334c9fd20903419225001dcb45af54d6a22c8e88cba6e959af481246811e40ff712
|
7
|
+
data.tar.gz: 51d1ff3eb63e8391b482ca787c97f5aa02ab8b42b7a92c061f15e11e9da0174a0b292e7ad498a077d98e9c78d5d19ed4fc90bea09cdefd6d8dcb3afb31d030ab
|
data/README.md
CHANGED
@@ -27,6 +27,7 @@ Movable Ink uses Chef to push out new code, and Chef is set up to use environmen
|
|
27
27
|
|
28
28
|
## History
|
29
29
|
|
30
|
+
* _0.0.4_ - Add --force and --quiet options; better help messages.
|
30
31
|
* _0.0.3_ - Fixed yaml dependency.
|
31
32
|
* _0.0.2_ - Updated gem description.
|
32
33
|
* _0.0.1_ - Forked from deploy_s3; initial release.
|
data/bin/depl
CHANGED
@@ -13,7 +13,7 @@ require 'colorize'
|
|
13
13
|
|
14
14
|
options = {}
|
15
15
|
|
16
|
-
options[:environment] = ARGV.
|
16
|
+
options[:environment] = ARGV.reject{|a| a =~ /^-/}.first
|
17
17
|
|
18
18
|
options[:rev] = ENV['REV']
|
19
19
|
|
@@ -27,8 +27,29 @@ optparse = OptionParser.new do |opts|
|
|
27
27
|
opts.on("-r", "--revision=REVISION", String, "Revision to deploy (can be sha, branch, etc)") do |r|
|
28
28
|
options[:rev] = r
|
29
29
|
end
|
30
|
+
|
31
|
+
opts.on("-f", "--force", "Do not ask for confirmation") do |f|
|
32
|
+
options[:force] = f
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.on("-q", "--quiet", "No stdout output (only use with --force)") do |q|
|
36
|
+
options[:quiet] = q
|
37
|
+
end
|
38
|
+
|
39
|
+
opts.on("-h", "--help", "Print this help information") do |h|
|
40
|
+
if h
|
41
|
+
puts optparse
|
42
|
+
exit 1
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
begin
|
47
|
+
optparse.parse!
|
48
|
+
rescue OptionParser::InvalidOption => e
|
49
|
+
puts e.message
|
50
|
+
puts optparse
|
51
|
+
exit 1
|
30
52
|
end
|
31
|
-
optparse.parse!
|
32
53
|
|
33
54
|
unless options[:environment]
|
34
55
|
puts "Error: environment required"
|
@@ -36,54 +57,68 @@ unless options[:environment]
|
|
36
57
|
exit 1
|
37
58
|
end
|
38
59
|
|
60
|
+
def output(*msg)
|
61
|
+
puts *msg
|
62
|
+
end
|
63
|
+
|
64
|
+
if options[:force] and options[:quiet]
|
65
|
+
def output(*msg)
|
66
|
+
# no-op
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
39
70
|
deploy = Depl::Main.new(options)
|
40
71
|
|
41
72
|
if deploy.up_to_date
|
42
|
-
|
73
|
+
output "Everything up-to-date (#{deploy.environment.green}: #{deploy.remote_sha.green})"
|
43
74
|
exit 0
|
44
75
|
end
|
45
76
|
|
46
77
|
if deploy.remote_sha.nil?
|
47
|
-
|
78
|
+
output "New deployment: #{deploy.local_sha}"
|
48
79
|
else
|
49
|
-
|
80
|
+
output "Attempting to deploy #{deploy.local_sha.bold}", ""
|
50
81
|
|
51
82
|
commits = "#{deploy.commit_count} new commit(s)".green
|
52
|
-
|
83
|
+
output "Difference of #{commits} between #{deploy.remote_sha} and #{deploy.local_sha}:", ""
|
53
84
|
|
54
85
|
if deploy.commit_count > 0
|
55
|
-
|
86
|
+
output deploy.diff.yellow, ""
|
56
87
|
else
|
57
|
-
|
88
|
+
output " There are no new commits.", ""
|
58
89
|
end
|
59
90
|
end
|
60
91
|
|
61
92
|
if deploy.older_local_sha
|
62
|
-
|
63
|
-
|
64
|
-
|
93
|
+
output "WARNING: The commit you are deploying is older than what is currently on #{deploy.environment}. Missing commits: ".bold, ""
|
94
|
+
output deploy.reverse_diff.red
|
95
|
+
output ""
|
65
96
|
end
|
66
97
|
|
67
|
-
|
98
|
+
if options[:force]
|
99
|
+
confirm = 'yes'
|
100
|
+
else
|
101
|
+
confirm = ask("Deploy #{deploy.environment}? ([y]es / [n]o / [g]ithub) : ") { |yn| yn.limit = 1, yn.validate = /([yng]|yes|no|github)/i }
|
102
|
+
end
|
68
103
|
|
69
104
|
case confirm.downcase
|
70
105
|
when 'y', 'yes'
|
71
106
|
deploy.run!
|
72
107
|
|
73
|
-
|
108
|
+
output "Deployed #{deploy.remote_sha}"
|
74
109
|
when 'g', 'github'
|
75
110
|
url = Depl::Remote.comparison(deploy.remote_sha, deploy.local_sha)
|
76
111
|
if url
|
77
112
|
if `which open`.size > 0
|
78
113
|
`open #{url}`
|
79
114
|
else
|
80
|
-
|
115
|
+
output " Github: #{url}"
|
81
116
|
end
|
82
117
|
else
|
83
|
-
|
84
|
-
|
118
|
+
output "Unrecognized repository; can't open github"
|
119
|
+
output "(try `git config --get remote.origin.url`)"
|
85
120
|
exit 1
|
86
121
|
end
|
87
122
|
when 'n', 'no'
|
88
|
-
|
123
|
+
output "Bye."
|
89
124
|
end
|
data/lib/depl/version.rb
CHANGED