mofa 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,8 +32,7 @@ class Cookbook
32
32
  cookbook = SourceCookbook.new(cookbook_name_or_path)
33
33
  end
34
34
  rescue RuntimeError => e
35
- say e.message
36
- raise "Cookbook not found/detected!"
35
+ raise "Cookbook not found/detected: " + e.message
37
36
  end
38
37
  cookbook.token = token
39
38
  cookbook.autodetect_type
@@ -40,6 +40,9 @@ class ReleasedCookbook < Cookbook
40
40
  end
41
41
 
42
42
  def package
43
+
44
+ tar_verbose = (Mofa::CLI::option_debug) ? 'v' : ''
45
+
43
46
  mkdir_p @pkg_dir
44
47
  say "Downloading released cookbook from: #{cookbooks_url} to #{pkg_dir}/#{pkg_name}..."
45
48
  File.open("#{pkg_dir}/#{pkg_name}", "wb") do |saved_file|
@@ -48,6 +51,8 @@ class ReleasedCookbook < Cookbook
48
51
  saved_file.write(read_file.read)
49
52
  end
50
53
  end
54
+ mkdir_p "#{pkg_dir}/tmp"
55
+ run "tar x#{tar_verbose}fz #{pkg_dir}/#{pkg_name} -C #{pkg_dir}/tmp/"
51
56
  end
52
57
 
53
58
  def load_mofa_yml
@@ -76,7 +81,9 @@ class ReleasedCookbook < Cookbook
76
81
  end
77
82
 
78
83
  def recipes
79
- []
84
+ raise 'Cookbook not unpacked yet or no recipes found.' unless (Dir.exists?("#{pkg_dir}/tmp/cookbooks/#{name}/recipes"))
85
+ recipes = Dir.entries("#{pkg_dir}/tmp/cookbooks/#{name}/recipes").select { |f| f.match(/.rb$/) }
86
+ recipes.map! { |f| f.gsub(/\.rb/, '') }
80
87
  end
81
88
 
82
89
  private
@@ -1,3 +1,3 @@
1
1
  module Mofa
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mofa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
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: 2015-10-26 00:00:00.000000000 Z
12
+ date: 2015-10-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec