Sha256: 92fd773a566022ba465c43353446079260239f1b4e446220ace7e160cc26f282
Contents?: true
Size: 1.42 KB
Versions: 7
Compression:
Stored size: 1.42 KB
Contents
require 'fileutils' def cmd(str, clean_env = true) puts "* #{str}" retval = clean_env ? Bundler.with_clean_env { `#{str}` } : `#{str}` puts retval.strip retval end desc 'Build Rails app bundled with Rpush' task :build_rails do rpush_root = Dir.pwd path = '/tmp/rpush/rails_test' cmd("rm -rf #{path}") FileUtils.mkdir_p(path) pwd = Dir.pwd cmd("bundle exec rails --version", false) cmd("bundle exec rails new #{path} --skip-bundle", false) begin Dir.chdir(path) cmd('echo "gem \'rake\'" >> Gemfile') cmd('echo "gem \'pg\'" >> Gemfile') cmd("echo \"gem 'rpush', :path => '#{rpush_root}'\" >> Gemfile") cmd('bundle install') File.open('config/database.yml', 'w') do |fd| fd.write(<<-YML) development: adapter: postgresql database: rpush_rails_test pool: 5 timeout: 5000 YML end ensure Dir.chdir(pwd) end puts "Built into #{path}" end desc 'Build blank app bundled with Rpush' task :build_standalone do rpush_root = Dir.pwd path = '/tmp/rpush/standalone_test' cmd("rm -rf #{path}") FileUtils.mkdir_p(path) pwd = Dir.pwd begin Dir.chdir(path) cmd('echo "source \'https://rubygems.org\'" >> Gemfile') cmd('echo "gem \'rake\'" >> Gemfile') cmd('echo "gem \'rpush-redis\'" >> Gemfile') cmd("echo \"gem 'rpush', :path => '#{rpush_root}'\" >> Gemfile") cmd('bundle install') ensure Dir.chdir(pwd) end puts "Built into #{path}" end
Version data entries
7 entries across 7 versions & 1 rubygems