Class: Gemstash::GemSource::PrivateSource
Overview
GemSource for privately stored gems.
Constant Summary
DependencyCaching::API_REQUEST_LIMIT
Constants included
from Logging
Logging::LEVELS
Instance Attribute Summary collapse
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
Instance Attribute Details
#auth ⇒ Object
Returns the value of attribute auth.
9
10
11
|
# File 'lib/gemstash/gem_source/private_source.rb', line 9
def auth
@auth
end
|
Class Method Details
.matches?(env) ⇒ Boolean
15
16
17
18
19
20
|
# File 'lib/gemstash/gem_source/private_source.rb', line 15
def self.matches?(env)
rewriter = rack_env_rewriter.for(env)
return false unless rewriter.matches?
rewriter.rewrite
true
end
|
.rack_env_rewriter ⇒ Object
11
12
13
|
# File 'lib/gemstash/gem_source/private_source.rb', line 11
def self.rack_env_rewriter
@rack_env_rewriter ||= Gemstash::RackEnvRewriter.new(%r{\A/private})
end
|
Instance Method Details
#serve_actual_gem(id) ⇒ Object
69
70
71
|
# File 'lib/gemstash/gem_source/private_source.rb', line 69
def serve_actual_gem(id)
halt 403, "Not yet supported"
end
|
#serve_add_gem ⇒ Object
26
27
28
|
# File 'lib/gemstash/gem_source/private_source.rb', line 26
def serve_add_gem
protected(Gemstash::GemPusher)
end
|
#serve_add_spec_json ⇒ Object
38
39
40
|
# File 'lib/gemstash/gem_source/private_source.rb', line 38
def serve_add_spec_json
halt 403, "Not yet supported"
end
|
#serve_gem(id) ⇒ Object
73
74
75
76
77
78
79
80
81
|
# File 'lib/gemstash/gem_source/private_source.rb', line 73
def serve_gem(id)
authorization.protect(self) do
auth.check("fetch") if gemstash_env.config[:protected_fetch]
gem_full_name = id.sub(/\.gem\z/, "")
gem = fetch_gem(gem_full_name)
content_type "application/octet-stream"
gem.content(:gem)
end
end
|
#serve_info(name) ⇒ Object
54
55
56
|
# File 'lib/gemstash/gem_source/private_source.rb', line 54
def serve_info(name)
halt 403, "Not yet supported"
end
|
#serve_latest_specs ⇒ Object
88
89
90
91
|
# File 'lib/gemstash/gem_source/private_source.rb', line 88
def serve_latest_specs
params[:latest] = true
protected(Gemstash::SpecsBuilder)
end
|
#serve_marshal(id) ⇒ Object
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/gemstash/gem_source/private_source.rb', line 58
def serve_marshal(id)
authorization.protect(self) do
auth.check("fetch") if gemstash_env.config[:protected_fetch]
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
end
|
#serve_names ⇒ Object
46
47
48
|
# File 'lib/gemstash/gem_source/private_source.rb', line 46
def serve_names
halt 403, "Not yet supported"
end
|
#serve_prerelease_specs ⇒ Object
93
94
95
96
|
# File 'lib/gemstash/gem_source/private_source.rb', line 93
def serve_prerelease_specs
params[:prerelease] = true
protected(Gemstash::SpecsBuilder)
end
|
#serve_remove_spec_json ⇒ Object
42
43
44
|
# File 'lib/gemstash/gem_source/private_source.rb', line 42
def serve_remove_spec_json
halt 403, "Not yet supported"
end
|
#serve_root ⇒ Object
22
23
24
|
# File 'lib/gemstash/gem_source/private_source.rb', line 22
def serve_root
halt 403, "Not yet supported"
end
|
#serve_specs ⇒ Object
83
84
85
86
|
# File 'lib/gemstash/gem_source/private_source.rb', line 83
def serve_specs
params[:prerelease] = false
protected(Gemstash::SpecsBuilder)
end
|
#serve_unyank ⇒ Object
34
35
36
|
# File 'lib/gemstash/gem_source/private_source.rb', line 34
def serve_unyank
protected(Gemstash::GemUnyanker)
end
|
#serve_versions ⇒ Object
50
51
52
|
# File 'lib/gemstash/gem_source/private_source.rb', line 50
def serve_versions
halt 403, "Not yet supported"
end
|
#serve_yank ⇒ Object
30
31
32
|
# File 'lib/gemstash/gem_source/private_source.rb', line 30
def serve_yank
protected(Gemstash::GemYanker)
end
|