dyno_metadata 0.0.2 → 0.0.4
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 +5 -5
- data/README.md +46 -17
- data/lib/dyno_metadata/dyno_metadata.rb +40 -10
- data/lib/dyno_metadata/version.rb +1 -1
- data/lib/dyno_metadata.rb +2 -0
- metadata +13 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9bb9817b8f7417819e84927dc01766be7f50e043fcfbce1d8cea2c322c1d6fcc
|
4
|
+
data.tar.gz: 9b0cab218061c7908ad522b6f32da5f7a97164d7fe8035eadfd323453f471f79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14a4dea0afb79c8002772fa6cc55006bb20a10de24b80d1467226732bedfaf471333570e512393e848c288cf83662c9c8a3f3e438099891aada2fbf1fb6bafb3
|
7
|
+
data.tar.gz: ba487f1f28ba2e6cf35119c741a5c0cd2b52a68c9368b49ccb558e70a12aafe0ddfb8d8a517e76158a35b4276200821efce324512b855a169265899c40dba585
|
data/README.md
CHANGED
@@ -1,37 +1,68 @@
|
|
1
1
|
# Dyno Metadata
|
2
2
|
|
3
|
+
[](https://github.com/dentarg/dyno_metadata/actions)
|
4
|
+
|
3
5
|
Helpers to access [Heroku Dyno Metadata](https://devcenter.heroku.com/articles/dyno-metadata) from [`ENV`](https://ruby-doc.org/core-2.2.0/ENV.html). Graceful fallback to dummy values (useful in development).
|
4
6
|
|
5
7
|
Installation
|
6
8
|
|
7
9
|
gem install dyno_metadata
|
8
10
|
|
9
|
-
|
11
|
+
Methods
|
10
12
|
|
11
13
|
```ruby
|
12
|
-
$ ruby -I lib -r dyno_metadata.rb -e '
|
13
|
-
Object.methods).each { |method|
|
14
|
-
"DynoMetadata.#{method}\n
|
14
|
+
$ ruby -I lib -r dyno_metadata.rb -e ' \
|
15
|
+
(DynoMetadata.methods - Object.methods).each { |method| \
|
16
|
+
puts "DynoMetadata.#{method}\n" ; \
|
17
|
+
}'
|
15
18
|
DynoMetadata.app_id
|
16
|
-
=> 9daa2797-e49b-4624-932f-ec3f9688e3da
|
17
19
|
DynoMetadata.app_name
|
18
|
-
=> example-app
|
19
20
|
DynoMetadata.dyno_id
|
20
|
-
=> 1vac4117-c29f-4312-521e-ba4d8638c1ac
|
21
21
|
DynoMetadata.release_created_at
|
22
|
-
=> 2015-04-02T18:00:42Z
|
23
22
|
DynoMetadata.release_version
|
24
|
-
=> v42
|
25
23
|
DynoMetadata.slug_commit
|
26
|
-
=> 2c3a0b24069af49b3de35b8e8c26765c1dba9ff0
|
27
24
|
DynoMetadata.commit
|
28
|
-
=> 2c3a0b24069af49b3de35b8e8c26765c1dba9ff0
|
29
25
|
DynoMetadata.slug_description
|
30
|
-
=> Deploy 2c3a0b2
|
31
26
|
DynoMetadata.short_commit
|
32
|
-
=> 2c3a0b2
|
33
27
|
DynoMetadata.to_h
|
34
|
-
|
28
|
+
```
|
29
|
+
|
30
|
+
Demonstration
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
$ ruby -I lib -r dyno_metadata.rb -e ' \
|
34
|
+
(DynoMetadata.methods - Object.methods).each { |method| \
|
35
|
+
puts "> DynoMetadata.#{method}\n" ; \
|
36
|
+
print "=> " ; \
|
37
|
+
p DynoMetadata.public_send(method) \
|
38
|
+
} ; \
|
39
|
+
puts "> DynoMetadata.short_commit(12)\n" ; \
|
40
|
+
print "=> " ; \
|
41
|
+
p DynoMetadata.short_commit(12)'
|
42
|
+
> DynoMetadata.app_id
|
43
|
+
=> "9daa2797-e49b-4624-932f-ec3f9688e3da"
|
44
|
+
> DynoMetadata.app_name
|
45
|
+
=> "example-app"
|
46
|
+
> DynoMetadata.dyno
|
47
|
+
=> "web.1"
|
48
|
+
> DynoMetadata.dyno_id
|
49
|
+
=> "1vac4117-c29f-4312-521e-ba4d8638c1ac"
|
50
|
+
> DynoMetadata.release_created_at
|
51
|
+
=> "2015-04-02T18:00:42Z"
|
52
|
+
> DynoMetadata.release_version
|
53
|
+
=> "v42"
|
54
|
+
> DynoMetadata.slug_commit
|
55
|
+
=> "2c3a0b24069af49b3de35b8e8c26765c1dba9ff0"
|
56
|
+
> DynoMetadata.commit
|
57
|
+
=> "2c3a0b24069af49b3de35b8e8c26765c1dba9ff0"
|
58
|
+
> DynoMetadata.slug_description
|
59
|
+
=> "Deploy 2c3a0b2"
|
60
|
+
> DynoMetadata.short_commit
|
61
|
+
=> "2c3a0b2"
|
62
|
+
> DynoMetadata.to_h
|
63
|
+
=> {:app_id=>"9daa2797-e49b-4624-932f-ec3f9688e3da", :app_name=>"example-app", :dyno=>"web.1", :dyno_id=>"1vac4117-c29f-4312-521e-ba4d8638c1ac", :release_created_at=>"2015-04-02T18:00:42Z", :release_version=>"v42", :slug_commit=>"2c3a0b24069af49b3de35b8e8c26765c1dba9ff0", :slug_description=>"Deploy 2c3a0b2", :short_commit=>"2c3a0b2"}
|
64
|
+
> DynoMetadata.short_commit(12)
|
65
|
+
=> "2c3a0b24069a"
|
35
66
|
```
|
36
67
|
|
37
68
|
## Development
|
@@ -48,6 +79,4 @@ DynoMetadata.to_h
|
|
48
79
|
|
49
80
|
* If you are not logged in as on the correct account, the rake task will fail and tell you to set credentials via `gem push`, do that and run the `release` task again. Use [keycutter](https://github.com/joshfrench/keycutter) to manage multiple RubyGems accounts.
|
50
81
|
|
51
|
-
* Update the changelog
|
52
|
-
|
53
|
-
github_changelog_generator
|
82
|
+
* Update the changelog manually, commit and push.
|
@@ -8,38 +8,64 @@ module DynoMetadata
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def app_name
|
11
|
-
fetch "HEROKU_APP_NAME", "example-app"
|
11
|
+
fetch "HEROKU_APP_NAME", "FLY_APP_NAME", "example-app"
|
12
|
+
end
|
13
|
+
|
14
|
+
def dyno
|
15
|
+
fetch "DYNO", "web.1"
|
12
16
|
end
|
13
17
|
|
14
18
|
def dyno_id
|
15
|
-
fetch "HEROKU_DYNO_ID", "1vac4117-c29f-4312-521e-ba4d8638c1ac"
|
19
|
+
fetch "HEROKU_DYNO_ID", "FLY_ALLOC_ID", "1vac4117-c29f-4312-521e-ba4d8638c1ac"
|
20
|
+
end
|
21
|
+
|
22
|
+
def fly_alloc_id
|
23
|
+
fetch "FLY_ALLOC_ID", "b996131a-5bae-215b-d0f1-2d75d1a8812b"
|
24
|
+
end
|
25
|
+
|
26
|
+
def fly_region
|
27
|
+
fetch "FLY_REGION", "ams"
|
28
|
+
end
|
29
|
+
|
30
|
+
def fly_public_ip
|
31
|
+
fetch "FLY_PUBLIC_IP", "127.0.0.1"
|
32
|
+
end
|
33
|
+
|
34
|
+
def fly_vcpu_count
|
35
|
+
fetch "FLY_VCPU_COUNT", "99"
|
36
|
+
end
|
37
|
+
|
38
|
+
def fly_vm_memory_mb
|
39
|
+
fetch "FLY_VM_MEMORY_MB", "1337"
|
16
40
|
end
|
17
41
|
|
18
42
|
def release_created_at
|
19
|
-
fetch "HEROKU_RELEASE_CREATED_AT", "2015-04-02T18:00:42Z"
|
43
|
+
fetch "HEROKU_RELEASE_CREATED_AT", "RELEASE_CREATED_AT", "2015-04-02T18:00:42Z"
|
20
44
|
end
|
21
45
|
|
22
46
|
def release_version
|
23
|
-
fetch "HEROKU_RELEASE_VERSION", "v42"
|
47
|
+
fetch "HEROKU_RELEASE_VERSION", "RELEASE_VERSION", "v42"
|
24
48
|
end
|
25
49
|
|
26
50
|
def slug_commit
|
27
|
-
fetch "HEROKU_SLUG_COMMIT", "2c3a0b24069af49b3de35b8e8c26765c1dba9ff0"
|
51
|
+
fetch "HEROKU_SLUG_COMMIT", "RELEASE_COMMIT", "2c3a0b24069af49b3de35b8e8c26765c1dba9ff0"
|
28
52
|
end
|
29
53
|
singleton_class.send(:alias_method, :commit, :slug_commit)
|
54
|
+
singleton_class.send(:alias_method, :release_commit, :slug_commit)
|
30
55
|
|
31
56
|
def slug_description
|
32
57
|
fetch "HEROKU_SLUG_DESCRIPTION", "Deploy 2c3a0b2"
|
33
58
|
end
|
34
59
|
|
35
|
-
def short_commit
|
36
|
-
slug_commit[0,
|
60
|
+
def short_commit(length = 7)
|
61
|
+
slug_commit[0, length]
|
37
62
|
end
|
38
63
|
|
39
|
-
def to_h
|
64
|
+
def to_h # rubocop:disable Metrics/MethodLength
|
40
65
|
{
|
41
66
|
app_id: app_id,
|
42
67
|
app_name: app_name,
|
68
|
+
dyno: dyno,
|
43
69
|
dyno_id: dyno_id,
|
44
70
|
release_created_at: release_created_at,
|
45
71
|
release_version: release_version,
|
@@ -49,7 +75,11 @@ module DynoMetadata
|
|
49
75
|
}
|
50
76
|
end
|
51
77
|
|
52
|
-
private_class_method def fetch(
|
53
|
-
|
78
|
+
private_class_method def fetch(*variable_names, fallback)
|
79
|
+
variable_names.each do |var_name|
|
80
|
+
return ENV[var_name] if ENV.key?(var_name)
|
81
|
+
end
|
82
|
+
|
83
|
+
fallback
|
54
84
|
end
|
55
85
|
end
|
data/lib/dyno_metadata.rb
CHANGED
metadata
CHANGED
@@ -1,61 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyno_metadata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrik Ragnarsson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rake
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '11'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '11'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '3'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '3'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rubocop
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0.46'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0.46'
|
11
|
+
date: 2022-11-03 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
55
13
|
description: |-
|
56
14
|
Gives easy access to details about the release, dyno size,
|
57
|
-
|
58
|
-
|
15
|
+
application name as well as the unique identifier for the
|
16
|
+
particular running dyno on Heroku. Also supports Fly.io.
|
59
17
|
email:
|
60
18
|
- patrik@starkast.net
|
61
19
|
executables: []
|
@@ -66,11 +24,12 @@ files:
|
|
66
24
|
- lib/dyno_metadata.rb
|
67
25
|
- lib/dyno_metadata/dyno_metadata.rb
|
68
26
|
- lib/dyno_metadata/version.rb
|
69
|
-
homepage:
|
27
|
+
homepage: https://github.com/dentarg/dyno_metadata
|
70
28
|
licenses:
|
71
29
|
- MIT
|
72
|
-
metadata:
|
73
|
-
|
30
|
+
metadata:
|
31
|
+
rubygems_mfa_required: 'true'
|
32
|
+
post_install_message:
|
74
33
|
rdoc_options: []
|
75
34
|
require_paths:
|
76
35
|
- lib
|
@@ -78,16 +37,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
37
|
requirements:
|
79
38
|
- - ">="
|
80
39
|
- !ruby/object:Gem::Version
|
81
|
-
version: 2.
|
40
|
+
version: 2.5.9
|
82
41
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
42
|
requirements:
|
84
43
|
- - ">="
|
85
44
|
- !ruby/object:Gem::Version
|
86
45
|
version: '0'
|
87
46
|
requirements: []
|
88
|
-
|
89
|
-
|
90
|
-
signing_key:
|
47
|
+
rubygems_version: 3.3.22
|
48
|
+
signing_key:
|
91
49
|
specification_version: 4
|
92
50
|
summary: Information about the app and environment on Heroku.
|
93
51
|
test_files: []
|