From fb89d7fa6d21a4b0faab753ff3a7c934d9d59883 Mon Sep 17 00:00:00 2001 From: Tim Morgan Date: Fri, 16 May 2008 07:19:00 -0500 Subject: Run gem install as external command. [#210 state:resolved] --- railties/lib/rails/gem_dependency.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb index 2034841cd2..582861abf4 100644 --- a/railties/lib/rails/gem_dependency.rb +++ b/railties/lib/rails/gem_dependency.rb @@ -73,7 +73,7 @@ module Rails end def install - Gem::GemRunner.new.run(install_command) + puts `#{gem_command} #{install_command.join(' ')}` end def unpack_to(directory) @@ -100,6 +100,10 @@ private ################################################################### def specification @spec ||= Gem.source_index.search(Gem::Dependency.new(@name, @requirement)).sort_by { |s| s.version }.last end + + def gem_command + RUBY_PLATFORM =~ /win32/ ? 'gem.bat' : 'gem' + end def install_command cmd = %w(install) << @name -- cgit v1.2.3 From 9c4f00350a61987afad50ebb8d319d7e889b6cfd Mon Sep 17 00:00:00 2001 From: rick Date: Sat, 31 May 2008 15:58:08 -0700 Subject: fix Gem installation command with versions --- railties/lib/rails/gem_dependency.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb index 582861abf4..22ee0e3601 100644 --- a/railties/lib/rails/gem_dependency.rb +++ b/railties/lib/rails/gem_dependency.rb @@ -73,7 +73,9 @@ module Rails end def install - puts `#{gem_command} #{install_command.join(' ')}` + cmd = "#{gem_command} #{install_command.join(' ')}" + puts cmd + puts %x(#{cmd}) end def unpack_to(directory) @@ -107,7 +109,7 @@ private ################################################################### def install_command cmd = %w(install) << @name - cmd << "--version" << "#{@requirement.to_s}" if @requirement + cmd << "--version" << %("#{@requirement.to_s}") if @requirement cmd << "--source" << @source if @source cmd end -- cgit v1.2.3 From d5bcff172b6253684cf5cc3345a3d390096ba957 Mon Sep 17 00:00:00 2001 From: rick Date: Sat, 31 May 2008 16:36:34 -0700 Subject: Consolidate error messages for missing gems, and skip them when running rake gems:* tasks. [rick] --- railties/lib/rails/gem_dependency.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb index 22ee0e3601..0e39f6fd0a 100644 --- a/railties/lib/rails/gem_dependency.rb +++ b/railties/lib/rails/gem_dependency.rb @@ -36,7 +36,6 @@ module Rails end @load_paths_added = true rescue Gem::LoadError - puts $!.to_s end def dependencies -- cgit v1.2.3 From 224c8e6afb464a4b04621189963ec03d1d3487d0 Mon Sep 17 00:00:00 2001 From: Dmitriy Timokhin Date: Wed, 7 May 2008 17:43:12 +0400 Subject: Expose GemPlugin load_paths so they can be added to Dependencies.load_paths. Also use full_gem_path as root of GemPlugin to make things compatible. [#213 state:resolved] --- railties/lib/rails/plugin.rb | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 04f7e37a20..fdaec34c59 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -98,23 +98,19 @@ module Rails end end - # This Plugin subclass represents a Gem plugin. It behaves exactly like a - # "traditional" Rails plugin, but doesn't expose any additional load paths, - # since RubyGems has already taken care of things. + # This Plugin subclass represents a Gem plugin. Although RubyGems has already + # taken care of $LOAD_PATH's, it have to expose its load_path's to add them + # to Dependencies.load_paths. class GemPlugin < Plugin # Initialize this plugin from a Gem::Specification. def initialize(spec) - super(File.join(spec.full_gem_path, "rails")) + super(File.join(spec.full_gem_path)) @name = spec.name end - def valid? - true - end - - def load_paths - [] + def init_path + File.join(directory, 'rails', 'init.rb') end end end \ No newline at end of file -- cgit v1.2.3 From a6e79083273dfb1a62aa8ff02db07454c65729ff Mon Sep 17 00:00:00 2001 From: rick Date: Sat, 31 May 2008 16:46:47 -0700 Subject: fix doc typos --- railties/lib/rails/plugin.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index fdaec34c59..256f4b0132 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -99,10 +99,9 @@ module Rails end # This Plugin subclass represents a Gem plugin. Although RubyGems has already - # taken care of $LOAD_PATH's, it have to expose its load_path's to add them + # taken care of $LOAD_PATHs, it exposes its load_paths to add them # to Dependencies.load_paths. class GemPlugin < Plugin - # Initialize this plugin from a Gem::Specification. def initialize(spec) super(File.join(spec.full_gem_path)) -- cgit v1.2.3 From f9db7695fe3c148c8d1077f1564e5b94d126b83b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 31 May 2008 17:03:03 -0700 Subject: Making ready for release of 2.1 --- railties/lib/rails/version.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/version.rb b/railties/lib/rails/version.rb index fea63beea9..48d24da52e 100644 --- a/railties/lib/rails/version.rb +++ b/railties/lib/rails/version.rb @@ -1,8 +1,8 @@ module Rails module VERSION #:nodoc: MAJOR = 2 - MINOR = 0 - TINY = 991 + MINOR = 1 + TINY = 0 STRING = [MAJOR, MINOR, TINY].join('.') end -- cgit v1.2.3 From 71528b1825ce5184b23d09f923cb72f4073ce8ed Mon Sep 17 00:00:00 2001 From: rick Date: Sat, 31 May 2008 17:22:16 -0700 Subject: Previously we only added the "lib" subdirectory to the load path when setting up gem dependencies for frozen gems. Now we add the "ext" subdirectory as well for those gems which have compiled C extensions as well. [Wincent Colaiuta] [#268 state:resolved] --- railties/lib/rails/gem_dependency.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb index 0e39f6fd0a..9f088a18dd 100644 --- a/railties/lib/rails/gem_dependency.rb +++ b/railties/lib/rails/gem_dependency.rb @@ -31,7 +31,9 @@ module Rails args << @requirement.to_s if @requirement gem *args else - $LOAD_PATH << File.join(unpacked_paths.first, 'lib') + $LOAD_PATH.unshift File.join(unpacked_paths.first, 'lib') + ext = File.join(unpacked_paths.first, 'ext') + $LOAD_PATH.unshift(ext) if File.exist?(ext) @frozen = true end @load_paths_added = true -- cgit v1.2.3 From a980eb8c7734f14109d8c2a02a88dafdf682e0dc Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sun, 1 Jun 2008 13:18:31 -0700 Subject: Added Rack middleware to handle static files. --- railties/lib/rails/rack.rb | 5 +++++ railties/lib/rails/rack/static.rb | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 railties/lib/rails/rack.rb create mode 100644 railties/lib/rails/rack/static.rb (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/rack.rb b/railties/lib/rails/rack.rb new file mode 100644 index 0000000000..abcd0741bf --- /dev/null +++ b/railties/lib/rails/rack.rb @@ -0,0 +1,5 @@ +module Rails + module Rack + autoload :Static, "rails/rack/static" + end +end diff --git a/railties/lib/rails/rack/static.rb b/railties/lib/rails/rack/static.rb new file mode 100644 index 0000000000..45eb0e5921 --- /dev/null +++ b/railties/lib/rails/rack/static.rb @@ -0,0 +1,35 @@ +module Rails + module Rack + class Static + FILE_METHODS = %w(GET HEAD).freeze + + def initialize(app) + @app = app + @file_server = ::Rack::File.new(File.join(RAILS_ROOT, "public")) + end + + def call(env) + path = env['PATH_INFO'].chomp('/') + method = env['REQUEST_METHOD'] + cached_path = (path.empty? ? 'index' : path) + ::ActionController::Base.page_cache_extension + + if FILE_METHODS.include?(method) + if file_exist?(path) + return @file_server.call(env) + elsif file_exist?(cached_path) + env['PATH_INFO'] = cached_path + return @file_server.call(env) + end + end + + @app.call(env) + end + + private + def file_exist?(path) + full_path = File.join(@file_server.root, ::Rack::Utils.unescape(path)) + File.file?(full_path) && File.readable?(full_path) + end + end + end +end -- cgit v1.2.3