chef_stash 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/{rash.rb → bin/rash.rb} +30 -10
- data/chef_stash.gemspec +1 -1
- data/lib/chef_stash/rash.rb +1 -1
- data/lib/chef_stash/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d32774effc4b65c56c3da123dafaf3c8439b4e86
|
4
|
+
data.tar.gz: 88065b3e7841bbceafa323b7a3e76959f1c41a75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34910cd218c521f86d50a989dcd21b3ecf6544858b63132e67c3fae355d8a08493d85f971e25a584a4d328cce8aa896119eb4ac421e648f1d1ab90f3f0ac06e7
|
7
|
+
data.tar.gz: 25ba1cb087fac0b13f3f87222f3287a8d0f8b56bdcf2c8df08c1a935c46015cf148a3dd2b0f1f7b66886e82b39ce3dd1da8c64419511c8052be56c7b42b3d118
|
data/.gitignore
CHANGED
data/{rash.rb → bin/rash.rb}
RENAMED
@@ -1,12 +1,40 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# encoding: UTF-8
|
4
|
+
#
|
5
|
+
# Author: Stefano Harding <riddopic@gmail.com>
|
6
|
+
# License: Apache License, Version 2.0
|
7
|
+
# Copyright: (C) 2014-2015 Stefano Harding
|
8
|
+
#
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
# you may not use this file except in compliance with the License.
|
11
|
+
# You may obtain a copy of the License at
|
12
|
+
#
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
#
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
# See the License for the specific language governing permissions and
|
19
|
+
# limitations under the License.
|
20
|
+
#
|
2
21
|
|
3
22
|
lib = File.expand_path('../lib', __FILE__)
|
4
23
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
24
|
|
6
|
-
require 'anemone'
|
7
25
|
require 'chef_stash'
|
8
26
|
require 'ap'
|
9
|
-
|
27
|
+
|
28
|
+
# Initializes a new repository hash or load an existing one.
|
29
|
+
#
|
30
|
+
# @param [String, Symbol] key
|
31
|
+
# name of the key
|
32
|
+
#
|
33
|
+
# @return [Hoodie::ChefStash]
|
34
|
+
def rash(url = 'http://winini.mudbox.dev', path = 'packages_3.0')
|
35
|
+
require 'chef_stash' unless defined?(ChefStash)
|
36
|
+
@rash ||= ChefStash::Rash.new(url, path)
|
37
|
+
end
|
10
38
|
|
11
39
|
url = 'http://winini.mudbox.dev/'
|
12
40
|
path = 'packages_3.0'
|
@@ -15,10 +43,6 @@ results = []
|
|
15
43
|
regex = /#{path}\/\w+.(\w+.(ini|zip)|sha256.txt)$/i
|
16
44
|
seen = []
|
17
45
|
|
18
|
-
def seen_urls
|
19
|
-
@seen_urls ||= []
|
20
|
-
end
|
21
|
-
|
22
46
|
Anemone.crawl(url, options) do |anemone|
|
23
47
|
anemone.on_pages_like(regex) do |page|
|
24
48
|
url = page.url.to_s
|
@@ -33,8 +57,6 @@ Anemone.crawl(url, options) do |anemone|
|
|
33
57
|
content = type == :ini ? 'text/inifile' : header['content-type'].first
|
34
58
|
size = ChefStash::FileSize.new(bytes).to_size(:mb).to_s
|
35
59
|
|
36
|
-
seen_urls << { url: url, modified: modified, created: created }
|
37
|
-
|
38
60
|
result = { key => { type => {
|
39
61
|
code: ChefStash::Response.code(page.code),
|
40
62
|
depth: page.depth,
|
@@ -55,5 +77,3 @@ Anemone.crawl(url, options) do |anemone|
|
|
55
77
|
ap result
|
56
78
|
end
|
57
79
|
end
|
58
|
-
|
59
|
-
ap seen_urls
|
data/chef_stash.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |gem|
|
|
31
31
|
gem.homepage = 'https://github.com/riddopic/chef_stash'
|
32
32
|
gem.license = 'Apache 2.0'
|
33
33
|
|
34
|
-
gem.require_paths = [ 'lib' ]
|
34
|
+
gem.require_paths = [ 'lib', 'bin' ]
|
35
35
|
gem.files = `git ls-files`.split("\n")
|
36
36
|
gem.test_files = `git ls-files -- {spec}/*`.split("\n")
|
37
37
|
gem.extra_rdoc_files = %w[LICENSE README.md]
|
data/lib/chef_stash/rash.rb
CHANGED
@@ -159,7 +159,7 @@ module ChefStash
|
|
159
159
|
type = File.extname(name)[1..-1].downcase.to_sym
|
160
160
|
|
161
161
|
header = page.headers
|
162
|
-
bytes = header['content-length'].first
|
162
|
+
bytes = header['content-length'].first || 0
|
163
163
|
modified = header['last-modified'].first
|
164
164
|
created = Time.now.utc.httpdate
|
165
165
|
content = type == :ini ? 'text/inifile' : header['content-type'].first
|
data/lib/chef_stash/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef_stash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Harding
|
@@ -179,6 +179,7 @@ files:
|
|
179
179
|
- LICENSE
|
180
180
|
- README.md
|
181
181
|
- Rakefile
|
182
|
+
- bin/rash.rb
|
182
183
|
- chef_stash.gemspec
|
183
184
|
- lib/chef_stash.rb
|
184
185
|
- lib/chef_stash/core_ext/hash.rb
|
@@ -190,7 +191,6 @@ files:
|
|
190
191
|
- lib/chef_stash/time_cache.rb
|
191
192
|
- lib/chef_stash/utils.rb
|
192
193
|
- lib/chef_stash/version.rb
|
193
|
-
- rash.rb
|
194
194
|
- repl.rb
|
195
195
|
homepage: https://github.com/riddopic/chef_stash
|
196
196
|
licenses:
|
@@ -200,6 +200,7 @@ post_install_message:
|
|
200
200
|
rdoc_options: []
|
201
201
|
require_paths:
|
202
202
|
- lib
|
203
|
+
- bin
|
203
204
|
required_ruby_version: !ruby/object:Gem::Requirement
|
204
205
|
requirements:
|
205
206
|
- - ">="
|