Class: Gemstash::GemSource::PrivateSource
Overview
GemSource for privately stored gems.
Constant Summary
DependencyCaching::API_REQUEST_LIMIT
Constants included
from Logging
Logging::LEVELS
Class Method Summary
collapse
Instance Method Summary
collapse
#serve_dependencies, #serve_dependencies_json
Methods inherited from Base
#initialize
Methods included from Logging
#log, #log_error, logger, reset, setup_logger
Class Method Details
.matches?(env) ⇒ Boolean
14
15
16
17
18
19
|
# File 'lib/gemstash/gem_source/private_source.rb', line 14
def self.matches?(env)
rewriter = rack_env_rewriter.for(env)
return false unless rewriter.matches?
rewriter.rewrite
true
end
|
.rack_env_rewriter ⇒ Object
10
11
12
|
# File 'lib/gemstash/gem_source/private_source.rb', line 10
def self.rack_env_rewriter
@rack_env_rewriter ||= Gemstash::RackEnvRewriter.new(%r{\A/private})
end
|
Instance Method Details
#serve_actual_gem(id) ⇒ Object
77
78
79
|
# File 'lib/gemstash/gem_source/private_source.rb', line 77
def serve_actual_gem(id)
halt 403, "Not yet supported"
end
|
#serve_add_gem ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/gemstash/gem_source/private_source.rb', line 25
def serve_add_gem
authenticated("Gemstash Private Gems") do
auth = request.env["HTTP_AUTHORIZATION"]
gem = request.body.read
Gemstash::GemPusher.new(auth, gem).push
end
end
|
#serve_add_spec_json ⇒ Object
49
50
51
|
# File 'lib/gemstash/gem_source/private_source.rb', line 49
def serve_add_spec_json
halt 403, "Not yet supported"
end
|
#serve_gem(id) ⇒ Object
81
82
83
84
85
86
|
# File 'lib/gemstash/gem_source/private_source.rb', line 81
def serve_gem(id)
gem_full_name = id.sub(/\.gem\z/, "")
gem = fetch_gem(gem_full_name)
content_type "application/octet-stream"
gem.content(:gem)
end
|
#serve_info(name) ⇒ Object
65
66
67
|
# File 'lib/gemstash/gem_source/private_source.rb', line 65
def serve_info(name)
halt 403, "Not yet supported"
end
|
#serve_latest_specs ⇒ Object
88
89
90
|
# File 'lib/gemstash/gem_source/private_source.rb', line 88
def serve_latest_specs
halt 403, "Not yet supported"
end
|
#serve_marshal(id) ⇒ Object
69
70
71
72
73
74
75
|
# File 'lib/gemstash/gem_source/private_source.rb', line 69
def serve_marshal(id)
gem_full_name = id.sub(/\.gemspec\.rz\z/, "")
gem = fetch_gem(gem_full_name)
halt 404 unless gem.exist?(:spec)
content_type "application/octet-stream"
gem.content(:spec)
end
|
#serve_names ⇒ Object
57
58
59
|
# File 'lib/gemstash/gem_source/private_source.rb', line 57
def serve_names
halt 403, "Not yet supported"
end
|
#serve_prerelease_specs ⇒ Object
97
98
99
100
|
# File 'lib/gemstash/gem_source/private_source.rb', line 97
def serve_prerelease_specs
content_type "application/octet-stream"
Gemstash::SpecsBuilder.prerelease
end
|
#serve_remove_spec_json ⇒ Object
53
54
55
|
# File 'lib/gemstash/gem_source/private_source.rb', line 53
def serve_remove_spec_json
halt 403, "Not yet supported"
end
|
#serve_root ⇒ Object
21
22
23
|
# File 'lib/gemstash/gem_source/private_source.rb', line 21
def serve_root
halt 403, "Not yet supported"
end
|
#serve_specs ⇒ Object
92
93
94
95
|
# File 'lib/gemstash/gem_source/private_source.rb', line 92
def serve_specs
content_type "application/octet-stream"
Gemstash::SpecsBuilder.all
end
|
#serve_unyank ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/gemstash/gem_source/private_source.rb', line 41
def serve_unyank
authenticated("Gemstash Private Gems") do
auth = request.env["HTTP_AUTHORIZATION"]
gem_name = params[:gem_name]
Gemstash::GemUnyanker.new(auth, gem_name, slug_param).unyank
end
end
|
#serve_versions ⇒ Object
61
62
63
|
# File 'lib/gemstash/gem_source/private_source.rb', line 61
def serve_versions
halt 403, "Not yet supported"
end
|
#serve_yank ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/gemstash/gem_source/private_source.rb', line 33
def serve_yank
authenticated("Gemstash Private Gems") do
auth = request.env["HTTP_AUTHORIZATION"]
gem_name = params[:gem_name]
Gemstash::GemYanker.new(auth, gem_name, slug_param).yank
end
end
|