bin/vulcanize in sml-rubber-0.9.13 vs bin/vulcanize in sml-rubber-1.5.5
- old
+ new
@@ -1,41 +1,25 @@
#!/usr/bin/env ruby
-env = ENV['RUBBER_ENV'] || ENV['RAILS_ENV'] || 'development'
+require 'rubygems'
+
+env = ENV['RUBBER_ENV'] ||= 'development'
root = '.'
-# if in a rails project, then use standard generate, otherwise
-# we need a minimal rails environment for generators to run
- #
-if File.exist?(File.join(root, 'config', 'environment.rb'))
- ARGV.insert(0, 'vulcanize')
- require File.join(root, 'config', 'boot')
- require 'commands/generate'
-else
- RAILS_ENV = ENV['RAILS_ENV'] = env
- RAILS_ROOT = ENV['RAILS_ROOT'] = root
+require 'rubber'
+Rubber::initialize(root, env)
- require 'rubygems'
- gem 'rails'
- module Rails
- class << self
- def vendor_rails?
- false
- end
- end
+if Rubber::Util::is_rails2?
+ ARGV.insert(0, 'vulcanize') unless ARGV[0] == 'vulcanize' # Need for Rails 2 generator.
+ require File.expand_path('../../lib/generators/vulcanize/vulcanize_generator', __FILE__)
+else
+ begin
+ gem 'railties'
+ rescue LoadError
+ puts "Missing the railties gem. Install with `sudo gem install railties --version=3.0.0.beta3`."
+ exit(-1)
end
- require 'initializer'
- class Rails::Initializer
- def load_environment; end
- end
+ require File.expand_path('../../lib/generators/vulcanize/vulcanize_generator', __FILE__)
- Rails::Initializer.run do |config|
- config.frameworks -= [:active_record, :action_controller]
- end
-
- require 'rails_generator'
- require 'rails_generator/scripts/generate'
-
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
- Rails::Generator::Scripts::Generate.new.run(['vulcanize'] + ARGV)
+ VulcanizeGenerator.start
end