berks_to_rightscale 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/berks_to_rightscale/cli.rb +7 -4
  2. metadata +4 -4
@@ -27,13 +27,14 @@ module BerksToRightscale
27
27
  option :only, :desc => "Only cookbooks that are in these groups.", :type => :array
28
28
  option :berksfile, :banner => "PATH", :desc => "Path to a Berksfile to operate off of.", :default => File.join(Dir.pwd, ::Berkshelf::DEFAULT_FILENAME)
29
29
  option :force, :desc => "Forces the current release with the same name to be overwritten.", :type => :boolean
30
+ option :no_cleanup, :desc => "Skips the removal of the cookbooks directory and the generated tar.gz file", :type => :boolean
30
31
  option :provider, :desc => "A provider listed by list_destinations which will be used to upload the cookbook release", :required => true
31
32
  option :container, :desc => "The name of the storage container to put the release file in.", :required => true
32
33
  def release(projectname, releasename)
33
34
  output_path = ::File.join(Dir.pwd, "cookbooks")
34
35
  sym_options = {}
35
36
  options.each{|k,v| sym_options[k.to_sym] = v }
36
- final_opts = {:path => output_path, :force => false}.merge(sym_options)
37
+ final_opts = {:path => output_path, :force => false, :no_cleanup => false}.merge(sym_options)
37
38
  tarball = "#{releasename}.tar.gz"
38
39
  file_key = "#{projectname}/#{tarball}"
39
40
 
@@ -60,7 +61,7 @@ module BerksToRightscale
60
61
  meta.run
61
62
 
62
63
  puts "Creating a tarball containing the specified cookbooks"
63
- `tar -zcvf #{tarball_path} #{output_path} 2>&1`
64
+ `tar -C #{output_path} -zcvf #{tarball_path} . 2>&1`
64
65
 
65
66
  file = File.open(tarball_path, 'r')
66
67
  fog_file = container.files.create(:key => file_key, :body => file, :acl => 'public-read')
@@ -70,8 +71,10 @@ module BerksToRightscale
70
71
  puts "Released file can be found at #{fog_file.public_url}"
71
72
 
72
73
  # Cleanup
73
- #FileUtils.rm tarball if File.exist? tarball
74
- #FileUtils.rm_rf output_path if File.directory? output_path
74
+ unless final_opts[:no_cleanup]
75
+ FileUtils.rm tarball if File.exist? tarball
76
+ FileUtils.rm_rf output_path if File.directory? output_path
77
+ end
75
78
  end
76
79
 
77
80
  desc "list_destinations", "Lists all possible release locations. Basically a list of supported fog storage providers"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berks_to_rightscale
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-07 00:00:00.000000000 Z
12
+ date: 2013-01-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: berkshelf
@@ -103,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  segments:
105
105
  - 0
106
- hash: -1020438108564136549
106
+ hash: 1402169426596686547
107
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements:
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  segments:
114
114
  - 0
115
- hash: -1020438108564136549
115
+ hash: 1402169426596686547
116
116
  requirements: []
117
117
  rubyforge_project:
118
118
  rubygems_version: 1.8.24