private_event 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +22 -0
- data/README.md +52 -0
- data/bin/members_only +4 -0
- data/config/hostess.ru +7 -0
- data/lib/hostess/app.rb +34 -0
- data/lib/hostess/indexer.rb +117 -0
- data/private_event.gemspec +28 -0
- metadata +99 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2009, Nick Quaranto
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# RubyGems.org (née Gemcutter)
|
2
|
+
The Ruby community's gem host.
|
3
|
+
|
4
|
+
## Purpose
|
5
|
+
|
6
|
+
* Provide a better API for dealing with gems
|
7
|
+
* Create more transparent and accessible project pages
|
8
|
+
* Enable the community to improve and enhance the site
|
9
|
+
|
10
|
+
## Links
|
11
|
+
|
12
|
+
* [Mailing List][]
|
13
|
+
* [FAQ][]
|
14
|
+
* [IRC][]: #gemcutter on Freenode
|
15
|
+
* [Travis][]: [][travis]
|
16
|
+
* [Gemnasium][]: [][gemnasium]
|
17
|
+
|
18
|
+
[mailing list]: http://groups.google.com/group/gemcutter
|
19
|
+
[faq]: http://help.rubygems.org/kb/gemcutter/faq
|
20
|
+
[irc]: http://webchat.freenode.net/?channels=gemcutter
|
21
|
+
[travis]: http://travis-ci.org/#!/rubygems/rubygems.org
|
22
|
+
[gemnasium]: https://gemnasium.com/rubygems/rubygems.org
|
23
|
+
|
24
|
+
## Contributions
|
25
|
+
|
26
|
+
Please see the wiki for the latest [contribution guidelines][].
|
27
|
+
|
28
|
+
[contribution guidelines]: http://wiki.github.com/rubygems/rubygems.org/contribution-guidelines
|
29
|
+
|
30
|
+
To get setup, please check out the [Development Setup][].
|
31
|
+
|
32
|
+
[development setup]: https://github.com/rubygems/rubygems.org/wiki/Development-Setup
|
33
|
+
|
34
|
+
Our deployment process is documented on the wiki as well, there's a multi-step
|
35
|
+
[Checklist][] to run through.
|
36
|
+
|
37
|
+
[checklist]: https://github.com/rubygems/rubygems.org/wiki/Deployment
|
38
|
+
|
39
|
+
## Organization
|
40
|
+
|
41
|
+
RubyGems.org consists of a few major parts:
|
42
|
+
|
43
|
+
* Rails app: To manage users and allow others to view gems, etc.
|
44
|
+
* Sinatra app (Hostess): the gem server
|
45
|
+
* Gem processor: Handles incoming gems and storing them in S3 (production) or
|
46
|
+
on the filesystem in `server/` (development).
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
RubyGems.org uses the MIT license. Please check the [LICENSE][] file for more details.
|
51
|
+
|
52
|
+
[license]: https://github.com/rubygems/rubygems.org/blob/master/MIT-LICENSE
|
data/bin/members_only
ADDED
data/config/hostess.ru
ADDED
data/lib/hostess/app.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Hostess
|
2
|
+
class App < Sinatra::Base
|
3
|
+
enable :raise_errors
|
4
|
+
disable :show_exceptions
|
5
|
+
|
6
|
+
def serve
|
7
|
+
send_file(File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'server', 'repo', request.path_info)))
|
8
|
+
end
|
9
|
+
|
10
|
+
%w[/specs.4.8.gz
|
11
|
+
/latest_specs.4.8.gz
|
12
|
+
/prerelease_specs.4.8.gz
|
13
|
+
].each do |index|
|
14
|
+
get index do
|
15
|
+
content_type('application/x-gzip')
|
16
|
+
serve
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
get "/quick/Marshal.4.8/*.gemspec.rz" do
|
21
|
+
content_type('application/x-deflate')
|
22
|
+
serve
|
23
|
+
end
|
24
|
+
|
25
|
+
get "/gems/*.gem" do
|
26
|
+
serve
|
27
|
+
end
|
28
|
+
|
29
|
+
def full_name
|
30
|
+
@full_name ||= params[:splat].join.chomp('.gem')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'rubygems/format'
|
2
|
+
require 'rubygems/indexer'
|
3
|
+
require 'fog'
|
4
|
+
|
5
|
+
module Hostess
|
6
|
+
class Indexer
|
7
|
+
def write_gem(body, spec)
|
8
|
+
gem_file = directory.files.create(
|
9
|
+
:body => body.string,
|
10
|
+
:key => "gems/#{spec.original_name}.gem",
|
11
|
+
:public => true
|
12
|
+
)
|
13
|
+
|
14
|
+
gem_spec = directory.files.create(
|
15
|
+
:body => Gem.deflate(Marshal.dump(spec)),
|
16
|
+
:key => "quick/Marshal.4.8/#{spec.original_name}.gemspec.rz",
|
17
|
+
:public => true
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def update_index
|
22
|
+
log "Updating the index"
|
23
|
+
upload("specs.4.8.gz", specs_index)
|
24
|
+
log "Uploaded all specs index"
|
25
|
+
upload("latest_specs.4.8.gz", latest_index)
|
26
|
+
log "Uploaded latest specs index"
|
27
|
+
upload("prerelease_specs.4.8.gz", prerelease_index)
|
28
|
+
log "Uploaded prerelease specs index"
|
29
|
+
log "Finished updating the index"
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def directory
|
35
|
+
fog.directories.get('repo')
|
36
|
+
end
|
37
|
+
|
38
|
+
def all_gems
|
39
|
+
fog.directories.get('repo/gems').files
|
40
|
+
end
|
41
|
+
|
42
|
+
def fog
|
43
|
+
$fog || Fog::Storage.new(
|
44
|
+
:provider => 'Local',
|
45
|
+
:local_root => File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'server'))
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
def stringify(value)
|
50
|
+
final = StringIO.new
|
51
|
+
gzip = Zlib::GzipWriter.new(final)
|
52
|
+
gzip.write(Marshal.dump(value))
|
53
|
+
gzip.close
|
54
|
+
|
55
|
+
final.string
|
56
|
+
end
|
57
|
+
|
58
|
+
def upload(key, value)
|
59
|
+
file = directory.files.create(
|
60
|
+
:body => stringify(value),
|
61
|
+
:key => key,
|
62
|
+
:public => true
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
def minimize_specs(data)
|
67
|
+
names = Hash.new { |h,k| h[k] = k }
|
68
|
+
versions = Hash.new { |h,k| h[k] = Gem::Version.new(k) }
|
69
|
+
platforms = Hash.new { |h,k| h[k] = k }
|
70
|
+
|
71
|
+
data.each do |row|
|
72
|
+
row[0] = names[row[0]]
|
73
|
+
row[1] = versions[row[1].strip]
|
74
|
+
row[2] = platforms[row[2]]
|
75
|
+
end
|
76
|
+
|
77
|
+
data
|
78
|
+
end
|
79
|
+
|
80
|
+
def specs_index
|
81
|
+
minimize_specs rows_for_index
|
82
|
+
end
|
83
|
+
|
84
|
+
def rows_for_index
|
85
|
+
all_gems.collect do |gf|
|
86
|
+
spec = Gem::Package.open(StringIO.new(gf.body), "r", nil) {|pkg| pkg.metadata }
|
87
|
+
[spec.name, spec.version.to_s, spec.platform]
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def latest_index
|
92
|
+
minimize_specs rows_for_latest_index
|
93
|
+
end
|
94
|
+
|
95
|
+
def rows_for_latest_index
|
96
|
+
latest = { }
|
97
|
+
all_gems.collect do |gf|
|
98
|
+
spec = Gem::Package.open(StringIO.new(gf.body), "r", nil) {|pkg| pkg.metadata }
|
99
|
+
latest[spec.name] ||= [spec.name, spec.version.to_s, spec.platform]
|
100
|
+
if Gem::Version.new(latest[spec.name][1]) < spec.version
|
101
|
+
latest[spec.name] = [spec.name, spec.version.to_s, spec.platform]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
return latest.values
|
106
|
+
end
|
107
|
+
|
108
|
+
def prerelease_index
|
109
|
+
return []
|
110
|
+
minimize_specs rows_for_prerelease_index
|
111
|
+
end
|
112
|
+
|
113
|
+
def log(message)
|
114
|
+
puts "#{Time.now} #{message}"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'private_event'
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.date = '2011-12-26'
|
5
|
+
|
6
|
+
s.summary = "Gem hosting and indexing, extracted from the rubygems.org repo"
|
7
|
+
s.description = "Gem hosting and indexing, extracted from the rubygems.org repo"
|
8
|
+
|
9
|
+
s.authors = ["Tom Bombadil"]
|
10
|
+
s.email = 'amanibhavam@destructuring.org'
|
11
|
+
s.homepage = 'https://github.com/HeSYINUvSBZfxqA/private_event'
|
12
|
+
|
13
|
+
s.require_paths = %w[lib]
|
14
|
+
|
15
|
+
s.executables = []
|
16
|
+
|
17
|
+
s.add_dependency('sinatra')
|
18
|
+
s.add_dependency('fog')
|
19
|
+
|
20
|
+
s.files = %w[
|
21
|
+
README.md
|
22
|
+
MIT-LICENSE
|
23
|
+
private_event.gemspec
|
24
|
+
bin/members_only
|
25
|
+
config/hostess.ru
|
26
|
+
server/repo/.gitignore
|
27
|
+
] + Dir['lib/hostess/**/*']
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: private_event
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Tom Bombadil
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-12-26 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: sinatra
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: fog
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
description: Gem hosting and indexing, extracted from the rubygems.org repo
|
49
|
+
email: amanibhavam@destructuring.org
|
50
|
+
executables: []
|
51
|
+
|
52
|
+
extensions: []
|
53
|
+
|
54
|
+
extra_rdoc_files: []
|
55
|
+
|
56
|
+
files:
|
57
|
+
- README.md
|
58
|
+
- MIT-LICENSE
|
59
|
+
- private_event.gemspec
|
60
|
+
- bin/members_only
|
61
|
+
- config/hostess.ru
|
62
|
+
- server/repo/.gitignore
|
63
|
+
- lib/hostess/app.rb
|
64
|
+
- lib/hostess/indexer.rb
|
65
|
+
homepage: https://github.com/HeSYINUvSBZfxqA/private_event
|
66
|
+
licenses: []
|
67
|
+
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
version: "0"
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
version: "0"
|
91
|
+
requirements: []
|
92
|
+
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 1.8.10
|
95
|
+
signing_key:
|
96
|
+
specification_version: 3
|
97
|
+
summary: Gem hosting and indexing, extracted from the rubygems.org repo
|
98
|
+
test_files: []
|
99
|
+
|