batali 0.2.22 → 0.2.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/bin/batali +10 -0
- data/lib/batali/b_file.rb +5 -2
- data/lib/batali/command/cache.rb +44 -0
- data/lib/batali/command.rb +1 -0
- data/lib/batali/source/site.rb +35 -24
- data/lib/batali/tag_lines.rb +13 -0
- data/lib/batali/version.rb +1 -1
- data/lib/batali.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e2938e0db16df2660cdcc95f749013b7e59ee98
|
4
|
+
data.tar.gz: 4d03af6c43cbd88a501b7efd3fc04c031776b256
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1216d6feda21f8fa8f7db477a65e18970a55b83b77f532cd766e8b42b0f840041315db08c404d2e396591ef7796225dd968a7469f203fbc42fbc44163b7458f0
|
7
|
+
data.tar.gz: 91b90b17ec80979b8f84460d71be89b0ce2fcf6dbde3d78de3f7f7f47716b23c99f85249674192a9a1faca26e2e2fcd716316fa185dcd3bb1f2f552203271080
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# v0.2.24
|
2
|
+
* [enhancement] Add cache command for inspection and removal
|
3
|
+
* [fix] Automatically destroy and retry failed asset unpack
|
4
|
+
* [fix] Use relative path with metadata keyword
|
5
|
+
|
1
6
|
# v0.2.22
|
2
7
|
* [fix] Update chefspec integration to properly install cookbooks
|
3
8
|
|
data/bin/batali
CHANGED
@@ -6,6 +6,7 @@ Bogo::Cli::Setup.define do
|
|
6
6
|
|
7
7
|
on :v, :version, 'Print version' do
|
8
8
|
puts "batali - Cookbook Collection Manager - [Version: #{Batali::VERSION}]"
|
9
|
+
puts " - #{Batali::TAG_LINES.sample}"
|
9
10
|
exit
|
10
11
|
end
|
11
12
|
|
@@ -61,6 +62,15 @@ Bogo::Cli::Setup.define do
|
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
65
|
+
command 'cache' do
|
66
|
+
description 'Local cache management and information'
|
67
|
+
self.instance_exec(&global_opts)
|
68
|
+
on :s, 'scrub', 'Delete local cache contents'
|
69
|
+
run do |opts, args|
|
70
|
+
Batali::Command::Cache.new({:cache => opts.to_hash}, args).execute!
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
64
74
|
command 'configure' do
|
65
75
|
self.instance_exec(&global_opts)
|
66
76
|
run do |opts, args|
|
data/lib/batali/b_file.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'batali'
|
2
|
+
require 'pathname'
|
2
3
|
|
3
4
|
module Batali
|
4
5
|
|
@@ -123,10 +124,12 @@ module Batali
|
|
123
124
|
attribute :group, Group, :multiple => true, :coerce => lambda{|v| Group.new()}
|
124
125
|
attribute :cookbook, Cookbook, :multiple => true, :coerce => BFile.cookbook_coerce, :default => []
|
125
126
|
attribute :metadata, Cookbook, :coerce => lambda{ |v, b_file|
|
126
|
-
dir = File.dirname(b_file.path)
|
127
|
+
dir = Pathname.new(File.dirname(b_file.path)).relative_path_from(Pathname.new(Dir.pwd)).to_path
|
127
128
|
m_unit = Origin::Path.new(:name => 'metadata', :path => dir).units.first
|
128
129
|
ckbk = Cookbook.new(:name => m_unit.name, :version => m_unit.version, :path => dir)
|
129
|
-
b_file.cookbook.
|
130
|
+
unless(b_file.cookbook.map(&:name).include?(ckbk.name))
|
131
|
+
b_file.cookbook.push ckbk
|
132
|
+
end
|
130
133
|
ckbk
|
131
134
|
}
|
132
135
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'batali'
|
2
|
+
|
3
|
+
module Batali
|
4
|
+
class Command
|
5
|
+
|
6
|
+
# Cache management and information
|
7
|
+
class Cache < Batali::Command
|
8
|
+
|
9
|
+
# Display information from manifest
|
10
|
+
def execute!
|
11
|
+
if(opts[:scrub])
|
12
|
+
scrub!
|
13
|
+
end
|
14
|
+
ui.puts ui.color('Batali cache information:', :bold) + "\n"
|
15
|
+
display
|
16
|
+
end
|
17
|
+
|
18
|
+
# Remove all contents from local cache
|
19
|
+
def scrub!
|
20
|
+
ui.confirm "Remove all contents from local cache (#{cache_directory})"
|
21
|
+
run_action 'Scrubbing local cache' do
|
22
|
+
FileUtils.rm_rf(cache_directory)
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Display local cache information
|
28
|
+
def display
|
29
|
+
cache_size = Dir.glob(File.join(cache_directory, '**', '**', '*')).map do |path|
|
30
|
+
File.size(path) if File.file?(path)
|
31
|
+
end.compact.inject(&:+).to_i
|
32
|
+
cache_size = "#{sprintf('%.2f', ((cache_size / 1024.to_f) / 1024))}M"
|
33
|
+
[
|
34
|
+
"#{ui.color('Path:', :bold)} #{cache_directory}",
|
35
|
+
"#{ui.color('Size:', :bold)} #{cache_size}"
|
36
|
+
].each do |line|
|
37
|
+
ui.puts " #{line}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
data/lib/batali/command.rb
CHANGED
data/lib/batali/source/site.rb
CHANGED
@@ -57,37 +57,48 @@ module Batali
|
|
57
57
|
def asset
|
58
58
|
path = File.join(cache_directory, Base64.urlsafe_encode64(url))
|
59
59
|
unless(File.directory?(path))
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
:entitystore => "file:#{File.join(cache_directory, 'entitystore')}"
|
64
|
-
).get(url)
|
65
|
-
while(result.code == 302)
|
60
|
+
retried = false
|
61
|
+
begin
|
62
|
+
FileUtils.mkdir_p(path)
|
66
63
|
result = HTTP.with_cache(
|
67
64
|
:metastore => "file:#{File.join(cache_directory, 'metastore')}",
|
68
65
|
:entitystore => "file:#{File.join(cache_directory, 'entitystore')}"
|
69
|
-
).get(
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
66
|
+
).get(url)
|
67
|
+
while(result.code == 302)
|
68
|
+
result = HTTP.with_cache(
|
69
|
+
:metastore => "file:#{File.join(cache_directory, 'metastore')}",
|
70
|
+
:entitystore => "file:#{File.join(cache_directory, 'entitystore')}"
|
71
|
+
).get(result.headers['Location'])
|
74
72
|
end
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
)
|
79
|
-
ext.rewind
|
80
|
-
ext.each do |entry|
|
81
|
-
next unless entry.file?
|
82
|
-
n_path = File.join(path, entry.full_name)
|
83
|
-
FileUtils.mkdir_p(File.dirname(n_path))
|
84
|
-
File.open(n_path, 'w') do |file|
|
85
|
-
while(content = entry.read(2048))
|
86
|
-
file.write(content)
|
73
|
+
File.open(a_path = File.join(path, 'asset'), 'w') do |file|
|
74
|
+
while(content = result.body.readpartial(2048))
|
75
|
+
file.write content
|
87
76
|
end
|
88
77
|
end
|
78
|
+
ext = Gem::Package::TarReader.new(
|
79
|
+
Zlib::GzipReader.open(a_path)
|
80
|
+
)
|
81
|
+
ext.rewind
|
82
|
+
ext.each do |entry|
|
83
|
+
next unless entry.file?
|
84
|
+
n_path = File.join(path, entry.full_name)
|
85
|
+
FileUtils.mkdir_p(File.dirname(n_path))
|
86
|
+
File.open(n_path, 'w') do |file|
|
87
|
+
while(content = entry.read(2048))
|
88
|
+
file.write(content)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
FileUtils.rm(a_path)
|
93
|
+
rescue => e
|
94
|
+
FileUtils.rm_rf(path)
|
95
|
+
unless(retried)
|
96
|
+
FileUtils.mkdir_p(path)
|
97
|
+
retried = true
|
98
|
+
retry
|
99
|
+
end
|
100
|
+
raise
|
89
101
|
end
|
90
|
-
FileUtils.rm(a_path)
|
91
102
|
end
|
92
103
|
Dir.glob(File.join(path, '*')).first
|
93
104
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'batali'
|
2
|
+
|
3
|
+
module Batali
|
4
|
+
|
5
|
+
TAG_LINES = [
|
6
|
+
"I got 99 problems but a policyfile ain't one",
|
7
|
+
"Solve the way you want, not the way you're told",
|
8
|
+
"Build environments, not applications",
|
9
|
+
"DRY should be the rule, not the exception",
|
10
|
+
"Solve for the forest, not just a tree"
|
11
|
+
]
|
12
|
+
|
13
|
+
end
|
data/lib/batali/version.rb
CHANGED
data/lib/batali.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: batali
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: attribute_struct
|
@@ -195,6 +195,7 @@ files:
|
|
195
195
|
- lib/batali/b_file.rb
|
196
196
|
- lib/batali/chefspec.rb
|
197
197
|
- lib/batali/command.rb
|
198
|
+
- lib/batali/command/cache.rb
|
198
199
|
- lib/batali/command/configure.rb
|
199
200
|
- lib/batali/command/display.rb
|
200
201
|
- lib/batali/command/install.rb
|
@@ -216,6 +217,7 @@ files:
|
|
216
217
|
- lib/batali/source/git.rb
|
217
218
|
- lib/batali/source/path.rb
|
218
219
|
- lib/batali/source/site.rb
|
220
|
+
- lib/batali/tag_lines.rb
|
219
221
|
- lib/batali/unit.rb
|
220
222
|
- lib/batali/unit_loader.rb
|
221
223
|
- lib/batali/utility.rb
|