kstrano 0.0.32 → 0.0.33

Sign up to get free protection for your applications and to get access to all the features.
data/bin/kumafy CHANGED
@@ -61,6 +61,18 @@ def update_deploy_config(ui, base, context, force)
61
61
  app_name = context["app_name"]
62
62
  deploy_gist.gsub!(/(:application,\s)(\"\")/, '\1' + "\"#{app_name}\"")
63
63
  deploy_gist.gsub!(/(:admin_runner,\s)(\"\")/, '\1' + "\"#{app_name}\"")
64
+
65
+ newrelic_appname = ui.ask("What's the name of the application in new relic?")
66
+ if !newrelic_appname.nil? && !newrelic_appname.empty?
67
+ deploy_gist.gsub!(/(:newrelic_appname,\s)(\"\")/, '\1' + "\"#{newrelic_appname}\"")
68
+ context["newrelic_appname"] = newrelic_appname
69
+ end
70
+
71
+ newrelic_license_key = ui.ask("What's the license key of your newrelic account (can be found under 'Account settings')?")
72
+ if !newrelic_license_key.nil? && !newrelic_license_key.empty?
73
+ deploy_gist.gsub!(/(:newrelic_license_key,\s)(\"\")/, '\1' + "\"#{newrelic_license_key}\"")
74
+ context["newrelic_license_key"] = newrelic_license_key
75
+ end
64
76
 
65
77
  File.open(deploy, "w") do |f|
66
78
  deploy_gist.each_line do |line|
@@ -10,8 +10,8 @@ module Kumastrano
10
10
  raise msg
11
11
  end
12
12
 
13
- def say(text)
14
- Capistrano::CLI.ui.say("--> #{text}")
13
+ def say(text, prefix='--> ')
14
+ Capistrano::CLI.ui.say("#{prefix}#{text}")
15
15
  end
16
16
 
17
17
  def ask(question, default='n')
data/lib/kstrano.rb CHANGED
@@ -8,6 +8,7 @@ set :force_migrations, false
8
8
 
9
9
  set :webserver_user, "www-data"
10
10
  set :permission_method, :acl
11
+ set :server_name, nil
11
12
 
12
13
  set :dump_assetic_assets, true
13
14
  set :interactive_mode, true
@@ -20,6 +21,8 @@ require "#{File.dirname(__FILE__)}/helpers/git_helper.rb"
20
21
  require "#{File.dirname(__FILE__)}/helpers/kuma_helper.rb"
21
22
  require 'rexml/document'
22
23
  require 'etc'
24
+ require 'new_relic/recipes'
25
+ require 'new_relic/agent'
23
26
 
24
27
  namespace :kuma do
25
28
 
@@ -35,6 +38,19 @@ namespace :kuma do
35
38
 
36
39
  end
37
40
 
41
+ desc "Show log of what changed compared to the deployed version"
42
+ task :changelog do
43
+ Kumastrano::GitHelper.fetch
44
+ changelog = `git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --no-merges #{current_revision}..#{real_revision}`
45
+
46
+ if current_revision == real_revision && changelog.strip.empty?
47
+ changelog = "No changes found!"
48
+ end
49
+
50
+ Kumastrano.say "Changelog of what will be deployed to #{domain}"
51
+ Kumastrano.say changelog, ''
52
+ end
53
+
38
54
  namespace :fix do
39
55
 
40
56
  desc "Run fixcron for the current project"
@@ -67,9 +83,11 @@ namespace :kuma do
67
83
 
68
84
  desc "Clear the APC cache"
69
85
  task :clear do
70
- serverproject = domain.split('.')[0]
71
- sudo "sh -c 'curl https://raw.github.com/gist/3987685/ > /home/projects/#{serverproject}/site/apcclear.php'"
72
- sudo "chmod 777 /home/projects/#{serverproject}/site/apcclear.php"
86
+ if server_name.nil? || server_name.empty?
87
+ server_name = domain.split('.')[0]
88
+ end
89
+ sudo "sh -c 'curl https://raw.github.com/gist/3987685/ > /home/projects/#{server_name}/site/apcclear.php'"
90
+ sudo "chmod 777 /home/projects/#{server_name}/site/apcclear.php"
73
91
  sudo "curl http://#{domain}/apcclear.php"
74
92
  end
75
93
 
@@ -187,9 +205,21 @@ end
187
205
  before :deploy do
188
206
  Kumastrano.say "executing ssh-add"
189
207
  %x(ssh-add)
208
+
209
+ kuma.changelog
210
+ if !Kumastrano.ask "Are you sure you want to continue deploying?", "y"
211
+ exit
212
+ end
190
213
  end
191
214
 
192
215
  after :deploy do
193
216
  kuma.fix.cron
217
+
218
+ if env == "production" && !newrelic_appname.nil? && !newrelic_appname.empty? && !newrelic_license_key.nil? && !newrelic_appname.empty?
219
+ ::NewRelic::Agent.config.apply_config({:license_key => newrelic_license_key}, 1)
220
+ set :newrelic_rails_env, env
221
+ newrelic.notice_deployment
222
+ end
223
+
194
224
  deploy::cleanup ## cleanup old releases
195
- end
225
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kstrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.33
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -76,13 +76,13 @@ dependencies:
76
76
  - !ruby/object:Gem::Version
77
77
  version: 0.2.1
78
78
  - !ruby/object:Gem::Dependency
79
- name: highline
79
+ name: newrelic_rpm
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
83
  - - ! '>='
84
84
  - !ruby/object:Gem::Version
85
- version: 1.6.11
85
+ version: 3.5.5.38
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
- version: 1.6.11
93
+ version: 3.5.5.38
94
94
  description: Deploying symfony2 applications for the kDeploy server setup.
95
95
  email: support@kunstmaan.be
96
96
  executables: