Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit a9f94da83463fc857f8f58353883d9123fd7aa45 @jcredding jcredding committed Dec 12, 2011
Showing with 1,575 additions and 0 deletions.
  1. +31 −0 Gemfile
  2. +133 −0 Gemfile.lock
  3. +3 −0 README.md
  4. +7 −0 Rakefile
  5. BIN app/assets/images/rails.png
  6. +3 −0 app/assets/javascripts/api/v0/specs.js.coffee
  7. +10 −0 app/assets/javascripts/application.js
  8. +3 −0 app/assets/javascripts/rubygems.js.coffee
  9. +3 −0 app/assets/stylesheets/api/v0/specs.css.scss
  10. +8 −0 app/assets/stylesheets/application.css
  11. +30 −0 app/assets/stylesheets/layout.css.scss
  12. +65 −0 app/assets/stylesheets/rubygems.css.scss
  13. +53 −0 app/controllers/api/v0/gem_cutters_controller.rb
  14. +11 −0 app/controllers/api/v0/specs_controller.rb
  15. +12 −0 app/controllers/application_controller.rb
  16. +15 −0 app/controllers/rubygems_controller.rb
  17. +28 −0 app/decorators/application_decorator.rb
  18. +49 −0 app/decorators/rubygem_decorator.rb
  19. +2 −0 app/helpers/api/v0/specs_helper.rb
  20. +2 −0 app/helpers/application_helper.rb
  21. +37 −0 app/helpers/rubygems_helper.rb
  22. 0 app/mailers/.gitkeep
  23. 0 app/models/.gitkeep
  24. +62 −0 app/models/rubygem.rb
  25. +125 −0 app/models/version.rb
  26. +45 −0 app/views/layouts/application.html.erb
  27. +34 −0 app/views/rubygems/index.html.erb
  28. +16 −0 app/views/rubygems/index/_listing.html.erb
  29. +4 −0 config.ru
  30. +48 −0 config/application.rb
  31. +6 −0 config/boot.rb
  32. +55 −0 config/database.yml
  33. +5 −0 config/environment.rb
  34. +30 −0 config/environments/development.rb
  35. +60 −0 config/environments/production.rb
  36. +39 −0 config/environments/test.rb
  37. +7 −0 config/initializers/backtrace_silencers.rb
  38. +13 −0 config/initializers/gems_server.rb
  39. +10 −0 config/initializers/inflections.rb
  40. +5 −0 config/initializers/mime_types.rb
  41. +7 −0 config/initializers/secret_token.rb
  42. +8 −0 config/initializers/session_store.rb
  43. +14 −0 config/initializers/wrap_parameters.rb
  44. +5 −0 config/locales/en.yml
  45. +18 −0 config/routes.rb
  46. +10 −0 db/migrate/20111206223833_create_rubygems.rb
  47. +42 −0 db/migrate/20111206230618_create_versions.rb
  48. +49 −0 db/schema.rb
  49. +7 −0 db/seeds.rb
  50. +2 −0 doc/README_FOR_APP
  51. 0 lib/assets/.gitkeep
  52. +61 −0 lib/gem_cutter.rb
  53. +50 −0 lib/import.rb
  54. +20 −0 lib/migrations/foreign_keys.rb
  55. +9 −0 lib/patterns.rb
  56. 0 lib/tasks/.gitkeep
  57. +9 −0 lib/tasks/import.rake
  58. +26 −0 public/404.html
  59. +26 −0 public/422.html
  60. +26 −0 public/500.html
  61. 0 public/favicon.ico
  62. +5 −0 public/robots.txt
  63. +6 −0 script/rails
  64. +11 −0 test/decorators/application_decorator_test.rb
  65. +12 −0 test/decorators/rubygem_decorator_test.rb
  66. 0 test/fixtures/.gitkeep
  67. +11 −0 test/fixtures/rubygems.yml
  68. +11 −0 test/fixtures/versions.yml
  69. 0 test/functional/.gitkeep
  70. +7 −0 test/functional/api/v0/specs_controller_test.rb
  71. +7 −0 test/functional/rubygems_controller_test.rb
  72. 0 test/integration/.gitkeep
  73. +12 −0 test/performance/browsing_test.rb
  74. +13 −0 test/test_helper.rb
  75. 0 test/unit/.gitkeep
  76. +4 −0 test/unit/helpers/api/v0/specs_helper_test.rb
  77. +4 −0 test/unit/helpers/rubygems_helper_test.rb
  78. +7 −0 test/unit/rubygem_test.rb
  79. +7 −0 test/unit/version_test.rb
  80. 0 vendor/assets/stylesheets/.gitkeep
  81. 0 vendor/log/.gitkeep
  82. 0 vendor/plugins/.gitkeep
@@ -0,0 +1,31 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.1.3'
+
+gem 'pg'
+
+gem 'ns-options'
+
+gem 'inherited_resources'
+
+gem 'draper'
+
+group :assets do
+ gem 'sass-rails', '~> 3.1.5'
+ gem 'coffee-rails', '~> 3.1.1'
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+gem "zurb-foundation"
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'ruby-debug19', :require => 'ruby-debug'
+
+group :test do
+ # Pretty printed test output
+ gem 'turn', '~> 0.8.3', :require => false
+end
@@ -0,0 +1,133 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.3)
+ actionpack (= 3.1.3)
+ mail (~> 2.3.0)
+ actionpack (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.5)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.3)
+ activemodel (3.1.3)
+ activesupport (= 3.1.3)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ arel (~> 2.2.1)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ activesupport (3.1.3)
+ multi_json (~> 1.0)
+ ansi (1.4.1)
+ arel (2.2.1)
+ builder (3.0.0)
+ coffee-rails (3.1.1)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.1.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.1.3)
+ draper (0.9.5)
+ activesupport (>= 2.3.10)
+ erubis (2.7.0)
+ execjs (1.2.11)
+ multi_json (~> 1.0)
+ has_scope (0.5.1)
+ hike (1.2.1)
+ i18n (0.6.0)
+ inherited_resources (1.3.0)
+ has_scope (~> 0.5.0)
+ responders (~> 0.6.0)
+ jquery-rails (1.0.19)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ json (1.6.3)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.17.2)
+ multi_json (1.0.4)
+ ns-options (0.3.0)
+ pg (0.11.0)
+ polyglot (0.3.3)
+ rack (1.3.5)
+ rack-cache (1.1)
+ rack (>= 0.4)
+ rack-mount (0.8.3)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.1.3)
+ actionmailer (= 3.1.3)
+ actionpack (= 3.1.3)
+ activerecord (= 3.1.3)
+ activeresource (= 3.1.3)
+ activesupport (= 3.1.3)
+ bundler (~> 1.0)
+ railties (= 3.1.3)
+ railties (3.1.3)
+ actionpack (= 3.1.3)
+ activesupport (= 3.1.3)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.11)
+ json (~> 1.4)
+ responders (0.6.4)
+ sass (3.1.11)
+ sass-rails (3.1.5)
+ actionpack (~> 3.1.0)
+ railties (~> 3.1.0)
+ sass (~> 3.1.10)
+ tilt (~> 1.3.2)
+ sprockets (2.0.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ turn (0.8.3)
+ ansi
+ tzinfo (0.3.31)
+ uglifier (1.1.0)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+ zurb-foundation (2.1.0)
+ jquery-rails (~> 1.0)
+ rails (~> 3.1.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails (~> 3.1.1)
+ draper
+ inherited_resources
+ jquery-rails
+ ns-options
+ pg
+ rails (= 3.1.3)
+ sass-rails (~> 3.1.5)
+ turn (~> 0.8.3)
+ uglifier (>= 1.0.3)
+ zurb-foundation
@@ -0,0 +1,3 @@
+# Gems Server
+
+A private gems server that provides the same API as rubygems.org.
@@ -0,0 +1,7 @@
+#!/usr/bin/env rake
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+GemsServer::Application.load_tasks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,10 @@
+// This is a manifest file that'll be compiled into including all the files listed below.
+// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
+// be included in the compiled file accessible from http://example.com/assets/application.js
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+//= require jquery
+//= require jquery_ujs
+//= require foundation
+//= require_tree .
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
+// Place all the styles related to the api/v0/specs controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,8 @@
+/*
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
+ *= require_self
+ *= require foundation
+ *= require_tree .
+*/
@@ -0,0 +1,30 @@
+BODY {
+ > DIV.container.top-bar {
+ padding: 15px 20px 13px;
+ background-color: #000;
+ border-bottom: solid 4px #00A5FF;
+
+ > DIV.row {
+ > DIV.header {
+ > H1 {
+ font-size: 1.6rem;
+ margin: 0;
+
+ > A {
+ color: #FFF;
+ }
+ }
+ }
+ > DIV.links {
+ > STRONG.right {
+ > A {
+ color: #FFF;
+ }
+ }
+ }
+ }
+ }
+ > DIV.container.main {
+
+ }
+}
@@ -0,0 +1,65 @@
+// Place all the styles related to the rubygems controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+BODY {
+ > DIV.container.main {
+ > SECTION.rubygems {
+ > DIV.gems-list-container {
+ margin: 25px 0;
+ padding: 10px 0 15px;
+ background-color: #EFEFEF;
+ border: 5px solid #CCC;
+ border-radius: 10px;
+ -moz-border-radius: 10px;
+ -webkit-border-radius: 10px;
+
+ > DIV.title {
+ > DIV.content.columns {
+ > H1 {
+ font-size: 4rem;
+ margin: 0;
+ }
+ }
+ }
+ > DIV.entries {
+ > DIV.content.columns {
+ font-size: 1.5rem;
+ }
+ }
+ > DIV.gems {
+ margin: 10px 0;
+
+ > DIV.content.columns {
+ border: 1px solid #888;
+ background-color: #FFF;
+
+ > OL {
+ list-style-type: none;
+ padding: 10px 30px;
+ margin: 0;
+
+ > LI.rubygem {
+ padding: 10px 0;
+ border-bottom: 1px solid #CCC;
+
+ > DIV.name-and-details {
+ > DIV.name {
+
+ }
+ > DIV.details {
+ SPAN.downloads {
+ font-size: 1rem;
+ }
+ }
+ }
+ }
+ > LI.rubygem:last-child {
+ border: none;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
@@ -0,0 +1,53 @@
+class Api::V0::GemCuttersController < ApplicationController
+
+ def create
+ respond_to do |format|
+ if self.build_resource.save
+ format.any { redirect_to "/" }
+ else
+ format.any { render :action => "new" }
+ end
+ end
+ end
+
+ protected
+
+ def build_resource
+ @gem_cutter ||= end_of_association_chain.new
+ end
+
+end
+
+=begin
+return "Please ensure #{File.expand_path(Geminabox.data)} is writable by the geminabox web server." unless File.writable? Geminabox.data
+ unless params[:file] && (tmpfile = params[:file][:tempfile]) && (name = params[:file][:filename])
+ @error = "No file selected"
+ return erb(:upload)
+ end
+
+ tmpfile.binmode
+
+ Dir.mkdir(File.join(options.data, "gems")) unless File.directory? File.join(options.data, "gems")
+
+ dest_filename = File.join(options.data, "gems", File.basename(name))
+
+
+ if Geminabox.disallow_replace? and File.exist?(dest_filename)
+ existing_file_digest = Digest::SHA1.file(dest_filename).hexdigest
+ tmpfile_digest = Digest::SHA1.file(tmpfile.path).hexdigest
+
+ if existing_file_digest != tmpfile_digest
+ return error_response(409, "Gem already exists, you must delete the existing version first.")
+ else
+ return [200, "Ignoring upload, you uploaded the same thing previously."]
+ end
+ end
+
+ File.open(dest_filename, "wb") do |f|
+ while blk = tmpfile.read(65536)
+ f << blk
+ end
+ end
+ reindex
+ redirect "/"
+=end
@@ -0,0 +1,11 @@
+class Api::V0::SpecsController < ApplicationController
+
+ def index
+ send_file "/Users/jcr/Downloads/gems/specs.4.8.gz"
+ end
+
+ def prerelease
+ send_file "/Users/jcr/Downloads/gems/prerelease_specs.4.8.gz"
+ end
+
+end
@@ -0,0 +1,12 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+
+ helper_method :view
+
+ protected
+
+ def view
+ @view
+ end
+
+end
Oops, something went wrong.

0 comments on commit a9f94da

Please sign in to comment.