aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/tasks
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2008-03-30 02:17:28 +0000
committerRick Olson <technoweenie@gmail.com>2008-03-30 02:17:28 +0000
commit088ef182e3006294b8f0e9b185d272a777c4437a (patch)
tree11b760af7a23bb5280f5aef5dc61350d0ea302f1 /railties/lib/tasks
parent81286f858770e0b95e15af37f19156b044ec6a95 (diff)
downloadrails-088ef182e3006294b8f0e9b185d272a777c4437a.tar.gz
rails-088ef182e3006294b8f0e9b185d272a777c4437a.tar.bz2
rails-088ef182e3006294b8f0e9b185d272a777c4437a.zip
Added config.gem for specifying which gems are required by the application, as well as rake tasks for installing and freezing gems. [rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9140 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/tasks')
-rw-r--r--railties/lib/tasks/gems.rake31
1 files changed, 31 insertions, 0 deletions
diff --git a/railties/lib/tasks/gems.rake b/railties/lib/tasks/gems.rake
new file mode 100644
index 0000000000..198f6050c3
--- /dev/null
+++ b/railties/lib/tasks/gems.rake
@@ -0,0 +1,31 @@
+desc "List the gems that this rails application depends on"
+task :gems => :environment do
+ Rails.configuration.gems.each do |gem|
+ puts "[#{gem.loaded? ? '*' : ' '}] #{gem.name} #{gem.requirement.to_s}"
+ end
+end
+
+namespace :gems do
+ desc "Installs all required gems for this application."
+ task :install => :environment do
+ require 'rubygems'
+ require 'rubygems/gem_runner'
+ Rails.configuration.gems.each { |gem| gem.install unless gem.loaded? }
+ end
+
+ desc "Unpacks the specified gem into vendor/gems."
+ task :unpack do
+ raise "Specify name of gem in the config.gems array with GEM=" if ENV['GEM'].blank?
+ Rake::Task["environment"].invoke
+ require 'rubygems'
+ require 'rubygems/gem_runner'
+ unless Rails.configuration.gems.select do |gem|
+ if gem.loaded? && gem.name == ENV['GEM']
+ gem.unpack_to(File.join(RAILS_ROOT, 'vendor', 'gems'))
+ true
+ end
+ end.any?
+ puts "No gem named #{ENV['GEM'].inspect} found."
+ end
+ end
+end \ No newline at end of file