fizx-collapsed_routes 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/.document +5 -0
  2. data/.gitignore +5 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +86 -0
  5. data/Rakefile +48 -0
  6. data/VERSION +1 -0
  7. data/collapsed_routes.gemspec +136 -0
  8. data/lib/collapsed_routes.rb +53 -0
  9. data/spec/app/README +243 -0
  10. data/spec/app/Rakefile +10 -0
  11. data/spec/app/app/controllers/application_controller.rb +10 -0
  12. data/spec/app/app/controllers/comments_controller.rb +85 -0
  13. data/spec/app/app/controllers/posts_controller.rb +85 -0
  14. data/spec/app/app/controllers/users_controller.rb +85 -0
  15. data/spec/app/app/helpers/application_helper.rb +3 -0
  16. data/spec/app/app/helpers/comments_helper.rb +2 -0
  17. data/spec/app/app/helpers/posts_helper.rb +2 -0
  18. data/spec/app/app/helpers/users_helper.rb +2 -0
  19. data/spec/app/app/models/comment.rb +3 -0
  20. data/spec/app/app/models/post.rb +4 -0
  21. data/spec/app/app/models/user.rb +3 -0
  22. data/spec/app/app/views/comments/edit.html.erb +24 -0
  23. data/spec/app/app/views/comments/index.html.erb +24 -0
  24. data/spec/app/app/views/comments/new.html.erb +23 -0
  25. data/spec/app/app/views/comments/show.html.erb +18 -0
  26. data/spec/app/app/views/layouts/comments.html.erb +17 -0
  27. data/spec/app/app/views/layouts/posts.html.erb +17 -0
  28. data/spec/app/app/views/layouts/users.html.erb +17 -0
  29. data/spec/app/app/views/posts/edit.html.erb +24 -0
  30. data/spec/app/app/views/posts/index.html.erb +24 -0
  31. data/spec/app/app/views/posts/new.html.erb +23 -0
  32. data/spec/app/app/views/posts/show.html.erb +18 -0
  33. data/spec/app/app/views/users/edit.html.erb +16 -0
  34. data/spec/app/app/views/users/index.html.erb +20 -0
  35. data/spec/app/app/views/users/new.html.erb +15 -0
  36. data/spec/app/app/views/users/show.html.erb +8 -0
  37. data/spec/app/config/boot.rb +110 -0
  38. data/spec/app/config/database.yml +22 -0
  39. data/spec/app/config/environment.rb +41 -0
  40. data/spec/app/config/environments/development.rb +17 -0
  41. data/spec/app/config/environments/production.rb +28 -0
  42. data/spec/app/config/environments/test.rb +28 -0
  43. data/spec/app/config/initializers/backtrace_silencers.rb +7 -0
  44. data/spec/app/config/initializers/inflections.rb +10 -0
  45. data/spec/app/config/initializers/mime_types.rb +5 -0
  46. data/spec/app/config/initializers/new_rails_defaults.rb +19 -0
  47. data/spec/app/config/initializers/session_store.rb +15 -0
  48. data/spec/app/config/locales/en.yml +5 -0
  49. data/spec/app/config/routes.rb +7 -0
  50. data/spec/app/db/migrate/20090623181503_create_users.rb +13 -0
  51. data/spec/app/db/migrate/20090623181555_create_posts.rb +15 -0
  52. data/spec/app/db/migrate/20090623181609_create_comments.rb +15 -0
  53. data/spec/app/db/schema.rb +36 -0
  54. data/spec/app/db/test.sqlite3 +0 -0
  55. data/spec/app/doc/README_FOR_APP +2 -0
  56. data/spec/app/lib/tasks/rspec.rake +167 -0
  57. data/spec/app/log/.gitignore +1 -0
  58. data/spec/app/script/about +4 -0
  59. data/spec/app/script/autospec +6 -0
  60. data/spec/app/script/console +3 -0
  61. data/spec/app/script/dbconsole +3 -0
  62. data/spec/app/script/destroy +3 -0
  63. data/spec/app/script/generate +3 -0
  64. data/spec/app/script/performance/benchmarker +3 -0
  65. data/spec/app/script/performance/profiler +3 -0
  66. data/spec/app/script/plugin +3 -0
  67. data/spec/app/script/runner +3 -0
  68. data/spec/app/script/server +3 -0
  69. data/spec/app/script/spec +10 -0
  70. data/spec/app/script/spec_server +9 -0
  71. data/spec/app/tmp/.gitignore +4 -0
  72. data/spec/collapsed_routes_spec.rb +39 -0
  73. data/spec/spec_helper.rb +13 -0
  74. metadata +153 -0
@@ -0,0 +1,110 @@
1
+ # Don't change this file!
2
+ # Configure your app in config/environment.rb and config/environments/*.rb
3
+
4
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5
+
6
+ module Rails
7
+ class << self
8
+ def boot!
9
+ unless booted?
10
+ preinitialize
11
+ pick_boot.run
12
+ end
13
+ end
14
+
15
+ def booted?
16
+ defined? Rails::Initializer
17
+ end
18
+
19
+ def pick_boot
20
+ (vendor_rails? ? VendorBoot : GemBoot).new
21
+ end
22
+
23
+ def vendor_rails?
24
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
25
+ end
26
+
27
+ def preinitialize
28
+ load(preinitializer_path) if File.exist?(preinitializer_path)
29
+ end
30
+
31
+ def preinitializer_path
32
+ "#{RAILS_ROOT}/config/preinitializer.rb"
33
+ end
34
+ end
35
+
36
+ class Boot
37
+ def run
38
+ load_initializer
39
+ Rails::Initializer.run(:set_load_path)
40
+ end
41
+ end
42
+
43
+ class VendorBoot < Boot
44
+ def load_initializer
45
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
+ Rails::Initializer.run(:install_gem_spec_stubs)
47
+ Rails::GemDependency.add_frozen_gem_path
48
+ end
49
+ end
50
+
51
+ class GemBoot < Boot
52
+ def load_initializer
53
+ self.class.load_rubygems
54
+ load_rails_gem
55
+ require 'initializer'
56
+ end
57
+
58
+ def load_rails_gem
59
+ if version = self.class.gem_version
60
+ gem 'rails', version
61
+ else
62
+ gem 'rails'
63
+ end
64
+ rescue Gem::LoadError => load_error
65
+ $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
66
+ exit 1
67
+ end
68
+
69
+ class << self
70
+ def rubygems_version
71
+ Gem::RubyGemsVersion rescue nil
72
+ end
73
+
74
+ def gem_version
75
+ if defined? RAILS_GEM_VERSION
76
+ RAILS_GEM_VERSION
77
+ elsif ENV.include?('RAILS_GEM_VERSION')
78
+ ENV['RAILS_GEM_VERSION']
79
+ else
80
+ parse_gem_version(read_environment_rb)
81
+ end
82
+ end
83
+
84
+ def load_rubygems
85
+ require 'rubygems'
86
+ min_version = '1.3.1'
87
+ unless rubygems_version >= min_version
88
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
89
+ exit 1
90
+ end
91
+
92
+ rescue LoadError
93
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
94
+ exit 1
95
+ end
96
+
97
+ def parse_gem_version(text)
98
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
99
+ end
100
+
101
+ private
102
+ def read_environment_rb
103
+ File.read("#{RAILS_ROOT}/config/environment.rb")
104
+ end
105
+ end
106
+ end
107
+ end
108
+
109
+ # All that for this:
110
+ Rails.boot!
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,41 @@
1
+ # Be sure to restart your server when you modify this file
2
+
3
+ # Specifies gem version of Rails to use when vendor/rails is not present
4
+ RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
5
+
6
+ # Bootstrap the Rails environment, frameworks, and default configuration
7
+ require File.join(File.dirname(__FILE__), 'boot')
8
+
9
+ Rails::Initializer.run do |config|
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Add additional load paths for your own custom dirs
15
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
16
+
17
+ # Specify gems that this application depends on and have them installed with rake gems:install
18
+ # config.gem "bj"
19
+ # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
20
+ # config.gem "sqlite3-ruby", :lib => "sqlite3"
21
+ # config.gem "aws-s3", :lib => "aws/s3"
22
+
23
+ # Only load the plugins named here, in the order given (default is alphabetical).
24
+ # :all can be used as a placeholder for all plugins not explicitly named
25
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
26
+
27
+ # Skip frameworks you're not going to use. To use Rails without a database,
28
+ # you must remove the Active Record framework.
29
+ # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
30
+
31
+ # Activate observers that should always be running
32
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
33
+
34
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
35
+ # Run "rake -D time" for a list of tasks for finding time zone names.
36
+ config.time_zone = 'UTC'
37
+
38
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
39
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
40
+ # config.i18n.default_locale = :de
41
+ end
@@ -0,0 +1,17 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # In the development environment your application's code is reloaded on
4
+ # every request. This slows down response time but is perfect for development
5
+ # since you don't have to restart the webserver when you make code changes.
6
+ config.cache_classes = false
7
+
8
+ # Log error messages when you accidentally call methods on nil.
9
+ config.whiny_nils = true
10
+
11
+ # Show full error reports and disable caching
12
+ config.action_controller.consider_all_requests_local = true
13
+ config.action_view.debug_rjs = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,28 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The production environment is meant for finished, "live" apps.
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.action_controller.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+ config.action_view.cache_template_loading = true
11
+
12
+ # See everything in the log (default is :info)
13
+ # config.log_level = :debug
14
+
15
+ # Use a different logger for distributed setups
16
+ # config.logger = SyslogLogger.new
17
+
18
+ # Use a different cache store in production
19
+ # config.cache_store = :mem_cache_store
20
+
21
+ # Enable serving of images, stylesheets, and javascripts from an asset server
22
+ # config.action_controller.asset_host = "http://assets.example.com"
23
+
24
+ # Disable delivery errors, bad email addresses will be ignored
25
+ # config.action_mailer.raise_delivery_errors = false
26
+
27
+ # Enable threaded mode
28
+ # config.threadsafe!
@@ -0,0 +1,28 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+ config.cache_classes = true
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+ config.action_view.cache_template_loading = true
16
+
17
+ # Disable request forgery protection in test environment
18
+ config.action_controller.allow_forgery_protection = false
19
+
20
+ # Tell Action Mailer not to deliver emails to the real world.
21
+ # The :test delivery method accumulates sent emails in the
22
+ # ActionMailer::Base.deliveries array.
23
+ config.action_mailer.delivery_method = :test
24
+
25
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
26
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
27
+ # like if you have constraints or database-specific column types
28
+ # config.active_record.schema_format = :sql
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,19 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # These settings change the behavior of Rails 2 apps and will be defaults
4
+ # for Rails 3. You can remove this initializer when Rails 3 is released.
5
+
6
+ if defined?(ActiveRecord)
7
+ # Include Active Record class name as root for JSON serialized output.
8
+ ActiveRecord::Base.include_root_in_json = true
9
+
10
+ # Store the full class name (including module namespace) in STI type column.
11
+ ActiveRecord::Base.store_full_sti_class = true
12
+ end
13
+
14
+ # Use ISO 8601 format for JSON serialized times and dates.
15
+ ActiveSupport.use_standard_json_time_format = true
16
+
17
+ # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
18
+ # if you're including raw json in an HTML page.
19
+ ActiveSupport.escape_html_entities_in_json = false
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying cookie session data integrity.
4
+ # If you change this key, all old sessions will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ ActionController::Base.session = {
8
+ :key => '_app_session',
9
+ :secret => '3dae2a90673666107162b6b410fd610434ac7335fc51db39bfaba82495e73aac088e7f682ca1ab23cc04a429a43833cb627a3a6199cda5ca796878713be31c9b'
10
+ }
11
+
12
+ # Use the database for sessions instead of the cookie-based default,
13
+ # which shouldn't be used to store highly confidential information
14
+ # (create the session table with "rake db:sessions:create")
15
+ # ActionController::Base.session_store = :active_record_store
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,7 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ map.resources :users do |user|
3
+ user.resources :posts do |post|
4
+ post.resources :comments
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :users do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :users
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :posts do |t|
4
+ t.integer :user_id
5
+ t.string :title
6
+ t.text :body
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :posts
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ class CreateComments < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :comments do |t|
4
+ t.integer :post_id
5
+ t.string :title
6
+ t.text :body
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :comments
14
+ end
15
+ end
@@ -0,0 +1,36 @@
1
+ # This file is auto-generated from the current state of the database. Instead of editing this file,
2
+ # please use the migrations feature of Active Record to incrementally modify your database, and
3
+ # then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6
+ # to create the application database on another system, you should be using db:schema:load, not running
7
+ # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
9
+ #
10
+ # It's strongly recommended to check this file into your version control system.
11
+
12
+ ActiveRecord::Schema.define(:version => 20090623181609) do
13
+
14
+ create_table "comments", :force => true do |t|
15
+ t.integer "post_id"
16
+ t.string "title"
17
+ t.text "body"
18
+ t.datetime "created_at"
19
+ t.datetime "updated_at"
20
+ end
21
+
22
+ create_table "posts", :force => true do |t|
23
+ t.integer "user_id"
24
+ t.string "title"
25
+ t.text "body"
26
+ t.datetime "created_at"
27
+ t.datetime "updated_at"
28
+ end
29
+
30
+ create_table "users", :force => true do |t|
31
+ t.string "name"
32
+ t.datetime "created_at"
33
+ t.datetime "updated_at"
34
+ end
35
+
36
+ end
Binary file
@@ -0,0 +1,2 @@
1
+ Use this README file to introduce your application and point to useful places in the API for learning more.
2
+ Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
@@ -0,0 +1,167 @@
1
+ gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
2
+ rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
3
+ $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib") if File.exist?(rspec_plugin_dir)
4
+
5
+ # Don't load rspec if running "rake gems:*"
6
+ unless ARGV.any? {|a| a =~ /^gems/}
7
+
8
+ begin
9
+ require 'spec/rake/spectask'
10
+ rescue MissingSourceFile
11
+ module Spec
12
+ module Rake
13
+ class SpecTask
14
+ def initialize(name)
15
+ task name do
16
+ # if rspec-rails is a configured gem, this will output helpful material and exit ...
17
+ require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
18
+
19
+ # ... otherwise, do this:
20
+ raise <<-MSG
21
+
22
+ #{"*" * 80}
23
+ * You are trying to run an rspec rake task defined in
24
+ * #{__FILE__},
25
+ * but rspec can not be found in vendor/gems, vendor/plugins or system gems.
26
+ #{"*" * 80}
27
+ MSG
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ Rake.application.instance_variable_get('@tasks').delete('default')
36
+
37
+ spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
38
+ task :noop do
39
+ end
40
+
41
+ task :default => :spec
42
+ task :stats => "spec:statsetup"
43
+
44
+ desc "Run all specs in spec directory (excluding plugin specs)"
45
+ Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
46
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
47
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
48
+ end
49
+
50
+ namespace :spec do
51
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
52
+ Spec::Rake::SpecTask.new(:rcov) do |t|
53
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
54
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
55
+ t.rcov = true
56
+ t.rcov_opts = lambda do
57
+ IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
58
+ end
59
+ end
60
+
61
+ desc "Print Specdoc for all specs (excluding plugin specs)"
62
+ Spec::Rake::SpecTask.new(:doc) do |t|
63
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
64
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
65
+ end
66
+
67
+ desc "Print Specdoc for all plugin examples"
68
+ Spec::Rake::SpecTask.new(:plugin_doc) do |t|
69
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
70
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*')
71
+ end
72
+
73
+ [:models, :controllers, :views, :helpers, :lib].each do |sub|
74
+ desc "Run the code examples in spec/#{sub}"
75
+ Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
76
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
77
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
78
+ end
79
+ end
80
+
81
+ desc "Run the code examples in vendor/plugins (except RSpec's own)"
82
+ Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
83
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
84
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
85
+ end
86
+
87
+ namespace :plugins do
88
+ desc "Runs the examples for rspec_on_rails"
89
+ Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
90
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
91
+ t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*/*_spec.rb']
92
+ end
93
+ end
94
+
95
+ # Setup specs for stats
96
+ task :statsetup do
97
+ require 'code_statistics'
98
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
99
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
100
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
101
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
102
+ ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
103
+ ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
104
+ ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
105
+ ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
106
+ ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
107
+ ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
108
+ ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
109
+ ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
110
+ end
111
+
112
+ namespace :db do
113
+ namespace :fixtures do
114
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
115
+ task :load => :environment do
116
+ ActiveRecord::Base.establish_connection(Rails.env)
117
+ base_dir = File.join(Rails.root, 'spec', 'fixtures')
118
+ fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
119
+
120
+ require 'active_record/fixtures'
121
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
122
+ Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
123
+ end
124
+ end
125
+ end
126
+ end
127
+
128
+ namespace :server do
129
+ daemonized_server_pid = File.expand_path("#{RAILS_ROOT}/tmp/pids/spec_server.pid")
130
+
131
+ desc "start spec_server."
132
+ task :start do
133
+ if File.exist?(daemonized_server_pid)
134
+ $stderr.puts "spec_server is already running."
135
+ else
136
+ $stderr.puts %Q{Starting up spec_server ...}
137
+ FileUtils.mkdir_p('tmp/pids') unless test ?d, 'tmp/pids'
138
+ system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
139
+ end
140
+ end
141
+
142
+ desc "stop spec_server."
143
+ task :stop do
144
+ unless File.exist?(daemonized_server_pid)
145
+ $stderr.puts "No server running."
146
+ else
147
+ $stderr.puts "Shutting down spec_server ..."
148
+ system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
149
+ File.delete(daemonized_server_pid)
150
+ end
151
+ end
152
+
153
+ desc "restart spec_server."
154
+ task :restart => [:stop, :start]
155
+
156
+ desc "check if spec server is running"
157
+ task :status do
158
+ if File.exist?(daemonized_server_pid)
159
+ $stderr.puts %Q{spec_server is running (PID: #{File.read(daemonized_server_pid).gsub("\n","")})}
160
+ else
161
+ $stderr.puts "No server running."
162
+ end
163
+ end
164
+ end
165
+ end
166
+
167
+ end
@@ -0,0 +1 @@
1
+ *.log
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
4
+ require 'commands/about'
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
3
+ ENV['RSPEC'] = 'true' # allows autotest to discover rspec
4
+ ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux
5
+ system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
6
+ $stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH")
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/dbconsole'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/destroy'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/profiler'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/plugin'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/runner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/server'