berkshelf-store 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile.lock +91 -0
- data/README.md +29 -8
- data/berkshelf-store.gemspec +3 -1
- data/lib/berkshelf-store.rb +1 -0
- data/lib/berkshelf-store/backends/filesystem.rb +5 -2
- data/lib/berkshelf-store/webservice.rb +3 -3
- data/test/data/tarballs/apache2-v1.10.4-nosubdir.tar.gz +0 -0
- data/test/test_berkshelf-store_backends_filesystem.rb +11 -3
- data/ui/static/.placeholder +0 -0
- data/ui/views/catalog.erb +48 -13
- data/ui/views/doc.erb +7 -3
- data/ui/views/doc.erb~ +23 -0
- data/ui/views/upload.erb +10 -21
- data/ui/views/upload.erb~ +35 -0
- metadata +83 -89
- checksums.yaml +0 -15
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
berkshelf-store (0.3.0)
|
5
|
+
ridley
|
6
|
+
sinatra (>= 1.4.5)
|
7
|
+
sinatra-contrib (>= 1.4.2)
|
8
|
+
syslog-logger
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
addressable (2.3.6)
|
14
|
+
backports (3.6.0)
|
15
|
+
buff-config (1.0.0)
|
16
|
+
buff-extensions (~> 1.0)
|
17
|
+
varia_model (~> 0.4)
|
18
|
+
buff-extensions (1.0.0)
|
19
|
+
buff-ignore (1.1.1)
|
20
|
+
buff-ruby_engine (0.1.0)
|
21
|
+
buff-shell_out (0.1.1)
|
22
|
+
buff-ruby_engine (~> 0.1.0)
|
23
|
+
celluloid (0.16.0.pre)
|
24
|
+
timers (~> 2.0.0)
|
25
|
+
celluloid-io (0.16.0.pre)
|
26
|
+
celluloid (>= 0.16.0.pre)
|
27
|
+
nio4r (>= 1.0.0)
|
28
|
+
erubis (2.7.0)
|
29
|
+
faraday (0.9.0)
|
30
|
+
multipart-post (>= 1.2, < 3)
|
31
|
+
hashie (2.1.2)
|
32
|
+
hitimes (1.2.1)
|
33
|
+
json (1.8.1)
|
34
|
+
mixlib-authentication (1.3.0)
|
35
|
+
mixlib-log
|
36
|
+
mixlib-log (1.6.0)
|
37
|
+
multi_json (1.10.1)
|
38
|
+
multipart-post (2.0.0)
|
39
|
+
net-http-persistent (2.9.4)
|
40
|
+
nio4r (1.0.0)
|
41
|
+
rack (1.5.2)
|
42
|
+
rack-protection (1.5.3)
|
43
|
+
rack
|
44
|
+
rack-test (0.6.2)
|
45
|
+
rack (>= 1.0)
|
46
|
+
rake (10.3.2)
|
47
|
+
retryable (1.3.5)
|
48
|
+
ridley (4.0.0)
|
49
|
+
addressable
|
50
|
+
buff-config (~> 1.0)
|
51
|
+
buff-extensions (~> 1.0)
|
52
|
+
buff-ignore (~> 1.1)
|
53
|
+
buff-shell_out (~> 0.1)
|
54
|
+
celluloid (~> 0.16.0.pre)
|
55
|
+
celluloid-io (~> 0.16.0.pre)
|
56
|
+
erubis
|
57
|
+
faraday (~> 0.9.0)
|
58
|
+
hashie (>= 2.0.2, < 3.0.0)
|
59
|
+
json (>= 1.7.7)
|
60
|
+
mixlib-authentication (>= 1.3.0)
|
61
|
+
net-http-persistent (>= 2.8)
|
62
|
+
retryable
|
63
|
+
semverse (~> 1.1)
|
64
|
+
varia_model (~> 0.4)
|
65
|
+
semverse (1.1.0)
|
66
|
+
sinatra (1.4.5)
|
67
|
+
rack (~> 1.4)
|
68
|
+
rack-protection (~> 1.4)
|
69
|
+
tilt (~> 1.3, >= 1.3.4)
|
70
|
+
sinatra-contrib (1.4.2)
|
71
|
+
backports (>= 2.0)
|
72
|
+
multi_json
|
73
|
+
rack-protection
|
74
|
+
rack-test
|
75
|
+
sinatra (~> 1.4.0)
|
76
|
+
tilt (~> 1.3)
|
77
|
+
syslog-logger (1.6.8)
|
78
|
+
tilt (1.4.1)
|
79
|
+
timers (2.0.0)
|
80
|
+
hitimes
|
81
|
+
varia_model (0.4.0)
|
82
|
+
buff-extensions (~> 1.0)
|
83
|
+
hashie (>= 2.0.2, < 3.0.0)
|
84
|
+
|
85
|
+
PLATFORMS
|
86
|
+
ruby
|
87
|
+
|
88
|
+
DEPENDENCIES
|
89
|
+
berkshelf-store!
|
90
|
+
bundler
|
91
|
+
rake
|
data/README.md
CHANGED
@@ -16,10 +16,20 @@ Storage is a simple directory tree (easy to backup)
|
|
16
16
|
Status
|
17
17
|
------
|
18
18
|
|
19
|
-
|
19
|
+
* It works, basicly
|
20
|
+
* It's still a work in progress
|
21
|
+
* API is not stable
|
22
|
+
* 0.3.0 introduce an upload api modification : no more name and version in path
|
20
23
|
|
21
24
|
It is my first ruby project, any advise is welcome :)
|
22
25
|
|
26
|
+
Features
|
27
|
+
--------
|
28
|
+
|
29
|
+
* Upload API
|
30
|
+
* UI
|
31
|
+
* Syslog logging
|
32
|
+
|
23
33
|
Why would I need this ?
|
24
34
|
-----------------------
|
25
35
|
|
@@ -36,16 +46,14 @@ Yes there is berkshelf-api, but it needs a chef server :
|
|
36
46
|
Install
|
37
47
|
-------
|
38
48
|
|
39
|
-
gem
|
40
|
-
gem install berkshelf-store-*.gem
|
41
|
-
|
49
|
+
gem install berkshelf-store
|
42
50
|
|
43
51
|
Usage
|
44
52
|
-----
|
45
53
|
|
46
54
|
### Launch the deamon
|
47
55
|
|
48
|
-
Usage: berkshelf-store
|
56
|
+
Usage: berkshelf-store [options]
|
49
57
|
-D, --datadir DIRECTORY Data directory (default: ./datadir)
|
50
58
|
-T, --tmpdir DIRECTORY Tmp directory (default: ./tmpdir)
|
51
59
|
-b, --bind IP bind IP (default: 127.0.0.1)
|
@@ -59,7 +67,17 @@ Example:
|
|
59
67
|
|
60
68
|
### upload some cookbooks
|
61
69
|
|
62
|
-
|
70
|
+
bash style :
|
71
|
+
|
72
|
+
curl -F cookbook=@/path/to/the/cookbook.tgz http://localhost/v1/cookbooks
|
73
|
+
|
74
|
+
#or if your are in the cookbook :
|
75
|
+
|
76
|
+
tar cvzf - . | curl -F cookbook=@- http://localhost/v1/cookbooks
|
77
|
+
|
78
|
+
or by UI:
|
79
|
+
|
80
|
+
http://localhost/upload.html
|
63
81
|
|
64
82
|
### use it with berkshelf
|
65
83
|
|
@@ -69,15 +87,18 @@ in the berkfile:
|
|
69
87
|
|
70
88
|
cookbook "cookbookname"
|
71
89
|
|
90
|
+
### Explode available cookbooks dy ui
|
91
|
+
|
92
|
+
http://localhost/
|
93
|
+
|
72
94
|
TODO:
|
73
95
|
-----
|
74
96
|
|
75
97
|
by priority
|
76
98
|
|
77
99
|
- more Comments and tests
|
78
|
-
- cli (knife or beks plugin) for uploading
|
79
100
|
- Auth
|
80
101
|
- ACL (limit uploads by cookbook/users/groups)
|
81
|
-
-
|
102
|
+
- cli (knife or berks plugin) for uploading
|
82
103
|
- multi-tenancy ?
|
83
104
|
- clusterized/cloudified backend (mongo, S3, whatelse ?)
|
data/berkshelf-store.gemspec
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require 'berkshelf-store'
|
3
4
|
|
4
5
|
Gem::Specification.new do |s|
|
5
6
|
s.name = "berkshelf-store"
|
6
|
-
s.version =
|
7
|
+
s.version = BerkshelfStore::VERSION
|
7
8
|
s.authors = ["Guillaume Zitta"]
|
8
9
|
s.email = ["github.guillaume@zitta.fr"]
|
9
10
|
s.homepage = "https://github.com/gza/berkshelf-store"
|
@@ -23,4 +24,5 @@ Gem::Specification.new do |s|
|
|
23
24
|
s.add_dependency 'sinatra-contrib', '>=1.4.2'
|
24
25
|
|
25
26
|
s.add_development_dependency 'rake'
|
27
|
+
s.add_development_dependency 'bundler'
|
26
28
|
end
|
data/lib/berkshelf-store.rb
CHANGED
@@ -18,7 +18,7 @@ module BerkshelfStore::Backends
|
|
18
18
|
true
|
19
19
|
end
|
20
20
|
|
21
|
-
def store(content
|
21
|
+
def store(content)
|
22
22
|
data = {}
|
23
23
|
|
24
24
|
digest = Digest::SHA256.hexdigest(content)
|
@@ -39,7 +39,7 @@ module BerkshelfStore::Backends
|
|
39
39
|
end
|
40
40
|
|
41
41
|
#locate check cookbook
|
42
|
-
search_root = Dir["#{tmp_dir}/cookbook/*/metadata.rb"]
|
42
|
+
search_root = Dir["#{tmp_dir}/cookbook/*/metadata.rb", "#{tmp_dir}/cookbook/metadata.rb"]
|
43
43
|
if search_root.size != 1
|
44
44
|
return {"fail" => "tgz don't contains one and only on */metadata.rb"}
|
45
45
|
end
|
@@ -49,6 +49,8 @@ module BerkshelfStore::Backends
|
|
49
49
|
begin
|
50
50
|
cookbook = Ridley::Chef::Cookbook.from_path(cookbook_dir)
|
51
51
|
data = cookbook_data(cookbook)
|
52
|
+
name = data['name']
|
53
|
+
version = data['version']
|
52
54
|
rescue Exception => e
|
53
55
|
return {"fail" => "Information extraction failed #{e}"}
|
54
56
|
end
|
@@ -74,6 +76,7 @@ module BerkshelfStore::Backends
|
|
74
76
|
return {"fail" => "tarball store failed #{e}"}
|
75
77
|
end
|
76
78
|
|
79
|
+
FileUtils.rm_rf("#{tmp_dir}")
|
77
80
|
return data
|
78
81
|
end
|
79
82
|
|
@@ -63,10 +63,10 @@ module BerkshelfStore
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
post "/v1/cookbooks
|
67
|
-
if params.key?("cookbook")
|
66
|
+
post "/v1/cookbooks" do
|
67
|
+
if params.key?("cookbook")
|
68
68
|
storage = BerkshelfStore::Backends::Filesystem.new(settings.datadir, settings.tmpdir)
|
69
|
-
cookbook_data = storage.store(params["cookbook"][:tempfile].read
|
69
|
+
cookbook_data = storage.store(params["cookbook"][:tempfile].read)
|
70
70
|
if cookbook_data.key?('name')
|
71
71
|
json cookbook_data
|
72
72
|
else
|
Binary file
|
@@ -18,6 +18,11 @@ class BerkshelfRepoBackendsFilesystemTest < Test::Unit::TestCase
|
|
18
18
|
@test_case[:couchbase_1_2_0][:version] = '1.2.0'
|
19
19
|
@test_case[:couchbase_1_2_0][:content] = File.read("#{@tarballs}/couchbase-v1.2.0.tar.gz")
|
20
20
|
@test_case[:couchbase_1_2_0][:json] = File.read("#{@dataarbo}/cookbooks/couchbase/1.2.0/data.json")
|
21
|
+
@test_case[:apache2_1_10_4] = Hash.new
|
22
|
+
@test_case[:apache2_1_10_4][:name] = 'apache2'
|
23
|
+
@test_case[:apache2_1_10_4][:version] = '1.10.4'
|
24
|
+
@test_case[:apache2_1_10_4][:content] = File.read("#{@tarballs}/apache2-v1.10.4-nosubdir.tar.gz")
|
25
|
+
@test_case[:apache2_1_10_4][:json] = File.read("#{@dataarbo}/cookbooks/apache2/1.10.4/data.json")
|
21
26
|
end
|
22
27
|
|
23
28
|
def clean
|
@@ -37,7 +42,7 @@ class BerkshelfRepoBackendsFilesystemTest < Test::Unit::TestCase
|
|
37
42
|
#Must not exists before
|
38
43
|
assert(! File.exists?(cbdir))
|
39
44
|
|
40
|
-
result_store = repo.store(cookbook[:content]
|
45
|
+
result_store = repo.store(cookbook[:content])
|
41
46
|
|
42
47
|
assert(File.exists?(cbdir))
|
43
48
|
assert(File.exists?("#{cbdir}/#{cookbook[:name]}-#{cookbook[:version]}.tgz"))
|
@@ -48,20 +53,23 @@ class BerkshelfRepoBackendsFilesystemTest < Test::Unit::TestCase
|
|
48
53
|
generated_data = JSON.parse(File.read("#{cbdir}/data.json"))
|
49
54
|
control_data = JSON.parse(cookbook[:json])
|
50
55
|
assert_equal(control_data, generated_data)
|
56
|
+
|
57
|
+
#Ensure cleaning is done
|
58
|
+
assert(Dir["#{@tmp}/*"].size == 0)
|
51
59
|
end
|
52
60
|
end
|
53
61
|
|
54
62
|
def test_store_bad_tgz
|
55
63
|
clean()
|
56
64
|
repo=BerkshelfStore::Backends::Filesystem.new(@path,@tmp)
|
57
|
-
result_store = repo.store("this is not tgz data, hi hi"
|
65
|
+
result_store = repo.store("this is not tgz data, hi hi")
|
58
66
|
assert( result_store.key?('fail') )
|
59
67
|
end
|
60
68
|
|
61
69
|
def test_store_not_cookbook_tgz
|
62
70
|
clean()
|
63
71
|
repo=BerkshelfStore::Backends::Filesystem.new(@path,@tmp)
|
64
|
-
result_store = repo.store(File.read("#{@tarballs}/not_a_cookbook.tgz")
|
72
|
+
result_store = repo.store(File.read("#{@tarballs}/not_a_cookbook.tgz"))
|
65
73
|
assert( result_store.key?('fail') )
|
66
74
|
end
|
67
75
|
|
File without changes
|
data/ui/views/catalog.erb
CHANGED
@@ -1,20 +1,55 @@
|
|
1
1
|
<h1>Cookbook catalog</h1>
|
2
|
-
Here are cookbooks available with this in your Berksfile
|
3
|
-
<pre>
|
4
|
-
source "<%=@site_prefix%><%=@ws_prefix%>/universe"
|
5
|
-
</pre>
|
6
2
|
<div id="cookbooks"></div>
|
7
3
|
|
8
4
|
<script>
|
5
|
+
function sort_version(v_a, v_b) {
|
6
|
+
//cookbook versions are N.N.N
|
7
|
+
//Sort desc
|
8
|
+
if (v_a === v_b) { return 0; }
|
9
|
+
|
10
|
+
var a = v_a.split('.');
|
11
|
+
var b = v_b.split('.');
|
12
|
+
for (var i = 0; i < 3; ++i) {
|
13
|
+
var diff = Number(b[i]) - Number(a[i]);
|
14
|
+
if (diff != 0) { return diff };
|
15
|
+
}
|
16
|
+
console.log('sort_version('+v_a+','+v_b+') : compare fail');
|
17
|
+
return 0;
|
18
|
+
}
|
19
|
+
|
9
20
|
$.getJSON('/v1/universe', {}, function(data) {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
21
|
+
//sort cookbooks by name
|
22
|
+
var cookbooks = Object.keys(data).sort();
|
23
|
+
for (var i in cookbooks) {
|
24
|
+
var cookbook=cookbooks[i];
|
25
|
+
|
26
|
+
var cookbook_head = $('<h1>'+cookbook+'</h1>');
|
27
|
+
cookbook_head.appendTo('#cookbooks');
|
28
|
+
|
29
|
+
var versions = Object.keys(data[cookbook]).sort(sort_version);
|
30
|
+
for (var j in versions) {
|
31
|
+
var version = versions[j];
|
32
|
+
var detail = data[cookbook][version];
|
33
|
+
|
34
|
+
var version_head = $('<h2 align="right">'+version+'</h2>');
|
35
|
+
version_head.appendTo('#cookbooks');
|
36
|
+
|
37
|
+
desc=$('<dl></dl>');
|
38
|
+
$('<dt>platforms :</dt>').appendTo(desc);
|
39
|
+
$('<dd>'+JSON.stringify(detail.platforms)+'</dt>').appendTo(desc);
|
40
|
+
|
41
|
+
$('<dt>dependencies :</dt>').appendTo(desc);
|
42
|
+
$('<dd>'+JSON.stringify(detail.dependencies)+'</dt>').appendTo(desc);
|
43
|
+
|
44
|
+
$('<dt>download :</dt>').appendTo(desc);
|
45
|
+
$('<dd><a href="'+detail.location_path+'">'+detail.location_path+'</a></dt>').appendTo(desc);
|
46
|
+
desc_div=$('<div class="container highlight" style="background-color: #eee;"></div>');
|
47
|
+
desc.appendTo(desc_div);
|
48
|
+
desc_div.appendTo('#cookbooks');
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
};
|
53
|
+
};
|
18
54
|
});
|
19
|
-
});
|
20
55
|
</script>
|
data/ui/views/doc.erb
CHANGED
@@ -7,17 +7,21 @@ source "<%=@site_prefix%><%=@ws_prefix%>/universe"
|
|
7
7
|
<h2>Load cookbooks</h2>
|
8
8
|
<h3>by api</h3>
|
9
9
|
<pre>
|
10
|
-
POST <%=@site_prefix%><%=@ws_prefix%>/cookbooks
|
10
|
+
POST <%=@site_prefix%><%=@ws_prefix%>/cookbooks
|
11
11
|
|
12
12
|
with tgz content in "cookbook" param
|
13
13
|
</pre>
|
14
14
|
<h3>by curl</h3>
|
15
15
|
<pre>
|
16
|
-
curl -F cookbook=@/path/to/the/cookbook.tgz <%=@site_prefix%><%=@ws_prefix%>/cookbooks
|
16
|
+
curl -F cookbook=@/path/to/the/cookbook.tgz <%=@site_prefix%><%=@ws_prefix%>/cookbooks
|
17
|
+
</pre>
|
18
|
+
or if you are in the workdir
|
19
|
+
<pre>
|
20
|
+
tar cvzf - . | curl -F cookbook=@- <%=@site_prefix%><%=@ws_prefix%>/cookbooks
|
17
21
|
</pre>
|
18
22
|
free trick : copy a cookbook from opscode... in bash
|
19
23
|
<pre>
|
20
|
-
|
24
|
+
curl -L http://community.opscode.com/cookbooks/$cookbook/versions/${version//./_}/downloads | curl -F cookbook=@- <%=@site_prefix%><%=@ws_prefix%>/cookbooks
|
21
25
|
</pre>
|
22
26
|
<h3>by upload form</h3>
|
23
27
|
<a href="upload.html">Upload page</a>
|
data/ui/views/doc.erb~
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
<h1>Documentation</h1>
|
2
|
+
<h2>Berkshelf</h2>
|
3
|
+
Use this service as Berkshelf source :
|
4
|
+
<pre>
|
5
|
+
source "<%=@site_prefix%><%=@ws_prefix%>/universe"
|
6
|
+
</pre>
|
7
|
+
<h2>Load cookbooks</h2>
|
8
|
+
<h3>by api</h3>
|
9
|
+
<pre>
|
10
|
+
POST <%=@site_prefix%><%=@ws_prefix%>/cookbooks/$NAME/$VERSION
|
11
|
+
|
12
|
+
with tgz content in "cookbook" param
|
13
|
+
</pre>
|
14
|
+
<h3>by curl</h3>
|
15
|
+
<pre>
|
16
|
+
curl -F cookbook=@/path/to/the/cookbook.tgz <%=@site_prefix%><%=@ws_prefix%>/cookbooks/$NAME/$VERSION
|
17
|
+
</pre>
|
18
|
+
free trick : copy a cookbook from opscode... in bash
|
19
|
+
<pre>
|
20
|
+
cookbook=apt; version=2.3.10; curl -L http://community.opscode.com/cookbooks/$cookbook/versions/${version//./_}/downloads | curl -F cookbook=@- <%=@site_prefix%><%=@ws_prefix%>/cookbooks/${cookbook}/${version}
|
21
|
+
</pre>
|
22
|
+
<h3>by upload form</h3>
|
23
|
+
<a href="upload.html">Upload page</a>
|
data/ui/views/upload.erb
CHANGED
@@ -1,24 +1,16 @@
|
|
1
1
|
<br>
|
2
2
|
<link href="jquery_file_upload/css/jquery.fileupload.css" rel="stylesheet">
|
3
3
|
<form role="form" class="form-horizontal">
|
4
|
-
<div class="form-group">
|
5
|
-
<label class="col-sm-2 control-label" for="name">Cookbook name</label>
|
6
|
-
<input type="text" id="name">
|
7
|
-
</div>
|
8
|
-
<div class="form-group">
|
9
|
-
<label class="col-sm-2 control-label" for="version">Cookbook version</label>
|
10
|
-
<input type="text" id="version">
|
11
|
-
</div>
|
12
4
|
<span class="btn btn-success fileinput-button">
|
13
5
|
<i class="glyphicon glyphicon-plus"></i>
|
14
6
|
<span>Select TGZ</span>
|
15
7
|
<!-- The file input field used as target for the file upload widget -->
|
16
|
-
<input id="cookbook" type="file" name="cookbook">
|
8
|
+
<input id="cookbook" type="file" name="cookbook" multiple="">
|
17
9
|
</span>
|
18
10
|
</div>
|
19
11
|
<br>
|
20
|
-
<
|
21
|
-
</
|
12
|
+
<div id="result">
|
13
|
+
</div>
|
22
14
|
<script src="jquery_file_upload/js/vendor/jquery.ui.widget.js"></script>
|
23
15
|
<script src="jquery_file_upload/js/jquery.iframe-transport.js"></script>
|
24
16
|
<script src="jquery_file_upload/js/jquery.fileupload.js"></script>
|
@@ -26,18 +18,15 @@
|
|
26
18
|
<script>
|
27
19
|
$(function () {
|
28
20
|
$('#cookbook').fileupload({
|
29
|
-
|
30
|
-
data.url = '<%=@site_prefix%><%=@ws_prefix%>/cookbooks/'+$('input#name').val()+'/'+$('input#version').val()
|
31
|
-
if (data.autoUpload || (data.autoUpload !== false &&
|
32
|
-
$(this).fileupload('option', 'autoUpload'))) {
|
33
|
-
data.process().done(function () {
|
34
|
-
data.submit();
|
35
|
-
});
|
36
|
-
}
|
37
|
-
},
|
21
|
+
url: '<%=@site_prefix%><%=@ws_prefix%>/cookbooks',
|
38
22
|
dataType: 'json',
|
39
23
|
done: function (e, data) {
|
40
|
-
|
24
|
+
$('<h2>').text('success').appendTo('div#result')
|
25
|
+
$('<pre>').text(JSON.stringify(data.result, null, 2)).appendTo('div#result')
|
26
|
+
},
|
27
|
+
fail: function (e, data) {
|
28
|
+
$('<h2>').text('fail').appendTo('div#result')
|
29
|
+
$('<pre>').text(JSON.stringify(data.jqXHR.responseJSON.fail, null, 2)).appendTo('div#result')
|
41
30
|
}
|
42
31
|
});
|
43
32
|
});
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<br>
|
2
|
+
<link href="jquery_file_upload/css/jquery.fileupload.css" rel="stylesheet">
|
3
|
+
<form role="form" class="form-horizontal">
|
4
|
+
<span class="btn btn-success fileinput-button">
|
5
|
+
<i class="glyphicon glyphicon-plus"></i>
|
6
|
+
<span>Select TGZ</span>
|
7
|
+
<!-- The file input field used as target for the file upload widget -->
|
8
|
+
<input id="cookbook" type="file" name="cookbook" multiple="">
|
9
|
+
</span>
|
10
|
+
</div>
|
11
|
+
<br>
|
12
|
+
<div id="result">
|
13
|
+
</div>
|
14
|
+
<script src="jquery_file_upload/js/vendor/jquery.ui.widget.js"></script>
|
15
|
+
<script src="jquery_file_upload/js/jquery.iframe-transport.js"></script>
|
16
|
+
<script src="jquery_file_upload/js/jquery.fileupload.js"></script>
|
17
|
+
|
18
|
+
<script>
|
19
|
+
$(function () {
|
20
|
+
$('#cookbook').fileupload({
|
21
|
+
url: '<%=@site_prefix%><%=@ws_prefix%>/cookbooks',
|
22
|
+
dataType: 'json',
|
23
|
+
done: function (e, data) {
|
24
|
+
$('<h2>').text('success').appendTo('div#result')
|
25
|
+
$('<pre>').text(JSON.stringify(data.result, null, 2)).appendTo('div#result')
|
26
|
+
},
|
27
|
+
fail: function (e, data) {
|
28
|
+
$('<h2>').text('fail').appendTo('div#result')
|
29
|
+
$('<pre>').text(JSON.stringify(data.jqXHR.responseJSON.fail, null, 2)).appendTo('div#result')
|
30
|
+
}
|
31
|
+
});
|
32
|
+
});
|
33
|
+
|
34
|
+
</script>
|
35
|
+
|
metadata
CHANGED
@@ -1,85 +1,82 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berkshelf-store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Guillaume Zitta
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: syslog-logger
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &3885700 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
|
-
version_requirements:
|
23
|
-
requirements:
|
24
|
-
- - ! '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
24
|
+
version_requirements: *3885700
|
27
25
|
- !ruby/object:Gem::Dependency
|
28
26
|
name: ridley
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &3885160 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
30
29
|
requirements:
|
31
30
|
- - ! '>='
|
32
31
|
- !ruby/object:Gem::Version
|
33
32
|
version: '0'
|
34
33
|
type: :runtime
|
35
34
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
requirements:
|
38
|
-
- - ! '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
35
|
+
version_requirements: *3885160
|
41
36
|
- !ruby/object:Gem::Dependency
|
42
37
|
name: sinatra
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &3884340 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
44
40
|
requirements:
|
45
41
|
- - ! '>='
|
46
42
|
- !ruby/object:Gem::Version
|
47
43
|
version: 1.4.5
|
48
44
|
type: :runtime
|
49
45
|
prerelease: false
|
50
|
-
version_requirements:
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 1.4.5
|
46
|
+
version_requirements: *3884340
|
55
47
|
- !ruby/object:Gem::Dependency
|
56
48
|
name: sinatra-contrib
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &3883560 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 1.4.2
|
62
55
|
type: :runtime
|
63
56
|
prerelease: false
|
64
|
-
version_requirements:
|
65
|
-
requirements:
|
66
|
-
- - ! '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 1.4.2
|
57
|
+
version_requirements: *3883560
|
69
58
|
- !ruby/object:Gem::Dependency
|
70
59
|
name: rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirement: &3882960 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
72
62
|
requirements:
|
73
63
|
- - ! '>='
|
74
64
|
- !ruby/object:Gem::Version
|
75
65
|
version: '0'
|
76
66
|
type: :development
|
77
67
|
prerelease: false
|
78
|
-
version_requirements:
|
68
|
+
version_requirements: *3882960
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: &3882280 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
79
73
|
requirements:
|
80
74
|
- - ! '>='
|
81
75
|
- !ruby/object:Gem::Version
|
82
76
|
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *3882280
|
83
80
|
description: A cookbook store based on the berkshelf API
|
84
81
|
email:
|
85
82
|
- github.guillaume@zitta.fr
|
@@ -90,6 +87,7 @@ extra_rdoc_files: []
|
|
90
87
|
files:
|
91
88
|
- .gitignore
|
92
89
|
- Gemfile
|
90
|
+
- Gemfile.lock
|
93
91
|
- README.md
|
94
92
|
- Rakefile
|
95
93
|
- berkshelf-store.gemspec
|
@@ -102,109 +100,105 @@ files:
|
|
102
100
|
- test/data/arbo/cookbooks/couchbase/1.1.0/data.json
|
103
101
|
- test/data/arbo/cookbooks/couchbase/1.2.0/data.json
|
104
102
|
- test/data/catalog.json
|
103
|
+
- test/data/tarballs/apache2-v1.10.4-nosubdir.tar.gz
|
105
104
|
- test/data/tarballs/apache2-v1.10.4.tar.gz
|
106
105
|
- test/data/tarballs/couchbase-v1.1.0.tar.gz
|
107
106
|
- test/data/tarballs/couchbase-v1.2.0.tar.gz
|
108
107
|
- test/data/tarballs/not_a_cookbook.tgz
|
109
108
|
- test/test_berkshelf-store_backends_filesystem.rb
|
109
|
+
- ui/static/.placeholder
|
110
110
|
- ui/views/catalog.erb
|
111
111
|
- ui/views/doc.erb
|
112
112
|
- ui/views/layout.erb
|
113
113
|
- ui/views/upload.erb
|
114
|
-
- ui/
|
115
|
-
- ui/
|
116
|
-
- ui/static/
|
117
|
-
- ui/static/
|
118
|
-
- ui/static/bootstrap/css/bootstrap.css.map
|
119
|
-
- ui/static/bootstrap/css/bootstrap-theme.min.css
|
120
|
-
- ui/static/bootstrap/css/bootstrap-theme.css
|
121
|
-
- ui/static/bootstrap/css/bootstrap.css
|
122
|
-
- ui/static/bootstrap/fonts/glyphicons-halflings-regular.woff
|
123
|
-
- ui/static/bootstrap/fonts/glyphicons-halflings-regular.eot
|
124
|
-
- ui/static/bootstrap/fonts/glyphicons-halflings-regular.svg
|
125
|
-
- ui/static/bootstrap/fonts/glyphicons-halflings-regular.ttf
|
126
|
-
- ui/static/jquery_file_upload/index.html
|
127
|
-
- ui/static/jquery_file_upload/Gruntfile.js
|
128
|
-
- ui/static/jquery_file_upload/angularjs.html
|
129
|
-
- ui/static/jquery_file_upload/blueimp-file-upload.jquery.json
|
130
|
-
- ui/static/jquery_file_upload/basic-plus.html
|
131
|
-
- ui/static/jquery_file_upload/js/jquery.fileupload-jquery-ui.js
|
132
|
-
- ui/static/jquery_file_upload/js/vendor/jquery.ui.widget.js
|
133
|
-
- ui/static/jquery_file_upload/js/jquery.fileupload-process.js
|
134
|
-
- ui/static/jquery_file_upload/js/jquery.iframe-transport.js
|
135
|
-
- ui/static/jquery_file_upload/js/jquery.fileupload-ui.js
|
114
|
+
- ui/views/doc.erb~
|
115
|
+
- ui/views/upload.erb~
|
116
|
+
- ui/static/jquery_file_upload/README.md
|
117
|
+
- ui/static/jquery_file_upload/package.json
|
136
118
|
- ui/static/jquery_file_upload/js/jquery.fileupload-video.js
|
119
|
+
- ui/static/jquery_file_upload/js/jquery.fileupload-audio.js
|
137
120
|
- ui/static/jquery_file_upload/js/jquery.fileupload-image.js
|
138
|
-
- ui/static/jquery_file_upload/js/app.js
|
139
|
-
- ui/static/jquery_file_upload/js/jquery.fileupload.js
|
140
121
|
- ui/static/jquery_file_upload/js/jquery.fileupload-angular.js
|
141
|
-
- ui/static/jquery_file_upload/js/
|
122
|
+
- ui/static/jquery_file_upload/js/app.js
|
142
123
|
- ui/static/jquery_file_upload/js/cors/jquery.xdr-transport.js
|
143
124
|
- ui/static/jquery_file_upload/js/cors/jquery.postmessage-transport.js
|
144
|
-
- ui/static/jquery_file_upload/js/jquery.fileupload-audio.js
|
145
125
|
- ui/static/jquery_file_upload/js/main.js
|
146
|
-
- ui/static/jquery_file_upload/
|
147
|
-
- ui/static/jquery_file_upload/
|
126
|
+
- ui/static/jquery_file_upload/js/jquery.fileupload-process.js
|
127
|
+
- ui/static/jquery_file_upload/js/jquery.fileupload-ui.js
|
128
|
+
- ui/static/jquery_file_upload/js/jquery.fileupload-jquery-ui.js
|
129
|
+
- ui/static/jquery_file_upload/js/jquery.fileupload-validate.js
|
130
|
+
- ui/static/jquery_file_upload/js/jquery.iframe-transport.js
|
131
|
+
- ui/static/jquery_file_upload/js/vendor/jquery.ui.widget.js
|
132
|
+
- ui/static/jquery_file_upload/js/jquery.fileupload.js
|
133
|
+
- ui/static/jquery_file_upload/server/php/UploadHandler.php
|
134
|
+
- ui/static/jquery_file_upload/server/php/index.php
|
148
135
|
- ui/static/jquery_file_upload/server/node/package.json
|
149
136
|
- ui/static/jquery_file_upload/server/node/server.js
|
137
|
+
- ui/static/jquery_file_upload/server/gae-python/app.yaml
|
138
|
+
- ui/static/jquery_file_upload/server/gae-python/static/favicon.ico
|
139
|
+
- ui/static/jquery_file_upload/server/gae-python/static/robots.txt
|
140
|
+
- ui/static/jquery_file_upload/server/gae-python/main.py
|
141
|
+
- ui/static/jquery_file_upload/server/gae-go/app.yaml
|
150
142
|
- ui/static/jquery_file_upload/server/gae-go/static/favicon.ico
|
151
143
|
- ui/static/jquery_file_upload/server/gae-go/static/robots.txt
|
152
144
|
- ui/static/jquery_file_upload/server/gae-go/app/main.go
|
153
|
-
- ui/static/jquery_file_upload/
|
154
|
-
- ui/static/jquery_file_upload/
|
155
|
-
- ui/static/jquery_file_upload/
|
156
|
-
- ui/static/jquery_file_upload/server/gae-python/static/robots.txt
|
157
|
-
- ui/static/jquery_file_upload/server/gae-python/app.yaml
|
158
|
-
- ui/static/jquery_file_upload/server/php/index.php
|
159
|
-
- ui/static/jquery_file_upload/server/php/UploadHandler.php
|
160
|
-
- ui/static/jquery_file_upload/README.md
|
161
|
-
- ui/static/jquery_file_upload/bower.json
|
162
|
-
- ui/static/jquery_file_upload/CONTRIBUTING.md
|
163
|
-
- ui/static/jquery_file_upload/basic.html
|
164
|
-
- ui/static/jquery_file_upload/img/loading.gif
|
165
|
-
- ui/static/jquery_file_upload/img/progressbar.gif
|
166
|
-
- ui/static/jquery_file_upload/css/jquery.fileupload.css
|
167
|
-
- ui/static/jquery_file_upload/css/jquery.fileupload-ui.css
|
168
|
-
- ui/static/jquery_file_upload/css/demo-ie8.css
|
169
|
-
- ui/static/jquery_file_upload/css/style.css
|
145
|
+
- ui/static/jquery_file_upload/angularjs.html
|
146
|
+
- ui/static/jquery_file_upload/jquery-ui.html
|
147
|
+
- ui/static/jquery_file_upload/index.html
|
170
148
|
- ui/static/jquery_file_upload/css/jquery.fileupload-ui-noscript.css
|
171
|
-
- ui/static/jquery_file_upload/css/
|
149
|
+
- ui/static/jquery_file_upload/css/jquery.fileupload-ui.css
|
172
150
|
- ui/static/jquery_file_upload/css/jquery.fileupload-noscript.css
|
151
|
+
- ui/static/jquery_file_upload/css/jquery.fileupload.css
|
152
|
+
- ui/static/jquery_file_upload/css/demo.css
|
153
|
+
- ui/static/jquery_file_upload/css/style.css
|
154
|
+
- ui/static/jquery_file_upload/css/demo-ie8.css
|
155
|
+
- ui/static/jquery_file_upload/CONTRIBUTING.md
|
156
|
+
- ui/static/jquery_file_upload/basic.html
|
173
157
|
- ui/static/jquery_file_upload/cors/result.html
|
174
158
|
- ui/static/jquery_file_upload/cors/postmessage.html
|
175
|
-
- ui/static/jquery_file_upload/
|
176
|
-
- ui/static/jquery_file_upload/
|
159
|
+
- ui/static/jquery_file_upload/blueimp-file-upload.jquery.json
|
160
|
+
- ui/static/jquery_file_upload/bower.json
|
161
|
+
- ui/static/jquery_file_upload/img/loading.gif
|
162
|
+
- ui/static/jquery_file_upload/img/progressbar.gif
|
163
|
+
- ui/static/jquery_file_upload/Gruntfile.js
|
164
|
+
- ui/static/jquery_file_upload/test/index.html
|
165
|
+
- ui/static/jquery_file_upload/test/test.js
|
166
|
+
- ui/static/jquery_file_upload/basic-plus.html
|
167
|
+
- ui/static/bootstrap/js/bootstrap.js
|
168
|
+
- ui/static/bootstrap/js/bootstrap.min.js
|
169
|
+
- ui/static/bootstrap/fonts/glyphicons-halflings-regular.woff
|
170
|
+
- ui/static/bootstrap/fonts/glyphicons-halflings-regular.ttf
|
171
|
+
- ui/static/bootstrap/fonts/glyphicons-halflings-regular.svg
|
172
|
+
- ui/static/bootstrap/fonts/glyphicons-halflings-regular.eot
|
173
|
+
- ui/static/bootstrap/css/bootstrap.css.map
|
174
|
+
- ui/static/bootstrap/css/bootstrap.css
|
175
|
+
- ui/static/bootstrap/css/bootstrap-theme.min.css
|
176
|
+
- ui/static/bootstrap/css/bootstrap.min.css
|
177
|
+
- ui/static/bootstrap/css/bootstrap-theme.css.map
|
178
|
+
- ui/static/bootstrap/css/bootstrap-theme.css
|
177
179
|
- ui/static/jquery/jquery.min.js
|
178
180
|
homepage: https://github.com/gza/berkshelf-store
|
179
181
|
licenses: []
|
180
|
-
metadata: {}
|
181
182
|
post_install_message:
|
182
183
|
rdoc_options: []
|
183
184
|
require_paths:
|
184
185
|
- lib
|
185
186
|
required_ruby_version: !ruby/object:Gem::Requirement
|
187
|
+
none: false
|
186
188
|
requirements:
|
187
189
|
- - ! '>='
|
188
190
|
- !ruby/object:Gem::Version
|
189
191
|
version: '0'
|
190
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
191
194
|
requirements:
|
192
195
|
- - ! '>='
|
193
196
|
- !ruby/object:Gem::Version
|
194
197
|
version: '0'
|
195
198
|
requirements: []
|
196
199
|
rubyforge_project: berkshelf-store
|
197
|
-
rubygems_version:
|
200
|
+
rubygems_version: 1.8.11
|
198
201
|
signing_key:
|
199
|
-
specification_version:
|
202
|
+
specification_version: 3
|
200
203
|
summary: A cookbook store based on the berkshelf API
|
201
|
-
test_files:
|
202
|
-
- test/data/arbo/cookbooks/apache2/1.10.4/data.json
|
203
|
-
- test/data/arbo/cookbooks/couchbase/1.1.0/data.json
|
204
|
-
- test/data/arbo/cookbooks/couchbase/1.2.0/data.json
|
205
|
-
- test/data/catalog.json
|
206
|
-
- test/data/tarballs/apache2-v1.10.4.tar.gz
|
207
|
-
- test/data/tarballs/couchbase-v1.1.0.tar.gz
|
208
|
-
- test/data/tarballs/couchbase-v1.2.0.tar.gz
|
209
|
-
- test/data/tarballs/not_a_cookbook.tgz
|
210
|
-
- test/test_berkshelf-store_backends_filesystem.rb
|
204
|
+
test_files: []
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
OWQ4NTk2YzFkM2Q5NDg5Y2Y1YTRhODIxYzM1ZjIwNDM1ZjkzYzVjNg==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MmMzMTQ2N2ZlMTQ4MmVkMTg1MDA0MWUwODYyNmM1ZWFjNDMyODVkMw==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MzAxMzljYTA1MWQ4N2I1ZWJkMjhmNjU5MWFjMThkYTZhNTJmMGRiMmM5MjI1
|
10
|
-
NjNjMWY3YjVhODMwNTZjNDlkNzQ1OTcxNjFkZTAyNGI0OGQwNDYwNTQzZTc2
|
11
|
-
NzI5ZWNlNDNiYThlNWU0ODE5NWQ2ZjRlYjRhZjljNDJlNGJmZTQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YWYzYjMyZjFlZmIzOTY5NzJmOWQ2OWI4MjZjNzNmZjRhNTdjZmY3YmM2NTgy
|
14
|
-
MTk4NTU0ZGY0MTk5OWZlOTczYzcxMDI5NDRiNWM5MWI0ZDVkOTAxMmU3NWQx
|
15
|
-
N2NjMzNiZTQ5NDc5ODAxMTEzZjI3YjhhY2EyYWE5NzZkNTAzNDc=
|