Class: Rda::App
- Inherits:
-
Thor
- Object
- Thor
- Rda::App
- Includes:
- Helper, Thor::Actions
- Defined in:
- lib/rda/app.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Helper
Class Method Details
.source_root ⇒ Object
6 7 8 |
# File 'lib/rda/app.rb', line 6 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#deploy ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rda/app.rb', line 11 def deploy conf_dir = Rda.config.nginx.conf_dir unless Rda::Nginx.setup? $stderr.puts 'ERROR: Nginx is not set up properly. Please run `rda nginx setup` first.' return end domain = Rda.config.domain template("templates/nginx", "#{conf_dir}/sites-available/#{domain}") link_file("#{conf_dir}/sites-available/#{domain}", "#{conf_dir}/sites-enabled/#{domain}") unless configured?('/etc/hosts', "127.0.0.1 #{domain}") append_file "/etc/hosts", "127.0.0.1 #{domain}\n" end end |
#release ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/rda/app.rb', line 35 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 --all") 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 |
#restart ⇒ Object
30 31 32 |
# File 'lib/rda/app.rb', line 30 def restart FileUtils.touch dir_of('tmp') + '/restart.txt' end |