Sha256: dabab1db493ebf1b48a841ea63315831902ae719d0e6b308ffca02cf9e61ebeb

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

module Rda
  class App < Thor
    desc 'Restart', 'Restart the application'
    def restart
      FileUtils.touch dir_of('tmp') + '/restart.txt'
    end

    desc 'Release', 'Release the application'
    def release
      version_file = File.join(Rda::Rails.root, 'VERSION')
      version = File.exist?(version_file) ? File.read(version_file).strip : ""

      app_name = Rda::Rails.app_name

      pkg_dir = dir_of('pkg')
      tmp_dir = dir_of("pkg/#{app_name}")

      system("rm -fr #{tmp_dir}")
      system("git clone #{Rda::Rails.root} #{tmp_dir}")

      puts "Create the src release..."
      system("rm -fr #{tmp_dir}/.git")
      system("rm -fr #{tmp_dir}/.gitignore")
      system("cd #{pkg_dir};tar czf #{app_name}-#{version}.src.tar.gz #{app_name}")

      puts "Create the bin release..."
      system("bundle package")
      system("mv #{Rda::Rails.root}/vendor/cache #{tmp_dir}/vendor")
      system("cd #{pkg_dir};tar czf #{app_name}-#{version}.bin.tar.gz #{app_name}")
      system("rm -fr #{tmp_dir}")
      puts "#{app_name} #{version} released!"
    end

    private
    def dir_of(dir)
      dir = File.join(Rda::Rails.root.to_s, dir)
      FileUtils.mkdir_p dir unless File.directory?(dir)

      dir
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rda-0.3.3 lib/rda/app.rb
rda-0.3.2 lib/rda/app.rb