deployangel 0.1.16 → 0.1.18

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6080cb323e886841312b4bab49edd0962e2c5a4379c3f23d6dc7eb738944104d
4
- data.tar.gz: 36c6a15cfa2c70c3c92e58a500537bed8da5a19291af4852d530e857f21181fa
3
+ metadata.gz: 66584e07c5d50f166891f5b6779fa2fa8db383a923d074458e7bb09ff46e525a
4
+ data.tar.gz: 95b445b37424f7b92ab0ec5394f5fa35c10864f5738f10959dfb9822c73c0980
5
5
  SHA512:
6
- metadata.gz: c586644c984d299e424cc0b3042ac5a474c3271de24ca4ee5f0f89103fb574c0253bc362efa7d0b1d8b212b83ef4aa5a2fcfafb2f3c77477282d2a8f52b284e7
7
- data.tar.gz: ed91b7685224b5e613d3cc7de6cf28b36096563d5195e7e4b41069dcd691d6bb7ce49369a8f77fc5c519197bfe1984a4b0f9982520c7a6cb71efe094a69b0150
6
+ metadata.gz: 87ce3ddb256c2df177bb3a4c2390b2ce50a98d97bd25e654d90153b29d9474bd4208cfb80b2bca3cf61d6a5174042dbe8a4e2c966e374a38b0371bf2e3dc19ad
7
+ data.tar.gz: ff4a1a677217b025f7393b0c586472a57b4b232406d44e4c76b3cb37ed4fd09d265f9052f47d9d50e182c9d3ddb5892e1757dbd7293b3910cb3a248000dabb0d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.18 (2026-10-08)
4
+
5
+ - In Rails, the agent gets its file digests when it starts, so the reporter
6
+ works out the code fingerprint right away rather than at its first send, a
7
+ minute or two later. A file changed in between, as by an in-place
8
+ `git pull`, no longer ends up in the fingerprint of code that isn't running.
9
+
10
+ ## 0.1.17 (2026-10-08)
11
+
12
+ - The agent reports from every Rails environment but `development` and `test`,
13
+ so a staging or preview app running with `RAILS_ENV=staging` works without
14
+ `DEPLOYANGEL_ENABLED=true`. `config.environments`, when set, still limits it to
15
+ the listed environments.
16
+
3
17
  ## 0.1.16 (2026-10-08)
4
18
 
5
19
  - The agent finds the release in a git checkout when nothing earlier names
data/README.md CHANGED
@@ -142,7 +142,7 @@ Environment variables are enough for most apps. To override in code:
142
142
  ```ruby
143
143
  # config/initializers/deployangel.rb
144
144
  DeployAngel.configure do |config|
145
- config.environments = %w[production staging] # default: production only
145
+ config.environments = %w[production] # default: every environment but development and test
146
146
  end
147
147
  ```
148
148
 
@@ -20,7 +20,7 @@ module DeployAngel
20
20
  attr_writer :metadata
21
21
 
22
22
  def initialize(config:, environment:, root: nil, framework: nil, framework_version: nil,
23
- env: ENV, transport: nil, clock: -> { Time.now.utc }, eager: false)
23
+ env: ENV, transport: nil, clock: -> { Time.now.utc }, eager: false, metadata: nil)
24
24
  @config = config
25
25
  @active = config.active?(environment)
26
26
  @release = Release.resolve(config: config, env: env, root: root)
@@ -35,6 +35,7 @@ module DeployAngel
35
35
  @root = root
36
36
  @clock = clock
37
37
  @eager = eager
38
+ @metadata = metadata
38
39
  @thread_mutex = Mutex.new
39
40
  @warned = {}
40
41
  reset_process_state
@@ -17,7 +17,7 @@ module DeployAngel
17
17
  @token = env["DEPLOYANGEL_TOKEN"]
18
18
  @endpoint = env["DEPLOYANGEL_URL"] || DEFAULT_ENDPOINT
19
19
  @enabled = parse_boolean(env["DEPLOYANGEL_ENABLED"])
20
- @environments = %w[production]
20
+ @environments = nil
21
21
  @release_version = env["DEPLOYANGEL_RELEASE_VERSION"]
22
22
  @revision = env["DEPLOYANGEL_REVISION"]
23
23
  @flush_interval = 60
@@ -38,13 +38,19 @@ module DeployAngel
38
38
  @sidekiq_cron_schedule_file = nil
39
39
  end
40
40
 
41
- # Reports only with a token. By default only in the listed
42
- # environments; DEPLOYANGEL_ENABLED forces it on or off.
41
+ # Reports only with a token, and by default in every environment but
42
+ # these, so staging and preview apps work as they are while a token
43
+ # copied into a developer's .env stays quiet.
44
+ NON_REPORTING_ENVIRONMENTS = %w[development test].freeze
45
+
46
+ # config.environments, when set, lists the only environments to report
47
+ # from; DEPLOYANGEL_ENABLED forces it on or off.
43
48
  def active?(environment)
44
49
  return false if token.to_s.empty? || endpoint.to_s.empty?
45
50
  return enabled unless enabled.nil?
51
+ return environments.map(&:to_s).include?(environment.to_s) if environments
46
52
 
47
- environments.include?(environment.to_s)
53
+ !NON_REPORTING_ENVIRONMENTS.include?(environment.to_s)
48
54
  end
49
55
 
50
56
  # Whether requests to a route are left out. Rails answers HEAD with the
@@ -22,14 +22,16 @@ module DeployAngel
22
22
 
23
23
  config.after_initialize do |app|
24
24
  DeployAngel::Apartment.install if DeployAngel.configuration.exception_messages
25
- agent = DeployAngel.start(
25
+ # The metadata goes in at start, before the reporter thread can run:
26
+ # the code fingerprint is built from its file digests.
27
+ DeployAngel.start(
26
28
  environment: ::Rails.env,
27
29
  root: ::Rails.root.to_s,
28
30
  framework: "rails",
29
31
  framework_version: ::Rails.version,
30
- logger: ::Rails.logger
32
+ logger: ::Rails.logger,
33
+ metadata: DeployAngel::Rails::Metadata.new(app: app, config: DeployAngel.configuration, root: ::Rails.root.to_s, environment: ::Rails.env)
31
34
  )
32
- agent&.metadata = DeployAngel::Rails::Metadata.new(app: app, config: DeployAngel.configuration, root: ::Rails.root.to_s, environment: ::Rails.env)
33
35
  end
34
36
  end
35
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeployAngel
4
- VERSION = "0.1.16"
4
+ VERSION = "0.1.18"
5
5
  end
data/lib/deployangel.rb CHANGED
@@ -34,10 +34,10 @@ module DeployAngel
34
34
  # Called by the Railtie after the app boots. Web server processes start
35
35
  # reporting immediately, so idle processes still send heartbeats; other
36
36
  # processes (console, rake) only report after recording a request.
37
- def start(environment:, root: nil, framework: nil, framework_version: nil, logger: nil)
37
+ def start(environment:, root: nil, framework: nil, framework_version: nil, logger: nil, metadata: nil)
38
38
  configuration.logger = logger if logger
39
39
  @agent = Agent.new(config: configuration, environment: environment, root: root,
40
- framework: framework, framework_version: framework_version, eager: server_process?)
40
+ framework: framework, framework_version: framework_version, eager: server_process?, metadata: metadata)
41
41
  install_exit_hook
42
42
  @agent
43
43
  rescue StandardError => e
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deployangel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Owens