thor-tropo 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/changelog.md +9 -1
- data/lib/thor-tropo.rb +6 -31
- metadata +1 -1
data/changelog.md
CHANGED
data/lib/thor-tropo.rb
CHANGED
@@ -22,9 +22,6 @@ module ThorTropo
|
|
22
22
|
|
23
23
|
namespace "tropo"
|
24
24
|
|
25
|
-
# class_option :called_path,
|
26
|
-
# :type => :string,
|
27
|
-
# :default => Dir.pwd
|
28
25
|
class_option :called_path,
|
29
26
|
:type => :string,
|
30
27
|
:aliases => "-d",
|
@@ -32,11 +29,6 @@ module ThorTropo
|
|
32
29
|
:desc => "Directory of your Berksfile",
|
33
30
|
:banner => "Directory of your Berksfile"
|
34
31
|
|
35
|
-
class_option :verbose,
|
36
|
-
:type => :boolean,
|
37
|
-
:aliases => "-v",
|
38
|
-
:default => false
|
39
|
-
|
40
32
|
desc "package", "Package cookbooks and upload to S3"
|
41
33
|
|
42
34
|
method_option :"version-override",
|
@@ -92,25 +84,6 @@ module ThorTropo
|
|
92
84
|
|
93
85
|
end
|
94
86
|
|
95
|
-
|
96
|
-
|
97
|
-
# def version
|
98
|
-
# OLDVERSION=`sed -n -e "s/version.*\"\(.*\)\"/\1/p" metadata.rb`
|
99
|
-
# sed -ie "s/\(version *\)\".*\"/\1\"$OLDVERSION\"/" metadata.rb
|
100
|
-
# git add metadata.rb
|
101
|
-
# end
|
102
|
-
|
103
|
-
# desc "build", "Package cookbook"
|
104
|
-
|
105
|
-
# def build
|
106
|
-
# cleanup
|
107
|
-
# run "git archive --format=tar -o #{pkg_path}/tarfile HEAD"
|
108
|
-
# run "tar rf #{pkg_path}/tarfile VERSION" # Stick VERSION in the tar
|
109
|
-
# run "gzip -9 #{pkg_path}/tarfile"
|
110
|
-
# FileUtils.mv "#{pkg_path}/tarfile.gz", artifact_path
|
111
|
-
# say "Built #{artifact_path}"
|
112
|
-
# end
|
113
|
-
|
114
87
|
no_tasks do
|
115
88
|
|
116
89
|
def upload_cookbook(local_file,path,opts={})
|
@@ -153,7 +126,7 @@ module ThorTropo
|
|
153
126
|
|
154
127
|
invoke("berkshelf:install", [], opts)
|
155
128
|
#output = File.expand_path(File.join(@tmp_dir, "#{options[:called_path].split("/")[-1]}-#{current_version}.tar.gz"))
|
156
|
-
output = File.expand_path(File.join(@tmp_dir, "#{
|
129
|
+
output = File.expand_path(File.join(@tmp_dir, "#{cookbook_name}-#{current_version}.tar.gz"))
|
157
130
|
|
158
131
|
Dir.chdir(@tmp_dir) do |dir|
|
159
132
|
tgz = Zlib::GzipWriter.new(File.open(output, 'wb'))
|
@@ -163,6 +136,10 @@ module ThorTropo
|
|
163
136
|
|
164
137
|
end
|
165
138
|
|
139
|
+
def cookbook_name
|
140
|
+
source_root.split("/")[-1]
|
141
|
+
end
|
142
|
+
|
166
143
|
def current_version
|
167
144
|
if options[:"version-override"]
|
168
145
|
options[:"version-override"]
|
@@ -185,8 +162,7 @@ module ThorTropo
|
|
185
162
|
exit 1
|
186
163
|
end
|
187
164
|
|
188
|
-
|
189
|
-
## Get the directory Thor script was called from
|
165
|
+
## Get the directory to Berksfile
|
190
166
|
def source_root
|
191
167
|
|
192
168
|
berks_path = File.expand_path(options[:called_path])
|
@@ -195,7 +171,6 @@ module ThorTropo
|
|
195
171
|
else
|
196
172
|
raise Errno::ENOENT, "#{berks_path} does not contain a Berksfile"
|
197
173
|
end
|
198
|
-
#File.expand_path(Dir.pwd)
|
199
174
|
end
|
200
175
|
|
201
176
|
def sh(cmd, dir = source_root, &block)
|