diff options
Diffstat (limited to 'railties/lib/rails')
| -rwxr-xr-x | railties/lib/rails/commands/ncgi/tracker | 69 | ||||
| -rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 19 |
2 files changed, 13 insertions, 75 deletions
diff --git a/railties/lib/rails/commands/ncgi/tracker b/railties/lib/rails/commands/ncgi/tracker deleted file mode 100755 index 4ca12d779b..0000000000 --- a/railties/lib/rails/commands/ncgi/tracker +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env ruby - -require 'drb' -require 'thread' - -def message(s) - $stderr.puts "tracker: #{s}" if ENV && ENV["DEBUG_GATEWAY"] -end - -class Tracker - include DRbUndumped - - def initialize(instances, socket_path) - @instances = instances - @socket = File.expand_path(socket_path) - @active = false - - @listeners = [] - @instances.times { @listeners << Mutex.new } - - message "using #{@listeners.length} listeners" - message "opening socket at #{@socket}" - - @service = DRb.start_service("drbunix://#{@socket}", self) - end - - def with_listener - message "listener requested" - - mutex = has_lock = index = nil - 3.times do - @listeners.each_with_index do |mutex, index| - has_lock = mutex.try_lock - break if has_lock - end - break if has_lock - sleep 0.05 - end - - if has_lock - message "obtained listener #{index}" - @active = true - begin yield index - ensure - mutex.unlock - message "released listener #{index}" - end - else - message "dropping request because no listeners are available!" - end - end - - def background(check_interval = nil) - if check_interval - loop do - sleep check_interval - message "Idle for #{check_interval}, shutting down" unless @active - @active = false - Kernel.exit 0 - end - else DRb.thread.join - end - end -end - -socket_path = ARGV.shift -instances = ARGV.shift.to_i -t = Tracker.new(instances, socket_path) -t.background(ARGV.first ? ARGV.shift.to_i : 90) diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 22a27fdac2..c03836ed91 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -34,6 +34,9 @@ module Rails::Generators class_option :skip_prototype, :type => :boolean, :aliases => "-J", :default => false, :desc => "Skip Prototype files" + class_option :skip_git, :type => :boolean, :aliases => "-G", :default => false, + :desc => "Skip Git ignores and keeps" + # Add bin/rails options class_option :version, :type => :boolean, :aliases => "-v", :group => :rails, :desc => "Show Rails version number and quit" @@ -58,7 +61,7 @@ module Rails::Generators def create_root_files copy_file "README" - copy_file "gitignore", ".gitignore" + copy_file "gitignore", ".gitignore" unless options[:skip_git] template "Rakefile" template "config.ru" template "Gemfile" @@ -101,7 +104,7 @@ module Rails::Generators def create_lib_files empty_directory "lib" - empty_directory "lib/tasks" + empty_directory_with_gitkeep "lib/tasks" end def create_log_files @@ -124,7 +127,7 @@ module Rails::Generators end def create_public_stylesheets_files - directory "public/stylesheets" + empty_directory_with_gitkeep "public/stylesheets" end def create_prototype_files @@ -149,13 +152,13 @@ module Rails::Generators inside "tmp" do %w(sessions sockets cache pids).each do |dir| - empty_directory dir + empty_directory_with_gitkeep(dir) end end end def create_vendor_files - empty_directory "vendor/plugins" + empty_directory_with_gitkeep "vendor/plugins" end def apply_rails_template @@ -165,7 +168,6 @@ module Rails::Generators end protected - attr_accessor :rails_template def set_default_accessors! @@ -219,5 +221,10 @@ module Rails::Generators "/opt/lampp/var/mysql/mysql.sock" # xampp for linux ].find { |f| File.exist?(f) } unless RUBY_PLATFORM =~ /(:?mswin|mingw)/ end + + def empty_directory_with_gitkeep(destination, config = {}) + empty_directory(destination, config) + create_file("#{destination}/.gitkeep") unless options[:skip_git] + end end end |
