knife-packager 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "knife-packager"
7
- gem.version = "0.1.2"
7
+ gem.version = "0.1.3"
8
8
  gem.authors = ["John Dyer"]
9
9
  gem.email = ["johntdyer@gmail.com"]
10
10
  gem.description = %q{Knife pluging to deploy cookbooks to S3}
@@ -24,14 +24,22 @@ module Packager
24
24
 
25
25
  banner "knife packager"
26
26
 
27
+ option :"version-override",
28
+ :long => "--version-override VERSION",
29
+ :description => "Override version number of uploaded cookook",
30
+ :default => nil
31
+
32
+
27
33
  def run
28
- Berkshelf::Config.new
29
- @config = VoxConfig.new(Dir.pwd)
30
- @tmp = Dir.mktmpdir
31
- get_dependencies
32
- pkg = package_files
33
- upload_cookbooks(pkg)
34
- FileUtils.remove_entry_secure(@tmp)
34
+ $stdout.sync = true
35
+ @cookbook_version = get_cookbook_version(config[:"version-override"])
36
+ Berkshelf::Config.new
37
+ @config = VoxConfig.new(Dir.pwd)
38
+ @tmp = Dir.mktmpdir
39
+ get_dependencies
40
+ pkg = package_files
41
+ upload_cookbooks(pkg)
42
+ FileUtils.remove_entry_secure(@tmp)
35
43
  end
36
44
 
37
45
 
@@ -48,16 +56,20 @@ module Packager
48
56
 
49
57
  def package_files
50
58
  puts ui.highline.color "== Packaging cookbook", :green
51
- `cd #{@tmp}; tar zcf #{get_cookbook_name}.#{get_cookbook_version}.tgz ./cookbooks`
59
+ `cd #{@tmp}; tar zcf #{get_cookbook_name}.#{@cookbook_version}.tgz ./cookbooks`
52
60
  unless $?.exitstatus == 0
53
61
  puts ui.highline.color "Failed to archive cookbooks", :red
54
62
  exit 3
55
63
  end
56
- return "#{@tmp}/#{get_cookbook_name}.#{get_cookbook_version}.tgz"
64
+ return "#{@tmp}/#{get_cookbook_name}.#{@cookbook_version}.tgz"
57
65
  end
58
66
 
59
- def get_cookbook_version
60
- IO.read(Berkshelf.find_metadata).match(/^version.*/).to_s.split('"')[1]
67
+ def get_cookbook_version(params)
68
+ if params
69
+ return params
70
+ else
71
+ IO.read(Berkshelf.find_metadata).match(/^version.*/).to_s.split('"')[1]
72
+ end
61
73
  end
62
74
 
63
75
  def get_folder_name
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-packager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -136,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  segments:
138
138
  - 0
139
- hash: 1202753641670726567
139
+ hash: 785643742814886731
140
140
  required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  none: false
142
142
  requirements:
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  segments:
147
147
  - 0
148
- hash: 1202753641670726567
148
+ hash: 785643742814886731
149
149
  requirements: []
150
150
  rubyforge_project:
151
151
  rubygems_version: 1.8.23