appsignal 0.8.3.beta.0 → 0.8.3.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjI5MDhiMzVjMGUyYzUyNWViOTkzYTQ2YmIzYWU1YjVmNGVjOGU5Nw==
4
+ NmQxZWUzNTcwNmE3YjRjYWE4MTYyYWYyZDJkZjhmYWFiMWIyZDViYQ==
5
5
  data.tar.gz: !binary |-
6
- OWVhNmFiZTFkMjkzOWZlNjg5MDY4ZmNiYWJhN2UzZGY3OTQzMDQ3Zg==
6
+ NmYwMGU1NjdiMTg5OGE0MjM4MjBlYmY1ZjIwYTI2NzNjZDAzNDQ0Nw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NzZiZDQ1YzcwZDk1NjkxYWVjMGFhMDFiNzBmYWVhNjZmMzU0MWI1ZTgzMDRh
10
- OGIyN2NhNDRiNDgyYTkzM2RlNTI4MzVmYmRlMDg1NWM0ZDRkYzE5NjM4YmIw
11
- N2U5NjFkOTNhMDQ0ZDkyNDkyNTc3MGNjZmM0MTg4NTFlMDhiODk=
9
+ ZWY4ZmY0ZjBlYWU2ZTYyYTk1YzA5ZjM4OTY4MzE1M2ViNWRiMjUwMmM5YWFm
10
+ YmU0MTEyMzI0ZTc4YjFlNTYxZWQyODg1MzEyOWFmM2Y1Mzg3NTk4OTM0YjZl
11
+ YTQ0YTRiNWJlYzIxNTE1ZjcwNjliZGU5YTQ1NzVmOTIzMmFiZmM=
12
12
  data.tar.gz: !binary |-
13
- MTAzNDY1NjY1ZDRjYjg3OTNmMjVlZWJhODQ2Njg0MjUwMTRjMWIyNWVhNTQy
14
- Y2Q0NzZlMTdkMWQ5YzdhYjVhYmViN2QwOGM5ZWI2YmZlNzljYjBhYTc3MTVj
15
- YTllZmMxNTNjYTIxOWYxZWQ1Yjc3NDc4Njg3NzQ3YTEzMzI5MDI=
13
+ YzIwMDNmNjk1NmM3ZjZkNTAwM2FhODc4ODc4ZDVlMDgzOTUxN2RlYzZkZjdj
14
+ MDMxMmJkNzU0NWJlODlmYjQ4ZGJmOWQ0ZjhhODdmOTBlYmU4N2YwZWU2NWRm
15
+ NGQ5MzdjNjM5MzlhZGY1OTZjNGZhYTlmYzBlMDZjN2UwMzk0ZDM=
@@ -1,5 +1,7 @@
1
1
  # 0.8.3
2
2
  * Restart thread when we've been forked
3
+ * Only notify of deploy when active in capistrano
4
+ * Make sure env is a string in config
3
5
 
4
6
  # 0.8.2
5
7
  * Bugfix in Delayed Job integration
@@ -120,7 +120,7 @@ module Appsignal
120
120
  end
121
121
 
122
122
  def active?
123
- config && config[:active] == true
123
+ config && config.active?
124
124
  end
125
125
 
126
126
  def is_ignored_exception?(exception)
@@ -16,7 +16,7 @@ module Appsignal
16
16
 
17
17
  def initialize(root_path, env, logger=Appsignal.logger)
18
18
  @root_path = root_path
19
- @env = env
19
+ @env = env.to_s
20
20
  @logger = logger
21
21
 
22
22
  if File.exists?(config_file)
@@ -50,6 +50,10 @@ module Appsignal
50
50
  config_hash[key]
51
51
  end
52
52
 
53
+ def active?
54
+ !! self[:active]
55
+ end
56
+
53
57
  protected
54
58
 
55
59
  def config_file
@@ -19,17 +19,19 @@ module Appsignal
19
19
  logger
20
20
  )
21
21
 
22
- marker_data = {
23
- :revision => current_revision,
24
- :repository => repository,
25
- :user => user
26
- }
22
+ if appsignal_config && appsignal_config.active?
23
+ marker_data = {
24
+ :revision => current_revision,
25
+ :repository => repository,
26
+ :user => user
27
+ }
27
28
 
28
- marker = Marker.new(marker_data, appsignal_config, logger)
29
- if config.dry_run
30
- logger.info('Dry run: Deploy marker not actually sent.')
31
- else
32
- marker.transmit
29
+ marker = Marker.new(marker_data, appsignal_config, logger)
30
+ if config.dry_run
31
+ logger.info('Dry run: Deploy marker not actually sent.')
32
+ else
33
+ marker.transmit
34
+ end
33
35
  end
34
36
  end
35
37
  end
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.8.3.beta.0'
2
+ VERSION = '0.8.3.beta.1'
3
3
  end
@@ -34,6 +34,22 @@ describe Appsignal::Config do
34
34
  end
35
35
  end
36
36
 
37
+ describe "#active?" do
38
+ subject { config.active? }
39
+
40
+ it { should be_true }
41
+ end
42
+
43
+ context "if the env is passed as a symbol" do
44
+ let(:config) { project_fixture_config(:production) }
45
+
46
+ describe "#active?" do
47
+ subject { config.active? }
48
+
49
+ it { should be_true }
50
+ end
51
+ end
52
+
37
53
  context "and there's also an env var present" do
38
54
  before do
39
55
  ENV['APPSIGNAL_PUSH_API_KEY'] = 'push_api_key'
@@ -85,6 +101,12 @@ describe Appsignal::Config do
85
101
  end
86
102
  end
87
103
 
104
+ describe "#active?" do
105
+ subject { config.active? }
106
+
107
+ it { should be_false }
108
+ end
109
+
88
110
  context "and an env var is present" do
89
111
  before do
90
112
  ENV['APPSIGNAL_PUSH_API_KEY'] = 'push_api_key'
@@ -97,6 +119,12 @@ describe Appsignal::Config do
97
119
 
98
120
  its(:loaded?) { should be_true }
99
121
 
122
+ describe "#active?" do
123
+ subject { config.active? }
124
+
125
+ it { should be_true }
126
+ end
127
+
100
128
  it "should merge with the default config and fill the config hash" do
101
129
  subject.config_hash.should == {
102
130
  :push_api_key => 'push_api_key',
@@ -23,6 +23,7 @@ describe Appsignal::Integrations::Capistrano do
23
23
  @capistrano_config.set(:current_revision, '503ce0923ed177a3ce000005')
24
24
  @capistrano_config.dry_run = false
25
25
  ENV['USER'] = 'batman'
26
+ ENV['PWD'] = project_fixture_path
26
27
  end
27
28
 
28
29
  context "config" do
@@ -30,7 +31,7 @@ describe Appsignal::Integrations::Capistrano do
30
31
 
31
32
  it "should be instantiated with the right params" do
32
33
  Appsignal::Config.should_receive(:new).with(
33
- ENV['PWD'],
34
+ project_fixture_path,
34
35
  'production',
35
36
  kind_of(Capistrano::Logger)
36
37
  )
@@ -44,7 +45,7 @@ describe Appsignal::Integrations::Capistrano do
44
45
 
45
46
  it "should be instantiated with the right params" do
46
47
  Appsignal::Config.should_receive(:new).with(
47
- ENV['PWD'],
48
+ project_fixture_path,
48
49
  'rack_production',
49
50
  kind_of(Capistrano::Logger)
50
51
  )
@@ -64,58 +65,66 @@ describe Appsignal::Integrations::Capistrano do
64
65
 
65
66
  let(:marker_data) do
66
67
  {
67
- :revision => "503ce0923ed177a3ce000005",
68
- :repository => "master",
69
- :user => "batman"
68
+ :revision => '503ce0923ed177a3ce000005',
69
+ :repository => 'master',
70
+ :user => 'batman'
70
71
  }
71
72
  end
72
73
 
73
- before do
74
- @marker = Appsignal::Marker.new(
75
- marker_data,
76
- config,
77
- @logger
78
- )
79
- Appsignal::Marker.should_receive(:new).with(
80
- marker_data,
81
- kind_of(Appsignal::Config),
82
- kind_of(Capistrano::Logger)
83
- ).and_return(@marker)
84
- end
85
-
86
- context "proper setup" do
74
+ context "when active for this environment" do
87
75
  before do
88
- @transmitter = double
89
- Appsignal::Transmitter.should_receive(:new).and_return(@transmitter)
76
+ @marker = Appsignal::Marker.new(
77
+ marker_data,
78
+ config,
79
+ @logger
80
+ )
81
+ Appsignal::Marker.should_receive(:new).with(
82
+ marker_data,
83
+ kind_of(Appsignal::Config),
84
+ kind_of(Capistrano::Logger)
85
+ ).and_return(@marker)
86
+ end
87
+
88
+ context "proper setup" do
89
+ before do
90
+ @transmitter = double
91
+ Appsignal::Transmitter.should_receive(:new).and_return(@transmitter)
92
+ end
93
+
94
+ it "should transmit data" do
95
+ @transmitter.should_receive(:transmit).and_return('200')
96
+ @capistrano_config.find_and_execute_task('appsignal:deploy')
97
+ @io.string.should include('** Notifying Appsignal of deploy...')
98
+ @io.string.should include('** Appsignal has been notified of this deploy!')
99
+ end
90
100
  end
91
101
 
92
- it "should transmit data" do
93
- @transmitter.should_receive(:transmit).and_return('200')
102
+ it "should not transmit data" do
94
103
  @capistrano_config.find_and_execute_task('appsignal:deploy')
95
104
  @io.string.should include('** Notifying Appsignal of deploy...')
96
- @io.string.should include(
97
- '** Appsignal has been notified of this deploy!'
98
- )
105
+ @io.string.should include('** Something went wrong while trying to notify Appsignal:')
99
106
  end
100
- end
101
107
 
102
- it "should not transmit data" do
103
- @capistrano_config.find_and_execute_task('appsignal:deploy')
104
- @io.string.should include('** Notifying Appsignal of deploy...')
105
- @io.string.should include(
106
- '** Something went wrong while trying to notify Appsignal:'
107
- )
108
+ context "dry run" do
109
+ before { @capistrano_config.dry_run = true }
110
+
111
+ it "should not send deploy marker" do
112
+ @marker.should_not_receive(:transmit)
113
+ @capistrano_config.find_and_execute_task('appsignal:deploy')
114
+ @io.string.should include('** Dry run: Deploy marker not actually sent.')
115
+ end
116
+ end
108
117
  end
109
118
 
110
- context "dry run" do
111
- before { @capistrano_config.dry_run = true }
119
+ context "when not active for this environment" do
120
+ before do
121
+ @capistrano_config.set(:rails_env, 'nonsense')
122
+ end
112
123
 
113
124
  it "should not send deploy marker" do
114
- @marker.should_not_receive(:transmit)
125
+ Appsignal::Marker.should_not_receive(:new)
115
126
  @capistrano_config.find_and_execute_task('appsignal:deploy')
116
- @io.string.should include(
117
- '** Dry run: Deploy marker not actually sent.'
118
- )
127
+ @io.string.should include('Not loading:')
119
128
  end
120
129
  end
121
130
  end
@@ -78,19 +78,19 @@ describe Appsignal do
78
78
  subject { Appsignal.active? }
79
79
 
80
80
  context "without config" do
81
- before { Appsignal.stub(:config => nil) }
81
+ before { Appsignal.config = nil }
82
82
 
83
83
  it { should be_false }
84
84
  end
85
85
 
86
86
  context "with config but inactive" do
87
- before { Appsignal.stub(:config => {:active => false}) }
87
+ before { Appsignal.config = project_fixture_config('nonsense') }
88
88
 
89
89
  it { should be_false }
90
90
  end
91
91
 
92
92
  context "with active config" do
93
- before { Appsignal.stub(:config => {:active => true}) }
93
+ before { Appsignal.config = project_fixture_config }
94
94
 
95
95
  it { should be_true }
96
96
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3.beta.0
4
+ version: 0.8.3.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-01-08 00:00:00.000000000 Z
15
+ date: 2014-01-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport