capobvious 0.3.pre24 → 1.3.pre13

Sign up to get free protection for your applications and to get access to all the features.
data/bin/capobvious CHANGED
@@ -51,14 +51,14 @@ FILE
51
51
  "config/deploy.rb" => <<FILE,
52
52
  # -*- encoding : utf-8 -*-
53
53
  set :ruby_version, '#{RUBY_VERSION}'
54
- set :application, '#{File.basename(Dir.getwd)}'
54
+ set :application, "#{File.basename(Dir.getwd)}"
55
55
  set :user, "USER_NAME_HERE"
56
56
  set :serv, "IP_ADDRESS_HERE"
57
57
 
58
- set :repository, '#{repository||'REPOSITORY_HERE'}'
59
- set :branch, 'master'
60
- set :server_name, 'EXAMPLE.com'
61
- set :server_redirect, 'WWW.EXAMPLE.COM'
58
+ set :repository, "#{repository||'REPOSITORY_HERE'}"
59
+ set :branch, "master"
60
+ set :server_name, "EXAMPLE.com"
61
+ set :server_redirect, "WWW.EXAMPLE.COM"
62
62
 
63
63
  set :backup_db, false
64
64
  set :backup_sys, false
data/capobvious.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_dependency "capistrano", '~> 2.15.4'
21
+ s.add_dependency "capistrano"
22
22
  s.add_dependency "rvm-capistrano"
23
23
 
24
24
  # specify any dependencies here; for example:
@@ -15,10 +15,10 @@ Capistrano::Configuration.instance(:must_exist).load do
15
15
  end
16
16
  desc "Assets precompile"
17
17
  task :precompile, :roles => :web, :except => { :no_release => true } do
18
- #if exists?(:turbo_sprockets_rails3) && fetch(:turbo_sprockets_rails3) && !previous_release.nil? && !latest_release.nil? && previous_release != latest_release
19
- # logger.info "Copying assets folder of previous release for turbo-sprockets-rails3 gem"
20
- # run("cp -r #{previous_release}/public/assets #{latest_release}/public/")
21
- #end
18
+ if exists?(:turbo_sprockets_rails3) && fetch(:turbo_sprockets_rails3) && !previous_release.blank? && !latest_release.blank? && previous_release != latest_release
19
+ logger.info "Copying assets folder of previous release for turbo-sprockets-rails3 gem"
20
+ run("cp -r #{previous_release}/public/assets #{latest_release}/public/")
21
+ end
22
22
  t1 = Time.now
23
23
  run("cd #{latest_release} && bundle exec rake RAILS_ENV=#{rails_env} assets:precompile")
24
24
  logger.info "assets:precompile took #{(Time.now-t1).to_i} seconds"
@@ -19,14 +19,7 @@ Capistrano::Configuration.instance(:must_exist).load do
19
19
  if yml[:adapter] == "postgresql"
20
20
  logger.info("Backup database #{yml[:database]}", "Backup:db")
21
21
  command << "export PGPASSWORD=\"#{yml[:password]}\""
22
- options = {'-U' => yml[:username]}
23
- options['host'] = yml[:host] if yml[:host]
24
-
25
- options_s = ""
26
- options.each do |k,v|
27
- options_s += "#{k} #{v}"
28
- end
29
- command << "pg_dump #{options_s} #{yml[:database]} | bzip2 -c | cat"
22
+ command << "pg_dump -U #{yml[:username]} #{yml[:database]} | bzip2 -c | cat"
30
23
  else
31
24
  puts "Cannot backup, adapter #{yml[:adapter]} is not implemented for backup yet"
32
25
  end
@@ -67,17 +60,7 @@ Capistrano::Configuration.instance(:must_exist).load do
67
60
  run "mkdir -p #{shared_path}/backup"
68
61
  if yml[:adapter] == "postgresql"
69
62
  logger.important("Backup database #{yml[:database]}", "Backup:db")
70
-
71
- options = {'-U' => yml[:username]}
72
- options['-h'] = yml[:host] if yml[:host]
73
- options['-p'] = yml[:port] if yml[:port]
74
- options_s = []
75
- options.each do |k,v|
76
- options_s << "#{k} #{v}"
77
- end
78
- options_s = options_s.join(' ')
79
-
80
- run "export PGPASSWORD=\"#{yml[:password]}\" && pg_dump #{options_s} --no-owner #{yml[:database]} > #{dump_file_path}"
63
+ run "export PGPASSWORD=\"#{yml[:password]}\" && pg_dump -U #{yml[:username]} #{yml[:database]} > #{dump_file_path}"
81
64
  run "cd #{shared_path}/backup && #{arch_create} #{output_file} #{file_name} && rm #{dump_file_path}"
82
65
  else
83
66
  puts "Cannot backup, adapter #{yml[:adapter]} is not implemented for backup yet"
@@ -3,11 +3,9 @@ Capistrano::Configuration.instance(:must_exist).load do
3
3
  namespace :bundle do
4
4
  desc "Run bundle install"
5
5
  task :install do
6
- opts = []
7
- #opts << "-j#{fetch(:server_cores).to_i}" if fetch(:server_cores).to_i > 1
8
6
  deployment = "--deployment --quiet"
9
7
  without = ['development','test','production']-[rails_env]
10
- run "cd #{latest_release} && bundle install #{opts.join(' ')} --without #{without.join(" ")}"
8
+ run "cd #{latest_release} && bundle install --without #{without.join(" ")}"
11
9
  end
12
10
  end
13
11
  end
@@ -6,8 +6,6 @@ Capistrano::Configuration.instance(:must_exist).load do
6
6
  config[(key.to_sym rescue key) || key] = config.delete(key)
7
7
  end
8
8
  config
9
- rescue Errno::ENOENT
10
- return nil
11
9
  end
12
10
 
13
11
  psql = "psql -h localhost"
@@ -56,11 +54,11 @@ Capistrano::Configuration.instance(:must_exist).load do
56
54
  end
57
55
  end
58
56
 
59
- [:seed, :migrate].each do |t|
60
- task t, :roles => :db, :only => { :primary => true } do
61
- run "cd #{latest_release} && bundle exec rake RAILS_ENV=#{rails_env} db:#{t}"
62
- end
63
- end
57
+ [:seed, :migrate].each do |t|
58
+ task t do
59
+ run "cd #{latest_release} && bundle exec rake RAILS_ENV=#{rails_env} db:#{t}"
60
+ end
61
+ end
64
62
 
65
63
  task :reset do
66
64
  run "cd #{latest_release} && bundle exec rake RAILS_ENV=#{rails_env} db:reset"
@@ -1,16 +1,14 @@
1
1
  Capistrano::Configuration.instance(:must_exist).load do
2
2
 
3
3
  namespace :import do
4
- task :sys, :role => :web do
5
- find_servers_for_task(current_task).each do |current_server|
6
- if which('rsync') && local_which('rsync')
7
- logger.important('Importing with rsync', 'import:sys')
8
- system "rsync -avz --rsh='ssh -p#{current_server.port}' #{user}@#{current_server.host}:#{shared_path}/system public/"
9
- else
10
- backup.sys
11
- system "cd public && #{arch_extract} ../#{local_folder_path}/#{sys_file_name}"
12
- end
13
- break
4
+ task :sys do
5
+ #system "rm -rfv public/system/"
6
+ if which('rsync') && local_which('rsync')
7
+ logger.important('Importing with rsync', 'import:sys')
8
+ system "rsync -avz --rsh='ssh -p#{ssh_port}' #{user}@#{serv}:#{shared_path}/system public/"
9
+ else
10
+ backup.sys
11
+ system "cd public && #{arch_extract} ../#{local_folder_path}/#{sys_file_name}"
14
12
  end
15
13
  end
16
14
  end
@@ -1,5 +1,6 @@
1
1
  Capistrano::Configuration.instance(:must_exist).load do
2
- #after 'deploy:setup', 'logrotate:init'
2
+ after 'deploy:setup', 'logrotate:init'
3
+
3
4
  _cset :logrotate_path, '/etc/logrotate.d'
4
5
  _cset(:logrotate_file_name){ "cap_#{application}_#{rails_env}"}
5
6
  _cset(:logrotate_file){ "#{logrotate_path}/#{logrotate_file_name}"}
@@ -1,7 +1,5 @@
1
1
  Capistrano::Configuration.instance(:must_exist).load do
2
- set :bundle_dir, ''
3
- set :bundle_flags, '--system --quiet'
4
-
2
+ _cset(:ruby_version) { RUBY_VERSION }
5
3
  _cset :rvm_type, :user
6
4
  _cset :rails_env, 'production'
7
5
  _cset :branch, 'master'
@@ -14,17 +12,11 @@ Capistrano::Configuration.instance(:must_exist).load do
14
12
  _cset :database_yml_path, 'config/database.yml'
15
13
  _cset :auto_migrate, true
16
14
  _cset :assets, true
17
- _cset :port, 22
18
- _cset(:ssh) {"ssh -p #{fetch(:port)} #{user}@#{serv}"}
15
+ _cset(:ssh) {"ssh -p #{fetch(:port, 22)} #{user}@#{serv}"}
19
16
  _cset(:stage){ rails_env }
20
17
  _cset(:application_env){ "#{application}_#{rails_env}"}
21
- _cset(:rvm_ruby_string){ "#{ruby_version}@#{application}" }
22
- _cset :robots_disallow, false
23
-
24
- before 'deploy', 'rvm:install_rvm' # install/update RVM
25
- before 'deploy', 'rvm:install_ruby' # install Ruby and create gemset (both if missing)
26
18
 
27
- #after "deploy:update_code", "create:rvmrc"
19
+ after "deploy:update_code", "create:rvmrc"
28
20
  after "deploy:update", "deploy:cleanup"
29
21
 
30
22
  #set :deploy_to, (exists?(:deploy_folder)? fetch(:deploy_folder) : "/home/#{user}/www/#{application}")
@@ -32,15 +24,12 @@ Capistrano::Configuration.instance(:must_exist).load do
32
24
  default_run_options[:pty] = true
33
25
  ssh_options[:forward_agent] = true
34
26
 
27
+
35
28
  def gem_use?(name)
36
29
  gemfile_lock = File.read("Gemfile.lock")
37
30
  return (gemfile_lock =~ /^\s*#{name}\s+\(/)? true : false
38
31
  end
39
32
 
40
- def current_host
41
- capture("echo $CAPISTRANO:HOST$").strip
42
- end
43
-
44
33
  def which(name)
45
34
  str = capture("which #{name}").chop
46
35
  return false if str == ''
@@ -55,7 +44,9 @@ Capistrano::Configuration.instance(:must_exist).load do
55
44
  rescue
56
45
  false
57
46
  end
58
-
47
+ def ssh_port
48
+ exists?(:port) ? fetch(:port) : 22
49
+ end
59
50
  def local_gem_available?(name)
60
51
  Gem::Specification.find_by_name(name)
61
52
  rescue Gem::LoadError
@@ -88,17 +79,11 @@ Capistrano::Configuration.instance(:must_exist).load do
88
79
 
89
80
  namespace :create do
90
81
  desc "Create .rvmrc"
91
- task :rvmrc, :roles => :web, :except => { :no_release => true } do
92
- rvmrc_string = "rvm use #{rvm_ruby_string} --create"
82
+ task :rvmrc do
83
+ rvmrc_string = "rvm use #{ruby_version}@#{application_env} --create"
93
84
  logger.info rvmrc_string
94
85
  put rvmrc_string, "#{latest_release}/.rvmrc"
95
86
  end
96
-
97
- desc "Create deny robots.txt"
98
- task :robots, :roles => :web do
99
- logger.important "CREATING DISALLOW robots.txt - do not forget to remove"
100
- put "User-agent: *\nDisallow: /\n", "#{latest_release}/public/robots.txt"
101
- end
102
87
  end
103
88
 
104
89
 
@@ -114,9 +99,7 @@ Capistrano::Configuration.instance(:must_exist).load do
114
99
  if exists?(:delayed_job) && fetch(:delayed_job) == true
115
100
  delayed_job.restart
116
101
  end
117
- if exists?(:robots_disallow) && fetch(:robots_disallow) == true
118
- create.robots
119
- end
102
+
120
103
 
121
104
  end
122
105
  task :prepare do
@@ -180,17 +163,6 @@ Capistrano::Configuration.instance(:must_exist).load do
180
163
 
181
164
 
182
165
  namespace :install do
183
- desc 'cap install:app APP=htop'
184
- task :app do
185
- #capture("which apt-nyaa").strip
186
-
187
- if ENV.has_key?('APP')
188
- run %{apt-nyaa cat #{ENV['APP']} | sed "s/sudo/#{sudo}/g" | bash}
189
- else
190
- logger.important "Please run with APP="
191
- end
192
- end
193
-
194
166
  desc "Install apt-nyaa"
195
167
  task :aptnyaa do
196
168
  run "#{sudo} apt-get --assume-yes install wget > /dev/null 2>&1 && cd /usr/bin/ && #{sudo} wget -Nq https://raw.github.com/nyaa/UbuntuScript/master/apt-nyaa && #{sudo} chmod +x apt-nyaa"
@@ -206,7 +178,7 @@ Capistrano::Configuration.instance(:must_exist).load do
206
178
  run "#{sudo} sysctl -w kernel.shmmax=#{bits}"
207
179
  run "echo 'kernel.shmmax=#{bits}' | #{sudo} tee -a /etc/sysctl.conf"
208
180
  else
209
- logger.important "Please run with MAX="
181
+ puts "Please run with MAX="
210
182
  end
211
183
  end
212
184
  end
@@ -21,7 +21,6 @@ Capistrano::Configuration.instance(:must_exist).load do
21
21
  puts command
22
22
 
23
23
  run "#{sudo} sed -i 's/exit 0//g' /etc/rc.local"
24
- run "echo \"# #{application_env}\" | #{sudo} tee -a /etc/rc.local"
25
24
  run "echo \"#{command}\" | #{sudo} tee -a /etc/rc.local"
26
25
  run "echo \"exit 0\" | #{sudo} tee -a /etc/rc.local"
27
26
  end
@@ -1,3 +1,3 @@
1
1
  module Capobvious
2
- VERSION = '0.3.pre24'
2
+ VERSION = '1.3.pre13'
3
3
  end
metadata CHANGED
@@ -1,43 +1,48 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capobvious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.pre24
4
+ prerelease: 4
5
+ version: 1.3.pre13
5
6
  platform: ruby
6
7
  authors:
7
8
  - Dmitry Gruzd
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-10-20 00:00:00.000000000 Z
12
+ date: 2013-05-30 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: capistrano
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
15
22
  requirement: !ruby/object:Gem::Requirement
23
+ none: false
16
24
  requirements:
17
- - - ~>
25
+ - - ! '>='
18
26
  - !ruby/object:Gem::Version
19
- version: 2.15.4
27
+ version: '0'
20
28
  type: :runtime
21
29
  prerelease: false
30
+ - !ruby/object:Gem::Dependency
31
+ name: rvm-capistrano
22
32
  version_requirements: !ruby/object:Gem::Requirement
33
+ none: false
23
34
  requirements:
24
- - - ~>
35
+ - - ! '>='
25
36
  - !ruby/object:Gem::Version
26
- version: 2.15.4
27
- - !ruby/object:Gem::Dependency
28
- name: rvm-capistrano
37
+ version: '0'
29
38
  requirement: !ruby/object:Gem::Requirement
39
+ none: false
30
40
  requirements:
31
- - - '>='
41
+ - - ! '>='
32
42
  - !ruby/object:Gem::Version
33
43
  version: '0'
34
44
  type: :runtime
35
45
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
46
  description: Capfile that we use every day
42
47
  email:
43
48
  - donotsendhere@gmail.com
@@ -70,25 +75,26 @@ files:
70
75
  - lib/capobvious/version.rb
71
76
  homepage: ''
72
77
  licenses: []
73
- metadata: {}
74
78
  post_install_message:
75
79
  rdoc_options: []
76
80
  require_paths:
77
81
  - lib
78
82
  required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
79
84
  requirements:
80
- - - '>='
85
+ - - ! '>='
81
86
  - !ruby/object:Gem::Version
82
87
  version: '0'
83
88
  required_rubygems_version: !ruby/object:Gem::Requirement
89
+ none: false
84
90
  requirements:
85
- - - '>'
91
+ - - ! '>'
86
92
  - !ruby/object:Gem::Version
87
93
  version: 1.3.1
88
94
  requirements: []
89
95
  rubyforge_project: capobvious
90
- rubygems_version: 2.0.6
96
+ rubygems_version: 1.8.25
91
97
  signing_key:
92
- specification_version: 4
98
+ specification_version: 3
93
99
  summary: Cap recipes
94
100
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: e5114a046ef025a47522a02f4203e2baaac5da4a
4
- data.tar.gz: bd4fa13af1d9a4e0d77499c27aaffabaa3a10179
5
- SHA512:
6
- metadata.gz: 4257acf601d8a6b5e6d531b3a3fbf002018f1db9c1d62035ead2a7854741f3aaac8aadcb9c267af525a4209c39ad429f893e8515137c0a651f1e9d3da582a020
7
- data.tar.gz: 2a6d8ebbb61dd6133a8a546579da4a362458f0206eb0d80f4f12006f2ade7e1ab05ff14ea98e11207a21d6f31b8c8e9cca8f40976096f79047f9a5bddf874272