rails_app_version 0.1.0 → 0.1.2
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 +4 -4
- data/README.md +12 -8
- data/config/app_version.yml +4 -0
- data/lib/rails_app_version/version.rb +1 -1
- data/lib/rails_app_version.rb +10 -9
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 381e86a1a9a44077393c49d8f813c3ddab906e0672021d5498fac963bf2640b7
|
4
|
+
data.tar.gz: 5826b91f6d12cd73f08ac4a7a6f987021f0b82303f126e22d5cd608168318ec6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e522072844c9469560d3d199b2797cf0d9a494771e6df31fbba1349a4ba21d8b219c31443381080e803808c77df1a26b150886b744a053485131ddc7851d322f
|
7
|
+
data.tar.gz: 5b1926f667890b37c4e58e52879623338bca9cf9b10c62ff25a2b730a0f0ddbd0cd9075dad7773457bca6d6675e0e9f3cbaf307e41b3788b297074e23f7ad94c
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# Rails AppVersion
|
2
2
|
|
3
|
-
|
3
|
+
Rails AppVersion is a Ruby on Rails engine designed to easily manage and access your application's version and environment information.
|
4
|
+
|
5
|
+
It allows for a seamless integration of versioning within your Rails application, providing a straightforward way to access the current application version and environment without hardcoding these values.
|
6
|
+
|
7
|
+
This gem is exclusively build for Rails applications and is compatible with Rails 7.0 and above.
|
4
8
|
|
5
9
|
## Usage
|
6
10
|
How to use my plugin.
|
@@ -30,12 +34,12 @@ Rails.application.environment # => "staging"
|
|
30
34
|
- Flexible Usage: Access the application version and environment information anywhere in your Rails application.
|
31
35
|
|
32
36
|
## Contributing
|
33
|
-
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
|
34
|
-
1.
|
35
|
-
2.
|
36
|
-
3.
|
37
|
-
4.
|
38
|
-
5.
|
37
|
+
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
|
38
|
+
1. Fork the repo
|
39
|
+
2. Create your feature branch (git checkout -b my-new-feature)
|
40
|
+
3. Commit your changes (git commit -am 'Add some feature')
|
41
|
+
4. Push to the branch (git push origin my-new-feature)
|
42
|
+
5. Create a new Pull Request
|
39
43
|
|
40
44
|
## License
|
41
45
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/rails_app_version.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "rails"
|
4
|
+
require "rails/application"
|
5
|
+
require "rails_app_version/version"
|
4
6
|
|
5
7
|
module RailsAppVersion
|
6
8
|
class Engine < ::Rails::Engine
|
7
9
|
attr_reader :app_config, :version, :environment
|
8
10
|
|
9
|
-
initializer
|
11
|
+
initializer "fetch_config" do |app|
|
10
12
|
@app_config = begin
|
11
13
|
app.config_for(:app_version)
|
12
14
|
rescue RuntimeError
|
13
15
|
# Load the default configuration from the gem, if the app does not have one
|
14
|
-
require
|
15
|
-
yaml = Engine.root.join(
|
16
|
+
require "erb"
|
17
|
+
yaml = Engine.root.join("config", "app_version.yml")
|
16
18
|
all_configs = ActiveSupport::ConfigurationFile.parse(yaml).deep_symbolize_keys
|
17
19
|
all_configs[:shared]
|
18
20
|
end
|
@@ -20,11 +22,6 @@ module RailsAppVersion
|
|
20
22
|
@version = @app_config[:version]
|
21
23
|
@environment = @app_config[:environment] || Rails.env
|
22
24
|
end
|
23
|
-
initializer 'patch_application' do |app|
|
24
|
-
# Inject the module into the application
|
25
|
-
app.class.send(:include, RailsAppVersion::AppVersion)
|
26
|
-
app.class.send(:include, RailsAppVersion::AppEnvironment)
|
27
|
-
end
|
28
25
|
end
|
29
26
|
|
30
27
|
module AppVersion
|
@@ -51,3 +48,7 @@ module RailsAppVersion
|
|
51
48
|
end
|
52
49
|
end
|
53
50
|
end
|
51
|
+
|
52
|
+
|
53
|
+
Rails::Application.include RailsAppVersion::AppVersion
|
54
|
+
Rails::Application.include RailsAppVersion::AppEnvironment
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_app_version
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdelkader Boudih
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -33,6 +33,7 @@ extra_rdoc_files: []
|
|
33
33
|
files:
|
34
34
|
- README.md
|
35
35
|
- Rakefile
|
36
|
+
- config/app_version.yml
|
36
37
|
- lib/rails_app_version.rb
|
37
38
|
- lib/rails_app_version/version.rb
|
38
39
|
homepage: https://github.com/seuros/rails_app_version
|
@@ -50,7 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
51
|
requirements:
|
51
52
|
- - ">="
|
52
53
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
54
|
+
version: 3.1.0
|
54
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
56
|
requirements:
|
56
57
|
- - ">="
|