geminabox 0.13.1 → 0.13.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of geminabox might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/{README.markdown → README.md} +5 -10
- data/lib/geminabox.rb +4 -2
- data/lib/geminabox/gem_store.rb +1 -1
- data/lib/geminabox/proxy/file_handler.rb +2 -2
- data/lib/geminabox/proxy/hostess.rb +0 -1
- data/lib/geminabox/proxy/splicer.rb +12 -2
- data/lib/geminabox/server.rb +20 -1
- data/lib/geminabox/version.rb +1 -1
- data/views/index.erb +6 -2
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4ac549590ede2aeb9d605ac81ba846ddc438695
|
4
|
+
data.tar.gz: d1903411bd32ff98a23860e2682d8cb7d116b0b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2b4f9d4fd738df563c7bb23c69d31e948277c5a837ad48ee3314344abbc263ac3fe4f4c143f1e278dac3a74ad5d9521482b8bfb11f719ce330504ebeef3ade2
|
7
|
+
data.tar.gz: 3fc4e817794baa910941c07365bf807897cd6fcf871073e279c941e2fc23289c1ee8de78ac84cb5b8843328c3f82c4c79e4023cd9fc55f6533acf3c800ba9954
|
@@ -12,10 +12,7 @@ For basic auth, try [Rack::Auth](http://www.rubydoc.info/github/rack/rack/Rack/A
|
|
12
12
|
|
13
13
|
## System Requirements
|
14
14
|
|
15
|
-
|
16
|
-
Ruby 1.9.3-392
|
17
|
-
|
18
|
-
Tests fail on Ruby 2.0.0-p0
|
15
|
+
See [.travis.yml](./.travis.yml) for supported ruby versions
|
19
16
|
|
20
17
|
## Server Setup
|
21
18
|
|
@@ -157,10 +154,8 @@ Your server should now be running!
|
|
157
154
|
|
158
155
|
## Licence
|
159
156
|
|
160
|
-
|
157
|
+
[MIT_LICENSE](./MIT-LICENSE)
|
158
|
+
|
159
|
+
## ChangeLog
|
161
160
|
|
162
|
-
[
|
163
|
-
[sinatra]: http://www.sinatrarb.com/
|
164
|
-
[passenger]: http://www.modrails.com/
|
165
|
-
[thin]: http://code.macournoyer.com/thin/
|
166
|
-
[unicorn]: http://unicorn.bogomips.org/
|
161
|
+
[CHANGELOG.md](./CHANGELOG.md)
|
data/lib/geminabox.rb
CHANGED
@@ -51,7 +51,8 @@ module Geminabox
|
|
51
51
|
:retry_interval,
|
52
52
|
:allow_remote_failure,
|
53
53
|
:ruby_gems_url,
|
54
|
-
:bundler_ruby_gems_url
|
54
|
+
:bundler_ruby_gems_url,
|
55
|
+
:allow_upload
|
55
56
|
)
|
56
57
|
|
57
58
|
def set_defaults(defaults)
|
@@ -85,7 +86,8 @@ module Geminabox
|
|
85
86
|
retry_interval: 60,
|
86
87
|
allow_remote_failure: false,
|
87
88
|
ruby_gems_url: 'https://rubygems.org/',
|
88
|
-
bundler_ruby_gems_url: 'https://bundler.rubygems.org/'
|
89
|
+
bundler_ruby_gems_url: 'https://bundler.rubygems.org/',
|
90
|
+
allow_upload: true
|
89
91
|
)
|
90
92
|
|
91
93
|
end
|
data/lib/geminabox/gem_store.rb
CHANGED
@@ -37,7 +37,7 @@ module Geminabox
|
|
37
37
|
if existing_file_digest != gem.hexdigest
|
38
38
|
raise GemStoreError.new(409, "Updating an existing gem is not permitted.\nYou should either delete the existing version, or change your version number.")
|
39
39
|
else
|
40
|
-
raise GemStoreError.new(200, "Ignoring upload, you uploaded the same thing previously.\nPlease use -o to
|
40
|
+
raise GemStoreError.new(200, "Ignoring upload, you uploaded the same thing previously.\nPlease use -o to overwrite.")
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -9,7 +9,7 @@ module Geminabox
|
|
9
9
|
@file_name = file_name
|
10
10
|
ensure_destination_exists
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def local_path
|
14
14
|
File.expand_path(file_name, root_path)
|
15
15
|
end
|
@@ -21,7 +21,7 @@ module Geminabox
|
|
21
21
|
def local_file_exists?
|
22
22
|
file_exists? local_path
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def proxy_file_exists?
|
26
26
|
file_exists? proxy_path
|
27
27
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
+
require 'tempfile'
|
1
2
|
|
2
3
|
module Geminabox
|
3
4
|
module Proxy
|
4
5
|
class Splicer < FileHandler
|
5
|
-
|
6
|
+
|
6
7
|
def self.make(file_name)
|
7
8
|
splicer = new(file_name)
|
8
9
|
splicer.create
|
@@ -10,7 +11,16 @@ module Geminabox
|
|
10
11
|
end
|
11
12
|
|
12
13
|
def create
|
13
|
-
|
14
|
+
data = new_content
|
15
|
+
return nil if data.nil?
|
16
|
+
begin
|
17
|
+
tmp = Tempfile.new('geminabox')
|
18
|
+
File.open(tmp, 'w'){|f| f.write(data)}
|
19
|
+
rescue
|
20
|
+
return nil
|
21
|
+
end
|
22
|
+
|
23
|
+
FileUtils.mv tmp, splice_path
|
14
24
|
end
|
15
25
|
|
16
26
|
def new_content
|
data/lib/geminabox/server.rb
CHANGED
@@ -19,7 +19,8 @@ module Geminabox
|
|
19
19
|
:lockfile,
|
20
20
|
:retry_interval,
|
21
21
|
:rubygems_proxy,
|
22
|
-
:ruby_gems_url
|
22
|
+
:ruby_gems_url,
|
23
|
+
:allow_upload
|
23
24
|
)
|
24
25
|
|
25
26
|
if Server.rubygems_proxy
|
@@ -37,6 +38,10 @@ module Geminabox
|
|
37
38
|
allow_delete
|
38
39
|
end
|
39
40
|
|
41
|
+
def allow_upload?
|
42
|
+
allow_upload
|
43
|
+
end
|
44
|
+
|
40
45
|
def fixup_bundler_rubygems!
|
41
46
|
return if @post_reset_hook_applied
|
42
47
|
Gem.post_reset{ Gem::Specification.all = nil } if defined? Bundler and Gem.respond_to? :post_reset
|
@@ -85,6 +90,8 @@ module Geminabox
|
|
85
90
|
get '/' do
|
86
91
|
@gems = load_gems
|
87
92
|
@index_gems = index_gems(@gems)
|
93
|
+
@allow_upload = self.class.allow_upload?
|
94
|
+
@allow_delete = self.class.allow_delete?
|
88
95
|
erb :index
|
89
96
|
end
|
90
97
|
|
@@ -102,6 +109,10 @@ module Geminabox
|
|
102
109
|
end
|
103
110
|
|
104
111
|
get '/upload' do
|
112
|
+
unless self.class.allow_upload?
|
113
|
+
error_response(403, 'Gem uploading is disabled')
|
114
|
+
end
|
115
|
+
|
105
116
|
erb :upload
|
106
117
|
end
|
107
118
|
|
@@ -133,6 +144,10 @@ module Geminabox
|
|
133
144
|
end
|
134
145
|
|
135
146
|
post '/upload' do
|
147
|
+
unless self.class.allow_upload?
|
148
|
+
error_response(403, 'Gem uploading is disabled')
|
149
|
+
end
|
150
|
+
|
136
151
|
if params[:file] && params[:file][:filename] && (tmpfile = params[:file][:tempfile])
|
137
152
|
serialize_update do
|
138
153
|
handle_incoming_gem(Geminabox::IncomingGem.new(tmpfile))
|
@@ -144,6 +159,10 @@ module Geminabox
|
|
144
159
|
end
|
145
160
|
|
146
161
|
post '/api/v1/gems' do
|
162
|
+
unless self.class.allow_upload?
|
163
|
+
error_response(403, 'Gem uploading is disabled')
|
164
|
+
end
|
165
|
+
|
147
166
|
begin
|
148
167
|
serialize_update do
|
149
168
|
handle_incoming_gem(Geminabox::IncomingGem.new(request.body))
|
data/lib/geminabox/version.rb
CHANGED
data/views/index.erb
CHANGED
@@ -3,12 +3,14 @@
|
|
3
3
|
<pre><code>gem sources -a <%= url "/" %></code></pre>
|
4
4
|
<small>If you needed some credentials to get to this page</small>
|
5
5
|
<pre><code>gem sources -a <%= url.to_s.gsub('://','://username:password@') %></code></pre>
|
6
|
+
<% if @allow_upload %>
|
6
7
|
<small>and then ...</small>
|
7
8
|
<pre><code>gem install geminabox<br />gem inabox [gemfile]</code></pre>
|
9
|
+
<% end %>
|
8
10
|
</p>
|
9
11
|
|
10
12
|
<% if @gems.any? %>
|
11
|
-
|
13
|
+
<% if @allow_upload %><a href="<%= url("/upload") %>">Upload Another Gem</a><% end %>
|
12
14
|
|
13
15
|
<div id="alpha_index"><%= ("a".."z").map{|i| @index_gems.include?(i) ? "<a href='#jump_#{i}'>#{i}</a>" : i }.join(" - ") %></div>
|
14
16
|
|
@@ -26,8 +28,10 @@
|
|
26
28
|
</p>
|
27
29
|
<form class="delete-form" method="post" action="<%= url("/gems/#{version.gemfile_name}.gem") %>">
|
28
30
|
<a class="download" href="<%= url("/gems/#{version.gemfile_name}.gem") %>">download</a>
|
31
|
+
<% if @allow_delete %>
|
29
32
|
<input type="hidden" name="_method" value="DELETE" />
|
30
33
|
<button type="submit">delete</button>
|
34
|
+
<% end %>
|
31
35
|
</form>
|
32
36
|
<% end %>
|
33
37
|
|
@@ -53,4 +57,4 @@
|
|
53
57
|
</ul>
|
54
58
|
<% end %>
|
55
59
|
|
56
|
-
|
60
|
+
<% if @allow_upload %><a href="<%= url("/upload") %>">Upload Another Gem</a><% end %>
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geminabox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Lea
|
8
8
|
- Jack Foy
|
9
9
|
- Rob Nichols
|
10
|
+
- Naotoshi Seo
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date: 2016-
|
14
|
+
date: 2016-10-13 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: sinatra
|
@@ -87,13 +88,14 @@ email:
|
|
87
88
|
- contrib@tomlea.co.uk
|
88
89
|
- jack@foys.net
|
89
90
|
- rob@undervale.co.uk
|
91
|
+
- sonots@gmail.com
|
90
92
|
executables: []
|
91
93
|
extensions: []
|
92
94
|
extra_rdoc_files:
|
93
|
-
- README.
|
95
|
+
- README.md
|
94
96
|
files:
|
95
97
|
- MIT-LICENSE
|
96
|
-
- README.
|
98
|
+
- README.md
|
97
99
|
- lib/geminabox.rb
|
98
100
|
- lib/geminabox/disk_cache.rb
|
99
101
|
- lib/geminabox/gem_list_merge.rb
|
@@ -135,7 +137,7 @@ metadata: {}
|
|
135
137
|
post_install_message:
|
136
138
|
rdoc_options:
|
137
139
|
- "--main"
|
138
|
-
- README.
|
140
|
+
- README.md
|
139
141
|
require_paths:
|
140
142
|
- lib
|
141
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|