add hook and a template to use chinese gem mirror site
authorErick Guan <fantasticfears@gmail.com>
Sun, 9 Nov 2014 17:45:05 +0000 (01:45 +0800)
committerErick Guan <fantasticfears@gmail.com>
Sun, 9 Nov 2014 17:45:05 +0000 (01:45 +0800)
templates/web.china.template.yml [new file with mode: 0644]
templates/web.template.yml

diff --git a/templates/web.china.template.yml b/templates/web.china.template.yml
new file mode 100644 (file)
index 0000000..4d59ff9
--- /dev/null
@@ -0,0 +1,11 @@
+hooks:
+  before_web:
+    - exec:
+       cmd:
+         - gem sources --remove https://rubygems.org/
+         - gem sources -a https://ruby.taobao.org/
+
+  before_bundle_exec:
+    - exec:
+      cmd:
+        - su discourse -c 'bundle config mirror.https://rubygems.org https://ruby.taobao.org/'
index 532a1b1abce6f8c0bc5ac9ba22956d46ac7eef0c..75afd99b73f5e582f7b0a2015b8831334a34821d 100644 (file)
@@ -127,6 +127,11 @@ run:
         # ensure we are on latest bundler
         - gem update bundler
         - chown -R discourse $home
+
+  - exec:
+      cd: $home
+      hook: bundle_exec
+      cmd:
         - su discourse -c 'bundle install --deployment --verbose --without test --without development'
         - su discourse -c 'bundle exec rake db:migrate'
         - su discourse -c 'bundle exec rake assets:precompile'