Permalink
Browse files

generate Rails 3 app skeleton for Radiant

  • Loading branch information...
1 parent adae360 commit 1d54d2025c1c0bef319d129c7bbce0c86072a19c @mislav mislav committed Feb 28, 2010
Showing with 3,009 additions and 1,940 deletions.
  1. +1 −0 .gitignore
  2. +17 −0 Gemfile
  3. +5 −5 Rakefile
  4. +4 −0 config.ru
  5. +88 −0 config/application.rb
  6. +13 −162 config/boot.rb
  7. +4 −89 config/environment.rb
  8. +23 −23 config/environments/cucumber.rb
  9. +15 −13 config/environments/development.rb
  10. +44 −17 config/environments/production.rb
  11. +32 −38 config/environments/test.rb
  12. +7 −0 config/initializers/backtrace_silencers.rb
  13. +7 −0 config/initializers/cookie_verification_secret.rb
  14. +0 −2 config/initializers/haml.rb
  15. +5 −0 config/initializers/inflections.rb
  16. +5 −0 config/initializers/mime_types.rb
  17. +7 −0 config/initializers/secret_token.rb
  18. +8 −0 config/initializers/session_store.rb
  19. +7 −0 db/seeds.rb
  20. +0 −3 lib/radiant/initializer.rb
  21. 0 log/.keep → lib/tasks/.gitkeep
  22. 0 log/.gitkeep
  23. +23 −5 public/404.html
  24. +26 −0 public/422.html
  25. +23 −5 public/500.html
  26. +77 −77 public/javascripts/admin/controls.js
  27. +170 −170 public/javascripts/admin/dragdrop.js
  28. +179 −178 public/javascripts/admin/effects.js
  29. +2,077 −909 public/javascripts/admin/prototype.js
  30. +110 −0 public/javascripts/admin/rails.js
  31. +5 −1 public/robots.txt
  32. 0 public/stylesheets/.gitkeep
  33. +0 −3 script/about
  34. +0 −5 script/autospec
  35. +0 −3 script/breakpointer
  36. +0 −3 script/console
  37. +0 −3 script/dbconsole
  38. +0 −3 script/destroy
  39. +0 −4 script/generate
  40. +0 −3 script/performance/benchmarker
  41. +0 −3 script/performance/profiler
  42. +0 −3 script/performance/request
  43. +0 −3 script/plugin
  44. +0 −3 script/process/inspector
  45. +0 −3 script/process/reaper
  46. +0 −3 script/process/spawner
  47. +0 −3 script/process/spinner
  48. +6 −0 script/rails
  49. +0 −3 script/runner
  50. +0 −3 script/server
  51. +0 −5 script/spec
  52. +0 −116 script/spec_server
  53. +0 −5 script/version
  54. +9 −0 test/performance/browsing_test.rb
  55. +12 −63 test/test_helper.rb
  56. 0 tmp/pids/.gitkeep
  57. 0 vendor/plugins/.gitkeep
View
@@ -1,3 +1,4 @@
+.bundle
config/database.yml
db/*.db
log/*.log
View
17 Gemfile
@@ -0,0 +1,17 @@
+source :gemcutter
+
+gem 'rails', '2.3.5'
+gem 'sqlite3-ruby', '~> 1.2.5'
+gem 'rack-cache', '~> 0.5.2'
+gem 'RedCloth', '~> 4.2.2'
+gem 'rdiscount', '~> 1.5.8'
+gem 'haml', '~> 2.2.20'
+gem 'highline', '~> 1.5.2'
+gem 'will_paginate', '~> 2.3.11'
+
+group :test do
+ gem 'cucumber-rails', '~> 0.3.0'
+ gem 'database_cleaner', '~> 0.5.0'
+ gem 'webrat', '~> 0.7.0'
+ gem 'rspec-rails', '~> 1.3.2'
+end
View
@@ -1,11 +1,11 @@
-require File.join(File.dirname(__FILE__), 'config', 'boot')
+# 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__)
require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'tasks/rails'
+Rails::Application.load_tasks
unless Rake::Task.task_defined? "radiant:release"
Dir["#{RADIANT_ROOT}/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
-end
+end
View
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Radiant::Application
View
@@ -0,0 +1,88 @@
+require File.expand_path('../boot', __FILE__)
+require 'rails/all'
+
+# Auto-require default libraries and those for the current Rails environment.
+Bundler.require(:default, Rails.env) if defined?(Bundler)
+
+module Radiant
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Add additional load paths for your own custom dirs
+ # config.autoload_paths += %W( #{config.root}/extras )
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Activate observers that should always be running
+ config.active_record.observers = :user_action_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
+ # config.i18n.default_locale = :de
+
+ # Comment out this line if you want to turn off all caching, or
+ # add options to modify the behavior. In the majority of deployment
+ # scenarios it is desirable to leave Radiant's cache enabled and in
+ # the default configuration.
+ #
+ # Additional options:
+ # :use_x_sendfile => true
+ # Turns on X-Sendfile support for Apache with mod_xsendfile or lighttpd.
+ # :use_x_accel_redirect => '/some/virtual/path'
+ # Turns on X-Accel-Redirect support for nginx. You have to provide
+ # a path that corresponds to a virtual location in your webserver
+ # configuration.
+ # :entitystore => "radiant:tmp/cache/entity"
+ # Sets the entity store type (preceding the colon) and storage
+ # location (following the colon, relative to Rails.root).
+ # We recommend you use radiant: since this will enable manual expiration.
+ # :metastore => "radiant:tmp/cache/meta"
+ # Sets the meta store type and storage location. We recommend you use
+ # radiant: since this will enable manual expiration and acceleration headers.
+ require 'radiant/cache'
+ config.middleware.use ::Radiant::Cache
+
+ # Configure generators values. Many other options are available, be sure to check the documentation.
+ config.generators do |g|
+ g.orm :active_record
+ g.template_engine :haml
+ g.test_framework :rspec, :fixture => false
+ end
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password]
+
+ initializer "haml" do
+ require 'haml/template'
+ require 'sass/plugin'
+ Haml::Template.options[:format] = :html5
+ Haml::Template.options[:ugly] = Rails.env.production?
+ end
+
+ initializer "admin_ui" do
+ require 'radiant/admin_ui'
+ AdminUI.instance.load_default_nav
+ end
+
+ config.secret_token = "4ac217d6512aae25ea83a25d58c30bed06520ac20ff8040da552f88d3046cf9103c1a7ca21254c9fc64a6f3dd59e00e206e7c410d612390be23d834b48f7b1e8"
+
+ config.action_view.field_error_proc = Proc.new do |html, instance|
+ if html !~ /label/
+ %{<span class="error-with-field">#{html} <span class="error">&bull; #{[instance.error_message].flatten.first}</span></span>}
+ else
+ html
+ end
+ end
+ end
+end
View
@@ -1,162 +1,13 @@
-# Don't change this file!
-# Configure your app in config/environment.rb and config/environments/*.rb
-
-RAILS_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..") unless defined?(RAILS_ROOT)
-
-module Rails
- class << self
- def vendor_rails?
- File.exist?("#{RAILS_ROOT}/vendor/rails")
- end
- end
-end
-
-module Radiant
- class << self
- def boot!
- unless booted?
- preinitialize
- pick_boot.run
- end
- end
-
- def booted?
- defined? Radiant::Initializer
- end
-
- def pick_boot
- case
- when app?
- AppBoot.new
- when vendor?
- VendorBoot.new
- else
- GemBoot.new
- end
- end
-
- def vendor?
- File.exist?("#{RAILS_ROOT}/vendor/radiant")
- end
-
- def app?
- File.exist?("#{RAILS_ROOT}/lib/radiant.rb")
- end
-
- def preinitialize
- load(preinitializer_path) if File.exist?(preinitializer_path)
- end
-
- def loaded_via_gem?
- pick_boot.is_a? GemBoot
- end
-
- def preinitializer_path
- "#{RAILS_ROOT}/config/preinitializer.rb"
- end
- end
-
- class Boot
- def run
- load_initializer
- end
-
- def load_initializer
- begin
- require 'radiant'
- require 'radiant/initializer'
- rescue LoadError => e
- $stderr.puts %(Radiant could not be initialized. #{load_error_message})
- exit 1
- end
- Radiant::Initializer.run(:set_load_path)
- end
- end
-
- class VendorBoot < Boot
- def load_initializer
- $LOAD_PATH.unshift "#{RAILS_ROOT}/vendor/radiant/lib"
- super
- end
-
- def load_error_message
- "Please verify that vendor/radiant contains a complete copy of the Radiant sources."
- end
- end
-
- class AppBoot < Boot
- def load_initializer
- $LOAD_PATH.unshift "#{RAILS_ROOT}/lib"
- super
- end
-
- def load_error_message
- "Please verify that you have a complete copy of the Radiant sources."
- end
- end
-
- class GemBoot < Boot
- def load_initializer
- self.class.load_rubygems
- load_radiant_gem
- super
- end
-
- def load_error_message
- "Please reinstall the Radiant gem with the command 'gem install radiant'."
- end
-
- def load_radiant_gem
- if version = self.class.gem_version
- gem 'radiant', version
- else
- gem 'radiant'
- end
- rescue Gem::LoadError => load_error
- $stderr.puts %(Missing the Radiant #{version} gem. Please `gem install -v=#{version} radiant`, update your RADIANT_GEM_VERSION setting in config/environment.rb for the Radiant version you do have installed, or comment out RADIANT_GEM_VERSION to use the latest version installed.)
- exit 1
- end
-
- class << self
- def rubygems_version
- Gem::RubyGemsVersion rescue nil
- end
-
- def gem_version
- if defined? RADIANT_GEM_VERSION
- RADIANT_GEM_VERSION
- elsif ENV.include?('RADIANT_GEM_VERSION')
- ENV['RADIANT_GEM_VERSION']
- else
- parse_gem_version(read_environment_rb)
- end
- end
-
- def load_rubygems
- require 'rubygems'
-
- min_version = '1.3.1'
- unless rubygems_version >= min_version
- $stderr.puts %(Radiant requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
- exit 1
- end
-
- rescue LoadError
- $stderr.puts %(Radiant requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
- exit 1
- end
-
- def parse_gem_version(text)
- $1 if text =~ /^[^#]*RADIANT_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
- end
-
- private
- def read_environment_rb
- File.read("#{RAILS_ROOT}/config/environment.rb")
- end
- end
- end
-end
-
-# All that for this:
-Radiant.boot!
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+gemfile = File.expand_path('../../Gemfile', __FILE__)
+begin
+ ENV['BUNDLE_GEMFILE'] = gemfile
+ require 'bundler'
+ Bundler.setup
+rescue Bundler::GemNotFound => e
+ STDERR.puts e.message
+ STDERR.puts "Try running `bundle install`."
+ exit!
+end if File.exist?(gemfile)
Oops, something went wrong.

0 comments on commit 1d54d20

Please sign in to comment.