fesplugas (owner)

Revisions

  • db1cc8 fesplugas Wed Dec 17 08:20:23 -0800 2008
gist: 37115 Download_button fork
public
Description:
Load externals in a Rails project.
Public Clone URL: git://gist.github.com/37115.git
Embed All Files: show embed
externals.rake #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
namespace :externals do
 
  desc "List"
  task :list do
    externals = YAML.load_file("#{Rails.root}/config/externals.yml")
    externals.each do |external|
      puts "[#{external.first}]"
      external.last.each { |key, value| puts "- #{key}: #{value}" }
    end
  end
 
  desc "Update"
  task :update do
    externals = YAML.load_file("#{Rails.root}/config/externals.yml")
    externals.each do |external|
      folder = external.first
      repository = external.last['repository']
      revision = external.last['revision']
      unless File.exists?(folder)
        `git clone #{repository} #{folder}`
        puts "[#{folder}]\n - Cloning #{repository}"
      end
      Dir.chdir(folder) do
        `git pull`
        `git checkout #{revision}`
        puts "[#{folder}]\n - Pulled & checked out #{revision}"
      end
    end
  end
 
end
externals.yml #
1
2
3
4
5
6
7
vendor/plugins/typus:
  repository: git://github.com/fesplugas/typus.git
  revision: HEAD
 
vendor/plugins/exception_notification:
  repository: git://github.com/rails/exception_notification.git
  revision: HEAD