Permalink
Browse files

app install step

  • Loading branch information...
1 parent 32b40d0 commit c562ca1e246cb13b752e1e9b624a8a5cfb0fd354 @rossriley rossriley committed Nov 2, 2011
Showing with 41 additions and 1 deletion.
  1. +40 −0 lib/obbistrano_tasks.rb
  2. BIN obbistrano-1.1.58.gem
  3. +1 −1 obbistrano.gemspec
View
@@ -239,6 +239,42 @@
run "cd #{deploy_to} && find tmp/log -type f -exec rm -f \"{}\" \\;"
end
+
+ desc "Uses configs in the app/platform directory to configure servers"
+ task :install, :roles =>[:host] do
+ config_check
+ needs_root
+ begin
+ with_user("root", "#{root_pass}") do
+ run "ln -s /etc/nginx/sites-enabled/#{user}.conf #{deploy_to}/app/platform/nginx.conf"
+ run "ln -s /etc/apache2/sites-enabled/#{user}.conf #{deploy_to}/app/platform/apache.conf"
+ end
+ user_cron_tasks = capture("cat #{deploy_to}/app/platform/crontab")
+ run write_crontab(user_cron_tasks)
+ rescue
+
+ end
+ end
+
+ def write_crontab(data)
+ tmp_cron_file = Tempfile.new('temp_cron').path
+ File.open(tmp_cron_file, File::WRONLY | File::APPEND) do |file|
+ file.puts data
+ end
+
+ command = ['crontab']
+ command << "-u #{user}" if defined? "#{user}"
+ command << tmp_cron_file
+
+ if system(command.join(' '))
+ puts "[write] crontab file updated"
+ exit
+ else
+ warn "[fail] couldn't write crontab"
+ exit(1)
+ end
+ end
+
end
@@ -354,6 +390,10 @@ def close_sessions
eval "#{os_ver}".testos
end
+
+
+ end
+
# =============================================================================
# +MIGRATING+ APPLICATIONS
View
Binary file not shown.
View
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = %q{obbistrano}
- s.version = "1.1.58"
+ s.version = "1.1.59"
s.authors = ["Ross Riley", "One Black Bear"]
s.date = Time.now
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=

0 comments on commit c562ca1

Please sign in to comment.