Changeset 69
- Timestamp:
- 06/05/06 23:59:30 (7 years ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
config/hyperde_init.rb (modified) (2 diffs)
-
script/export (modified) (3 diffs)
-
script/import (modified) (3 diffs)
-
vendor/rails/railties/lib/commands/console.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/config/hyperde_init.rb
r67 r69 4 4 5 5 Dir["#{RAILS_ROOT}/app/models/**.rb"].each { |model| require File.basename(model, ".rb") } 6 7 6 SemanticRecord::Base.logger = RAILS_DEFAULT_LOGGER 8 7 SemanticRecord::Base.configurations = File.open("#{RAILS_ROOT}/config/database.yml") { |f| YAML::load(f) } 8 9 SemanticRecord::Base.configurations[RAILS_ENV]['repository'] = ENV['REPO'] if ENV['REPO'] 10 SemanticRecord::Base.configurations[RAILS_ENV]['username'] = ENV['REPO_USERNAME'] if ENV['REPO_USERNAME'] 11 SemanticRecord::Base.configurations[RAILS_ENV]['password'] = ENV['REPO_PASSWORD'] if ENV['REPO_PASSWORD'] 12 9 13 SemanticRecord::Base.save_schema 10 14 … … 15 19 16 20 e "Running from #{$0}..." 17 AppModel.sync if $0 = = 'irb'21 AppModel.sync if $0 =~ /irb/ -
trunk/script/export
r63 r69 2 2 3 3 require 'optparse' 4 require File.dirname(__FILE__) + '/../lib/opts_addon' 4 5 5 6 OPTIONS = { :path => ARGV.first } … … 8 9 opts.banner = "Usage: ruby #{script_name} your_export_script.yml [options]" 9 10 10 # opts.on("-r", "--repo", "Select repository") { |o| OPTIONS[:repo] = o } 11 # opts.separator "" 12 11 OptsAddon.add_options(opts, OPTIONS) 13 12 opts.on("-h", "--help", 14 13 "Show this help message.") { puts opts; exit } … … 19 18 end 20 19 20 OptsAddon.set_env(OPTIONS) 21 21 22 22 require 'yaml' -
trunk/script/import
r63 r69 1 1 #!/usr/bin/env ruby 2 2 require 'optparse' 3 require File.dirname(__FILE__) + '/../lib/opts_addon' 3 4 4 5 OPTIONS = { :model => ARGV.first } … … 6 7 script_name = File.basename($0) 7 8 opts.banner = "Usage: ruby #{script_name} your_import_script.yml [options]" 8 9 opts.separator ""10 11 9 opts.on("-n", "--noclear", "Don't clear repository before importing.") { OPTIONS[:noclear] = true } 12 13 opts.separator "" 14 10 OptsAddon.add_options(opts, OPTIONS) 15 11 opts.on("-h", "--help", 16 12 "Show this help message.") { puts opts; exit } … … 21 17 end 22 18 19 OptsAddon.set_env(OPTIONS) 23 20 24 21 require 'yaml' -
trunk/vendor/rails/railties/lib/commands/console.rb
r58 r69 2 2 3 3 require 'optparse' 4 require 'opts_addon' 4 5 options = { :sandbox => false, :irb => irb } 5 6 OptionParser.new do |opt| … … 7 8 opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |options[:sandbox]| } 8 9 opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |options[:irb]| } 10 11 OptsAddon.add_options(opt, options) 9 12 opt.parse!(ARGV) 10 13 end … … 17 20 18 21 ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV'] || 'development' 22 OptsAddon.set_env(options) 23 19 24 if options[:sandbox] 20 25 puts "Loading #{ENV['RAILS_ENV']} environment in sandbox."
