instrumental_agent 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/instrumental/capistrano.rb +4 -46
- data/lib/instrumental/capistrano/capistrano2.rb +47 -0
- data/lib/instrumental/capistrano/capistrano3.rake +56 -0
- data/lib/instrumental/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95eafa56c7f6a610405a68634bd590c76d81a332
|
4
|
+
data.tar.gz: 5a1d84b622e6eb7cc931c2b29c170113fb3fdb6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77e15be11d00e7b900461a5321304ea8c39db039e2cdea298b2f1e6095986476d10d5f45ddfa457c26caa6fc26a41a0b515c62fa62802c3d323d529d4b917635
|
7
|
+
data.tar.gz: e9347c78c125ebc12a86970425d16e8c682a4355f8fe58e360edf23a7938e004ea6765d103970f2f57205cb6d163f59016574934c1548f10d35e4f5782108cde
|
data/CHANGELOG.md
CHANGED
@@ -1,47 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
if Capistrano::Configuration.instance
|
6
|
-
Capistrano::Configuration.instance.load do
|
7
|
-
namespace :instrumental do
|
8
|
-
namespace :util do
|
9
|
-
desc "marker for beginning of deploy"
|
10
|
-
task :deploy_start do
|
11
|
-
set :instrumental_deploy_start, Time.now
|
12
|
-
end
|
13
|
-
|
14
|
-
desc "marker for end of deploy"
|
15
|
-
task :deploy_end do
|
16
|
-
set :instrumental_deploy_end, Time.now
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
desc "send a notice to instrumental about the deploy"
|
21
|
-
task :record_deploy_notice do
|
22
|
-
start_at = exists?(:instrumental_deploy_start) ? instrumental_deploy_start : Time.now
|
23
|
-
end_at = exists?(:instrumental_deploy_end) ? instrumental_deploy_end : start_at
|
24
|
-
deploy_duration_in_seconds = end_at - start_at
|
25
|
-
deployer = Etc.getlogin.chomp
|
26
|
-
agent_options = { :synchronous => true }
|
27
|
-
agent_options[:collector] = instrumental_host if exists?(:instrumental_host)
|
28
|
-
agent = Instrumental::Agent.new(instrumental_key, agent_options)
|
29
|
-
message = if exists?(:deploy_message)
|
30
|
-
deploy_message
|
31
|
-
else
|
32
|
-
"#{deployer} deployed #{current_revision}"
|
33
|
-
end
|
34
|
-
agent.notice(message,
|
35
|
-
start_at,
|
36
|
-
deploy_duration_in_seconds)
|
37
|
-
logger.info("Notified Instrumental of deployment")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
before "deploy", "instrumental:util:deploy_start"
|
42
|
-
after "deploy", "instrumental:util:deploy_end"
|
43
|
-
before "deploy:migrations", "instrumental:util:deploy_start"
|
44
|
-
after "deploy:migrations", "instrumental:util:deploy_end"
|
45
|
-
after "instrumental:util:deploy_end", "instrumental:record_deploy_notice"
|
46
|
-
end
|
1
|
+
if Gem::Specification.find_by_name("capistrano").version >= Gem::Version.new("3.0.0")
|
2
|
+
load File.expand_path("../capistrano/capistrano3.rake", __FILE__)
|
3
|
+
else
|
4
|
+
require_relative "capistrano/capistrano2"
|
47
5
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "etc"
|
2
|
+
require "instrumental_agent"
|
3
|
+
|
4
|
+
Capistrano::Configuration.instance.load do
|
5
|
+
_cset(:instrumental_hooks) { true }
|
6
|
+
_cset(:instrumental_key) { nil }
|
7
|
+
_cset(:deployer) { Etc.getlogin.chomp }
|
8
|
+
|
9
|
+
if fetch(:instrumental_hooks)
|
10
|
+
before "deploy", "instrumental:util:deploy_start"
|
11
|
+
after "deploy", "instrumental:util:deploy_end"
|
12
|
+
before "deploy:migrations", "instrumental:util:deploy_start"
|
13
|
+
after "deploy:migrations", "instrumental:util:deploy_end"
|
14
|
+
after "instrumental:util:deploy_end", "instrumental:record_deploy_notice"
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :instrumental do
|
18
|
+
namespace :util do
|
19
|
+
desc "marker for beginning of deploy"
|
20
|
+
task :deploy_start do
|
21
|
+
set :instrumental_deploy_start, Time.now
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "marker for end of deploy"
|
25
|
+
task :deploy_end do
|
26
|
+
set :instrumental_deploy_end, Time.now
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "send a notice to instrumental about the deploy"
|
31
|
+
task :record_deploy_notice do
|
32
|
+
start_at = fetch(:instrumental_deploy_start, Time.now)
|
33
|
+
end_at = fetch(:instrumental_deploy_end, start_at)
|
34
|
+
deploy_duration_in_seconds = end_at - start_at
|
35
|
+
deployer = fetch(:deployer)
|
36
|
+
agent_options = { :synchronous => true }
|
37
|
+
agent_options[:collector] = instrumental_host if fetch(:instrumental_host, false)
|
38
|
+
agent = Instrumental::Agent.new(fetch(:instrumental_key), agent_options)
|
39
|
+
message = fetch(:deploy_message, "#{deployer} deployed #{current_revision}")
|
40
|
+
|
41
|
+
agent.notice(message,
|
42
|
+
start_at,
|
43
|
+
deploy_duration_in_seconds)
|
44
|
+
logger.info("Notified Instrumental of deployment")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "etc"
|
2
|
+
require "instrumental_agent"
|
3
|
+
|
4
|
+
namespace :load do
|
5
|
+
task :defaults do
|
6
|
+
set :instrumental_hooks, true
|
7
|
+
set :instrumental_key, nil
|
8
|
+
set :deployer, Etc.getlogin.chomp
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
namespace :deploy do
|
13
|
+
before :starting, :check_instrumental_hooks do
|
14
|
+
invoke "instrumental:util:add_hooks" if fetch(:instrumental_hooks)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :instrumental do
|
19
|
+
namespace :util do
|
20
|
+
desc "add instrumental hooks to deploy"
|
21
|
+
task :add_hooks do
|
22
|
+
before "deploy", "instrumental:util:deploy_start"
|
23
|
+
after "deploy", "instrumental:util:deploy_end"
|
24
|
+
after "instrumental:util:deploy_end", "instrumental:record_deploy_notice"
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "marker for beginning of deploy"
|
28
|
+
task :deploy_start do
|
29
|
+
set :instrumental_deploy_start, Time.now
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "marker for end of deploy"
|
33
|
+
task :deploy_end do
|
34
|
+
set :instrumental_deploy_end, Time.now
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "send a notice to instrumental about the deploy"
|
39
|
+
task :record_deploy_notice do
|
40
|
+
start_at = fetch(:instrumental_deploy_start, Time.now)
|
41
|
+
end_at = fetch(:instrumental_deploy_end, start_at)
|
42
|
+
deploy_duration_in_seconds = end_at - start_at
|
43
|
+
deployer = fetch(:deployer)
|
44
|
+
agent_options = { :synchronous => true }
|
45
|
+
agent_options[:collector] = instrumental_host if fetch(:instrumental_host, false)
|
46
|
+
message = fetch(:deploy_message, "#{deployer} deployed #{fetch(:current_revision)}".strip)
|
47
|
+
|
48
|
+
if fetch(:instrumental_key)
|
49
|
+
agent = Instrumental::Agent.new(fetch(:instrumental_key), agent_options)
|
50
|
+
agent.notice(message,
|
51
|
+
start_at,
|
52
|
+
deploy_duration_in_seconds)
|
53
|
+
puts "Notified Instrumental of deployment"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/instrumental/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instrumental_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elijah Miller
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2018-01-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: metrician
|
@@ -122,6 +122,8 @@ files:
|
|
122
122
|
- instrumental_agent.gemspec
|
123
123
|
- lib/instrumental/agent.rb
|
124
124
|
- lib/instrumental/capistrano.rb
|
125
|
+
- lib/instrumental/capistrano/capistrano2.rb
|
126
|
+
- lib/instrumental/capistrano/capistrano3.rake
|
125
127
|
- lib/instrumental/system_timer.rb
|
126
128
|
- lib/instrumental/version.rb
|
127
129
|
- lib/instrumental_agent.rb
|