Sha256: 067747f06c3edc58a36246d5ea9b8398ff8be2f4bc51d43c7b7efd133e5d3fa5
Contents?: true
Size: 1.54 KB
Versions: 39
Compression:
Stored size: 1.54 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 def add_ruby_dot_files cmd("echo '#{RUBY_ENGINE}-#{RUBY_VERSION}' > .ruby-version") cmd("echo 'rpush_test' > .ruby-gemset") 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) add_ruby_dot_files cmd('echo "gem \'rake\'" >> Gemfile') cmd('echo "gem \'pg\'" >> Gemfile') cmd("echo \"gem 'rpush', path: '#{rpush_root}'\" >> Gemfile") 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) add_ruby_dot_files 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") ensure Dir.chdir(pwd) end puts "Built into #{path}" end
Version data entries
39 entries across 39 versions & 2 rubygems