appsignal 0.12.beta.32 → 0.12.beta.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3904c5300ef30db2a6f5c8eaadce8e7a1ac7a5b6
4
- data.tar.gz: dc5d9e98c1eaabaf84eacb629e490f6494819bf0
3
+ metadata.gz: e66eec14b175b0b6948bc0156c75f0a487509f8a
4
+ data.tar.gz: 6ff24a317d2a7fbfcf3839b6f86bd86b03f5d351
5
5
  SHA512:
6
- metadata.gz: 66c82fe27b587026438c1608735dbd29e80ba2d475fb9057d33bb7b66b60a55c8347ee4fe92544a2b8bb74d0f8adb4e446bd392f59fb139a1ec48e715f7bf89b
7
- data.tar.gz: 2e67ade5b8bb20aa9c28728590f0bf490f90806420804151c66f9952c11105e300c08e2467cf98199448738455e89a5d2217b40b81dc23e3167a873d07412408
6
+ metadata.gz: 5fd9d8738134d349e4cd0278d871f1ac25041446c6e045a642c4f11f8b837b47d0016f04592c5d1f5bb08fac4d60a5b065da8b9feb8576b8c531715f25639de1
7
+ data.tar.gz: 80335bfef01c3aae87f4ff4666908cf07521ec52516c5bb5f59150e6105e0d673d3c59593bd34b4db895b2a3b3e7f070e8f43307c7ba98edfcca12d765d10019
@@ -7,14 +7,8 @@ static VALUE start(VALUE self) {
7
7
  return Qnil;
8
8
  }
9
9
 
10
- static VALUE stop_agent(VALUE self) {
11
- appsignal_stop_agent();
12
-
13
- return Qnil;
14
- }
15
-
16
- static VALUE stop_extension(VALUE self) {
17
- appsignal_stop_extension();
10
+ static VALUE stop(VALUE self) {
11
+ appsignal_stop();
18
12
 
19
13
  return Qnil;
20
14
  }
@@ -222,8 +216,7 @@ void Init_appsignal_extension(void) {
222
216
 
223
217
  // Transaction monitoring
224
218
  rb_define_singleton_method(Extension, "start", start, 0);
225
- rb_define_singleton_method(Extension, "stop_agent", stop_agent, 0);
226
- rb_define_singleton_method(Extension, "stop_extension", stop_extension, 0);
219
+ rb_define_singleton_method(Extension, "stop", stop, 0);
227
220
  rb_define_singleton_method(Extension, "start_transaction", start_transaction, 2);
228
221
  rb_define_singleton_method(Extension, "start_event", start_event, 1);
229
222
  rb_define_singleton_method(Extension, "finish_event", finish_event, 4);
@@ -37,7 +37,14 @@ module Appsignal
37
37
  end
38
38
 
39
39
  def start
40
- if config
40
+ unless @config
41
+ @config = Config.new(
42
+ ENV['PWD'],
43
+ ENV['APPSIGNAL_APP_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV']
44
+ )
45
+ end
46
+
47
+ if config.valid?
41
48
  if config[:debug]
42
49
  logger.level = Logger::DEBUG
43
50
  else
@@ -56,16 +63,12 @@ module Appsignal
56
63
  logger.info("Not starting, not active for #{config.env}")
57
64
  end
58
65
  else
59
- logger.error('Can\'t start, no config loaded')
66
+ logger.error('Not starting, no valid config for this environment')
60
67
  end
61
68
  end
62
69
 
63
- def stop_agent
64
- Appsignal::Extension.stop_agent
65
- end
66
-
67
- def stop_extension
68
- Appsignal::Extension.stop_extension
70
+ def stop
71
+ Appsignal::Extension.stop
69
72
  end
70
73
 
71
74
  def monitor_transaction(name, env={})
@@ -10,7 +10,7 @@ if defined?(::Celluloid)
10
10
  alias shutdown_without_appsignal shutdown
11
11
 
12
12
  def shutdown
13
- Appsignal.stop_extension
13
+ Appsignal.stop
14
14
  shutdown_without_appsignal
15
15
  end
16
16
  end
@@ -1,4 +1,4 @@
1
1
  module Appsignal
2
- VERSION = '0.12.beta.32'
3
- AGENT_VERSION = '246e4be'
2
+ VERSION = '0.12.beta.33'
3
+ AGENT_VERSION = '9686343'
4
4
  end
@@ -15,9 +15,9 @@ describe "Celluloid integration" do
15
15
  load file
16
16
  end
17
17
 
18
- specify { expect(Appsignal).to receive(:stop_extension) }
19
-
18
+ specify { expect(Appsignal).to receive(:stop) }
20
19
  specify { expect(Celluloid).to receive(:shutdown_without_appsignal) }
20
+
21
21
  after do
22
22
  Celluloid.shutdown
23
23
  end
@@ -32,12 +32,23 @@ describe Appsignal do
32
32
  end
33
33
 
34
34
  describe ".start" do
35
- it "should do nothing when config is not loaded" do
36
- Appsignal.logger.should_receive(:error).with(
37
- "Can't start, no config loaded"
38
- )
39
- Appsignal.start
40
- Appsignal.agent.should be_nil
35
+ context "with no config set beforehand" do
36
+ it "should do nothing when config is not set and there is no valid config in the env" do
37
+ Appsignal.logger.should_receive(:error).with(
38
+ "Push api key not set after loading config"
39
+ ).once
40
+ Appsignal.logger.should_receive(:error).with(
41
+ "Not starting, no valid config for this environment"
42
+ ).once
43
+ Appsignal::Extension.should_not_receive(:start)
44
+ Appsignal.start
45
+ end
46
+
47
+ it "should create a config from the env" do
48
+ ENV['APPSIGNAL_PUSH_API_KEY'] = 'something'
49
+ Appsignal::Extension.should_receive(:start)
50
+ Appsignal.start
51
+ end
41
52
  end
42
53
 
43
54
  context "when config is loaded" do
@@ -77,9 +88,6 @@ describe Appsignal do
77
88
  before { Appsignal.config = project_fixture_config('staging') }
78
89
 
79
90
  it "should do nothing" do
80
- Appsignal.logger.should_receive(:info).with(
81
- 'Not starting, not active for staging'
82
- )
83
91
  Appsignal.start
84
92
  Appsignal.agent.should be_nil
85
93
  end
@@ -135,18 +143,10 @@ describe Appsignal do
135
143
  end
136
144
  end
137
145
 
138
- describe ".stop_agent" do
139
- it "should call stop_agent on the extension" do
140
- Appsignal::Extension.should_receive(:stop_agent)
141
- Appsignal.stop_agent
142
- Appsignal.active?.should be_false
143
- end
144
- end
145
-
146
- describe ".stop_extension" do
147
- it "should call stop_extension on the extension" do
148
- Appsignal::Extension.should_receive(:stop_extension)
149
- Appsignal.stop_extension
146
+ describe ".stop" do
147
+ it "should call stop on the extension" do
148
+ Appsignal::Extension.should_receive(:stop)
149
+ Appsignal.stop
150
150
  Appsignal.active?.should be_false
151
151
  end
152
152
  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.12.beta.32
4
+ version: 0.12.beta.33
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: 2015-09-23 00:00:00.000000000 Z
15
+ date: 2015-09-24 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rack