Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

vendor gems onto s3

  • Loading branch information...
commit 728c89669db821a52cc7f8e6ea401271c8529623 1 parent c2a48b5
Terence Lee hone authored
Showing with 12 additions and 32 deletions.
  1. +12 −32 Rakefile
44 Rakefile
View
@@ -27,14 +27,10 @@ def vendor_plugin(git_url)
end
end
-def gem_base
- File.expand_path("../vendor/gems", __FILE__)
-end
-
-def in_gem_env(&block)
+def in_gem_env(gem_home, &block)
old_gem_home = ENV['GEM_HOME']
old_gem_path = ENV['GEM_PATH']
- ENV['GEM_HOME'] = ENV['GEM_PATH'] = gem_base.to_s
+ ENV['GEM_HOME'] = ENV['GEM_PATH'] = gem_home.to_s
yield
@@ -43,33 +39,18 @@ def in_gem_env(&block)
end
def install_gem(gem, version)
- in_gem_env do
- cmd = "gem install #{gem} --version #{version} --no-ri --no-rdoc"
- puts(cmd)
- system(cmd)
- end
-end
-
-def uninstall_gem(gem)
- in_gem_env do
- cmd = "gem uninstall #{gem}"
- puts(cmd)
- system(cmd)
- end
-end
-
-def gem_detected?(gem)
- output = ''
- in_gem_env do
- output = `gem list #{gem}`
- end
+ name = "#{gem}-#{version}"
+ Dir.mktmpdir("#{gem}-#{version}") do |tmpdir|
+ Dir.chdir(tmpdir) do |dir|
+ FileUtils.rm_rf("#{tmpdir}/*")
- output.split("\n").each do |line|
- md = /^([\S]+)/.match(line)
- return true if md && md[1] == gem
+ in_gem_env(tmpdir) do
+ sh("gem install #{gem} --version #{version} --no-ri --no-rdoc")
+ sh("tar czvf #{tmpdir}/#{name}.tgz *")
+ s3_upload(tmpdir, name)
+ end
+ end
end
-
- false
end
desc "update plugins"
@@ -84,7 +65,6 @@ task "gem:install", :gem, :version do |t, args|
gem = args[:gem]
version = args[:version]
- uninstall_gem(gem) if gem_detected?(gem)
install_gem(gem, version)
end
Please sign in to comment.
Something went wrong with that request. Please try again.