Skip to content
Permalink
Browse files

Cleanup for vault and gemcutter

  • Loading branch information...
qrush committed Oct 16, 2009
1 parent a5499cd commit 2adb622c08b5bff339c1c19e1cad238a40a2a1ad

This file was deleted.

@@ -10,10 +10,11 @@

DO_NOT_REPLY = "donotreply@gemcutter.org"

require 'lib/indexer'
require 'lib/core_ext/string'
require 'lib/rubygems/format'
require 'lib/rubygems/indexer'
require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/to_html'
require 'clearance/sessions_controller'

Gem.configuration.verbose = false
ActiveRecord::Base.include_root_in_json = false
@@ -0,0 +1,11 @@
require 'clearance/confirmations_controller'
require 'clearance/passwords_controller'
require 'clearance/sessions_controller'
require 'clearance/users_controller'

class Clearance::SessionsController
private
def url_after_create
dashboard_url
end
end
File renamed without changes.
@@ -41,7 +41,5 @@
:action => 'destroy',
:method => :delete

map.resource :session, :only => [:new, :create, :destroy]

map.root :controller => "home", :action => "index"
end
@@ -1,3 +1,3 @@
default: features -t ~wip
wip: features -t wip
all: features
default: features -t ~wip -f progress
wip: features -t wip -f progress
all: features -f progress
@@ -81,8 +81,34 @@ def inspect
end

def self.indexer
indexer = Gem::Indexer.new(Gemcutter.server_path, :build_legacy => false)
def indexer.say(message) end
indexer
@indexer ||=
begin
indexer = Gem::Indexer.new(Gemcutter.server_path, :build_legacy => false)
def indexer.say(message) end
indexer
end
end

def specs_index
Version.with_indexed.map(&:to_index)
end

def latest_index
Version.latest.release.map(&:to_index)
end

def prerelease_index
Version.prerelease.map(&:to_index)
end

def perform
Version.update_all({:indexed => true}, {:id => self.version_id})
update_index
end

def update_index
upload("specs.4.8.gz", specs_index)
upload("latest_specs.4.8.gz", latest_index)
upload("prerelease_specs.4.8.gz", prerelease_index)
end
end

This file was deleted.

@@ -10,13 +10,13 @@ begin
namespace :cucumber do
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
t.fork = true # You may get faster startup if you set this to false
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'progress'}"
t.binary = vendored_cucumber_binary
end

Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
t.fork = true # You may get faster startup if you set this to false
t.cucumber_opts = "--color --tags @wip:2 --wip --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
t.cucumber_opts = "--color --tags @wip:2 --wip --format #{ENV['CUCUMBER_FORMAT'] || 'progress'}"
t.binary = vendored_cucumber_binary
end

@@ -2,39 +2,16 @@ module Vault
module S3
OPTIONS = {:authenticated => false, :access => :public_read}

def perform
Version.update_all({:indexed => true}, {:id => self.version_id})
update_index
end

def specs_index
Version.with_indexed.map(&:to_index)
end

def latest_index
Version.latest.release.map(&:to_index)
end

def prerelease_index
Version.prerelease.map(&:to_index)
end

def write_gem
cache_path = "gems/#{spec.original_name}.gem"
VaultObject.store(cache_path, body.string, OPTIONS)

quick_path = "quick/Marshal.#{Gem.marshal_version}/#{spec.original_name}.gemspec.rz"
quick_path = "quick/Marshal.4.8/#{spec.original_name}.gemspec.rz"
Gemcutter.indexer.abbreviate spec
Gemcutter.indexer.sanitize spec
VaultObject.store(quick_path, Gem.deflate(Marshal.dump(spec)), OPTIONS)
end

def update_index
upload("specs.#{Gem.marshal_version}.gz", specs_index)
upload("latest_specs.#{Gem.marshal_version}.gz", latest_index)
upload("prerelease_specs.#{Gem.marshal_version}.gz", prerelease_index)
end

def upload(key, value)
final = StringIO.new
gzip = Zlib::GzipWriter.new(final)
@@ -47,31 +24,14 @@ def upload(key, value)
end

module FS
def perform
write_gem
update_index
end

def source_path
Gemcutter.server_path("source_index")
end

def source_index
if File.exists?(source_path)
@source_index ||= Marshal.load(Gem.inflate(File.read(source_path)))
else
@source_index ||= Gem::SourceIndex.new
end
end

def write_gem
cache_path = Gemcutter.server_path('gems', "#{spec.original_name}.gem")
File.open(cache_path, "wb") do |f|
f.write body.string
end
File.chmod 0644, cache_path

quick_path = Gemcutter.server_path("quick", "Marshal.#{Gem.marshal_version}", "#{spec.original_name}.gemspec.rz")
quick_path = Gemcutter.server_path("quick", "Marshal.4.8", "#{spec.original_name}.gemspec.rz")
FileUtils.mkdir_p(File.dirname(quick_path))

Gemcutter.indexer.abbreviate spec
@@ -82,13 +42,15 @@ def write_gem
File.chmod 0644, quick_path
end

def update_index
source_index.add_spec spec, spec.original_name
File.open(source_path, "wb") do |f|
f.write Gem.deflate(Marshal.dump(source_index))
end
def upload(key, value)
final = StringIO.new
gzip = Zlib::GzipWriter.new(final)
gzip.write(Marshal.dump(value))
gzip.close

Gemcutter.indexer.update_index(source_index)
File.open(Gemcutter.server_path(key), "wb") do |f|
f.write final.string
end
end
end
end

This file was deleted.

@@ -5,8 +5,6 @@
FakeWeb.allow_net_connect = false
set :environment, :test

Gemcutter.indexer.generate_index

Shoulda.autoload_macros(Rails.root, "vendor/bundler_gems/gems/*")

class ActiveSupport::TestCase
@@ -39,7 +37,6 @@ def regenerate_index
server/quick
server/specifications
server/source_index].map { |d| Dir[d] })
Gemcutter.indexer.generate_index
end

def create_gem(owner, opts = {})
@@ -15,14 +15,6 @@ class GemcutterTest < ActiveSupport::TestCase
end
end

should "generate a new indexer" do
@indexer = "indexer"
mock(Gem::Indexer).new(Gemcutter.server_path, :build_legacy => false) { @indexer }
assert_equal @indexer, Gemcutter.indexer
assert @indexer.respond_to?(:say)
assert_nil @indexer.say("Should be quiet")
end

context "creating a new gemcutter" do
setup do
@user = Factory(:email_confirmed_user)

This file was deleted.

0 comments on commit 2adb622

Please sign in to comment.
You can’t perform that action at this time.