appsignal 0.8.3.beta.1 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmQxZWUzNTcwNmE3YjRjYWE4MTYyYWYyZDJkZjhmYWFiMWIyZDViYQ==
4
+ N2UwODdmZmQyMDg4NDRlYzRkOWUyNWFkYzIxZTE4NTNmZWEyNzRiMQ==
5
5
  data.tar.gz: !binary |-
6
- NmYwMGU1NjdiMTg5OGE0MjM4MjBlYmY1ZjIwYTI2NzNjZDAzNDQ0Nw==
6
+ MWUwM2ZhOTY0NGVjYmVkZWJjOThmYWYxMGJiZDc0N2QwMmU5NzBhMQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZWY4ZmY0ZjBlYWU2ZTYyYTk1YzA5ZjM4OTY4MzE1M2ViNWRiMjUwMmM5YWFm
10
- YmU0MTEyMzI0ZTc4YjFlNTYxZWQyODg1MzEyOWFmM2Y1Mzg3NTk4OTM0YjZl
11
- YTQ0YTRiNWJlYzIxNTE1ZjcwNjliZGU5YTQ1NzVmOTIzMmFiZmM=
9
+ MjAzZWI1YTI5ZjYzYjFkZDQ2NmY3OTM5MzZhZWVlMzdmYzNhMWE0MmQxNzk4
10
+ OWY3NjVlZTUyNjliNjBlYzA0MDc3NTFiMDk3MmFkNDRmYzQ0NDE4YzZjM2Ri
11
+ MTFhYmI0NzdmMDZiNzZhNDE1ODM5YTBmYTM3NzMwY2Y4NmJkYjg=
12
12
  data.tar.gz: !binary |-
13
- YzIwMDNmNjk1NmM3ZjZkNTAwM2FhODc4ODc4ZDVlMDgzOTUxN2RlYzZkZjdj
14
- MDMxMmJkNzU0NWJlODlmYjQ4ZGJmOWQ0ZjhhODdmOTBlYmU4N2YwZWU2NWRm
15
- NGQ5MzdjNjM5MzlhZGY1OTZjNGZhYTlmYzBlMDZjN2UwMzk0ZDM=
13
+ MGY1OTM5YjA3YjlmOWNkYTQxYTE0ODE5ZTYzODAzMzUxYzViYWZhMGY3OWI0
14
+ NTRjZjk5MjNkNDIwZTI0NDMyNjZkNzNkNGNiODI2ZGEwMDFjYTM3NzBkYzgz
15
+ ZmFjZTNiNmZhMjAzYWUwMDE1YWExZmY2ZjY3Yzc5ZTY0Yjc5MTI=
@@ -43,6 +43,7 @@ module Appsignal
43
43
  @config ||= Appsignal::Config.new(
44
44
  ENV['PWD'],
45
45
  options[:environment],
46
+ {},
46
47
  logger
47
48
  )
48
49
  end
@@ -12,11 +12,12 @@ module Appsignal
12
12
  :slow_request_threshold => 200
13
13
  }.freeze
14
14
 
15
- attr_reader :root_path, :env, :config_hash
15
+ attr_reader :root_path, :env, :initial_config, :config_hash
16
16
 
17
- def initialize(root_path, env, logger=Appsignal.logger)
17
+ def initialize(root_path, env, initial_config={}, logger=Appsignal.logger)
18
18
  @root_path = root_path
19
19
  @env = env.to_s
20
+ @initial_config = initial_config
20
21
  @logger = logger
21
22
 
22
23
  if File.exists?(config_file)
@@ -74,17 +75,21 @@ module Appsignal
74
75
  config_for_this_env[:push_api_key] = config_for_this_env[:api_key]
75
76
  end
76
77
 
77
- @config_hash = DEFAULT_CONFIG.merge(config_for_this_env)
78
+ @config_hash = merge_config(config_for_this_env)
78
79
  else
79
80
  carefully_log_error("Not loading: config for '#{env}' not found")
80
81
  end
81
82
  end
82
83
 
83
84
  def load_default_config_with_push_api_key(key)
84
- @config_hash = DEFAULT_CONFIG.merge(
85
+ @config_hash = merge_config(
85
86
  :push_api_key => key,
86
87
  :active => true
87
88
  )
88
89
  end
90
+
91
+ def merge_config(config)
92
+ DEFAULT_CONFIG.merge(initial_config).merge(config)
93
+ end
89
94
  end
90
95
  end
@@ -16,6 +16,7 @@ module Appsignal
16
16
  appsignal_config = Appsignal::Config.new(
17
17
  ENV['PWD'],
18
18
  env,
19
+ {},
19
20
  logger
20
21
  )
21
22
 
@@ -16,7 +16,11 @@ if defined?(::Rails)
16
16
  Appsignal.start_logger(Rails.root.join('log'))
17
17
 
18
18
  # Load config
19
- Appsignal.config = Appsignal::Config.new(Rails.root, Rails.env)
19
+ Appsignal.config = Appsignal::Config.new(
20
+ Rails.root,
21
+ Rails.env,
22
+ :name => Rails.application.class.parent_name
23
+ )
20
24
 
21
25
  # Start agent if config for this env is present
22
26
  Appsignal.start if Appsignal.active?
@@ -5,7 +5,7 @@ Appsignal.logger.info('Loading Sinatra integration')
5
5
  app_settings = ::Sinatra::Application.settings
6
6
  Appsignal.config = Appsignal::Config.new(
7
7
  app_settings.root,
8
- app_settings.environment.to_s
8
+ app_settings.environment
9
9
  )
10
10
 
11
11
  Appsignal.start_logger(app_settings.root)
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.8.3.beta.1'
2
+ VERSION = '0.8.3'
3
3
  end
@@ -12,6 +12,7 @@ describe Appsignal::Config do
12
12
  end
13
13
 
14
14
  its(:loaded?) { should be_true }
15
+ its(:active?) { should be_true }
15
16
 
16
17
  it "should merge with the default config and fill the config hash" do
17
18
  subject.config_hash.should == {
@@ -34,20 +35,10 @@ describe Appsignal::Config do
34
35
  end
35
36
  end
36
37
 
37
- describe "#active?" do
38
- subject { config.active? }
39
-
40
- it { should be_true }
41
- end
42
-
43
38
  context "if the env is passed as a symbol" do
44
39
  let(:config) { project_fixture_config(:production) }
45
40
 
46
- describe "#active?" do
47
- subject { config.active? }
48
-
49
- it { should be_true }
50
- end
41
+ its(:active?) { should be_true }
51
42
  end
52
43
 
53
44
  context "and there's also an env var present" do
@@ -60,6 +51,15 @@ describe Appsignal::Config do
60
51
  end
61
52
  end
62
53
 
54
+ context "and there is an initial config" do
55
+ let(:config) { project_fixture_config('production', :name => 'Initial name', :initial_key => 'value') }
56
+
57
+ it "should merge with the config" do
58
+ subject[:name].should == 'TestApp'
59
+ subject[:initial_key].should == 'value'
60
+ end
61
+ end
62
+
63
63
  context "and there is an old-style api_key defined" do
64
64
  let(:config) { project_fixture_config('old_api_key') }
65
65
 
@@ -80,10 +80,12 @@ describe Appsignal::Config do
80
80
  end
81
81
 
82
82
  its(:loaded?) { should be_false }
83
+ its(:active?) { should be_false }
83
84
  end
84
85
 
85
86
  context "when there is no config file" do
86
- let(:config) { Appsignal::Config.new('/nothing', 'production') }
87
+ let(:initial_config) { {} }
88
+ let(:config) { Appsignal::Config.new('/nothing', 'production', initial_config) }
87
89
 
88
90
  it "should log an error" do
89
91
  Appsignal::Config.any_instance.should_receive(:carefully_log_error).with(
@@ -94,6 +96,7 @@ describe Appsignal::Config do
94
96
  end
95
97
 
96
98
  its(:loaded?) { should be_false }
99
+ its(:active?) { should be_false }
97
100
 
98
101
  describe "#[]" do
99
102
  it "should return nil" do
@@ -101,12 +104,6 @@ describe Appsignal::Config do
101
104
  end
102
105
  end
103
106
 
104
- describe "#active?" do
105
- subject { config.active? }
106
-
107
- it { should be_false }
108
- end
109
-
110
107
  context "and an env var is present" do
111
108
  before do
112
109
  ENV['APPSIGNAL_PUSH_API_KEY'] = 'push_api_key'
@@ -118,12 +115,7 @@ describe Appsignal::Config do
118
115
  end
119
116
 
120
117
  its(:loaded?) { should be_true }
121
-
122
- describe "#active?" do
123
- subject { config.active? }
124
-
125
- it { should be_true }
126
- end
118
+ its(:active?) { should be_true }
127
119
 
128
120
  it "should merge with the default config and fill the config hash" do
129
121
  subject.config_hash.should == {
@@ -135,6 +127,14 @@ describe Appsignal::Config do
135
127
  }
136
128
  end
137
129
 
130
+ context "and an initial config is present" do
131
+ let(:initial_config) { {:name => 'Initial Name'} }
132
+
133
+ it "should merge with the config" do
134
+ subject[:name].should == 'Initial Name'
135
+ end
136
+ end
137
+
138
138
  context "with only APPSIGNAL_API_KEY" do
139
139
  before do
140
140
  ENV.delete('APPSIGNAL_PUSH_API_KEY')
@@ -33,6 +33,7 @@ describe Appsignal::Integrations::Capistrano do
33
33
  Appsignal::Config.should_receive(:new).with(
34
34
  project_fixture_path,
35
35
  'production',
36
+ {},
36
37
  kind_of(Capistrano::Logger)
37
38
  )
38
39
  end
@@ -47,6 +48,7 @@ describe Appsignal::Integrations::Capistrano do
47
48
  Appsignal::Config.should_receive(:new).with(
48
49
  project_fixture_path,
49
50
  'rack_production',
51
+ {},
50
52
  kind_of(Capistrano::Logger)
51
53
  )
52
54
  end
@@ -18,6 +18,16 @@ if rails_present?
18
18
  subject { Appsignal.config }
19
19
 
20
20
  it { should be_a(Appsignal::Config) }
21
+
22
+ its(:root_path) { should == Pathname.new(project_fixture_path) }
23
+ its(:env) { should == 'test' }
24
+ its([:name]) { should == 'TestApp' }
25
+
26
+ context "initial config" do
27
+ subject { Appsignal.config.initial_config }
28
+
29
+ its([:name]) { should == 'MyApp' }
30
+ end
21
31
  end
22
32
 
23
33
  context "agent" do
@@ -9,10 +9,11 @@ module ConfigHelpers
9
9
  File.join(project_fixture_path, 'log/appsignal.log')
10
10
  end
11
11
 
12
- def project_fixture_config(env='production', logger=Logger.new(project_fixture_log_file))
12
+ def project_fixture_config(env='production', initial_config={}, logger=Logger.new(project_fixture_log_file))
13
13
  Appsignal::Config.new(
14
14
  project_fixture_path,
15
15
  env,
16
+ initial_config,
16
17
  logger
17
18
  )
18
19
  end
@@ -7,6 +7,10 @@ production:
7
7
  <<: *defaults
8
8
  active: true
9
9
 
10
+ development:
11
+ <<: *defaults
12
+ active: true
13
+
10
14
  test:
11
15
  <<: *defaults
12
16
  endpoint: "http://localhost:3000/1"
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.1
4
+ version: 0.8.3
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-10 00:00:00.000000000 Z
15
+ date: 2014-01-14 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -237,9 +237,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
237
237
  version: 1.9.3
238
238
  required_rubygems_version: !ruby/object:Gem::Requirement
239
239
  requirements:
240
- - - ! '>'
240
+ - - ! '>='
241
241
  - !ruby/object:Gem::Version
242
- version: 1.3.1
242
+ version: '0'
243
243
  requirements: []
244
244
  rubyforge_project:
245
245
  rubygems_version: 2.0.3