rails_app_version 0.2.0 → 0.2.1
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/lib/rails_app_version/version.rb +1 -1
- data/lib/rails_app_version.rb +9 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f12fcf73c08d447843831ce2387b14fae8302f8d3ec2c08dd3548e471435c2a1
|
4
|
+
data.tar.gz: 88361140e3a6ac93c378aaf8e38f253864fb2bebc1920b81903fb305c4863631
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce3f381f908e7eb51dc36bf82cb0d1f32a521563f93d4c68642cba6f7a6e54a7a460f55333352b0aca4a1348e740f959a08c4333495e20e9e874843edbf2fde6
|
7
|
+
data.tar.gz: f7a240228914ad118252befd33fcaf60647194da681a72360265c7274715d388026e29815c2bdc025c8cc1014aa6c8a6daa9b6f62aaa70fca1cd65b2afb71071
|
data/lib/rails_app_version.rb
CHANGED
@@ -11,15 +11,19 @@ module RailsAppVersion
|
|
11
11
|
(to_s).parameterize
|
12
12
|
end
|
13
13
|
end
|
14
|
-
class
|
14
|
+
class Railtie < ::Rails::Railtie
|
15
15
|
attr_reader :app_config, :version, :env
|
16
16
|
|
17
|
+
def root
|
18
|
+
@root ||= Pathname.new(File.expand_path("..", __dir__))
|
19
|
+
end
|
20
|
+
|
17
21
|
rake_tasks do
|
18
22
|
namespace :app do
|
19
23
|
namespace :version do
|
20
24
|
desc "Copy config/app_version.yml to the main app config directory"
|
21
25
|
task :config do
|
22
|
-
source = RailsAppVersion::
|
26
|
+
source = RailsAppVersion::Railtie.root.join("config", "app_version.yml")
|
23
27
|
destination = Rails.root.join("config", "app_version.yml")
|
24
28
|
|
25
29
|
FileUtils.cp(source, destination)
|
@@ -36,7 +40,7 @@ module RailsAppVersion
|
|
36
40
|
rescue RuntimeError
|
37
41
|
# Load the default configuration from the gem, if the app does not have one
|
38
42
|
require "erb"
|
39
|
-
yaml =
|
43
|
+
yaml = Railtie.root.join("config", "app_version.yml")
|
40
44
|
all_configs = ActiveSupport::ConfigurationFile.parse(yaml).deep_symbolize_keys
|
41
45
|
all_configs[:shared]
|
42
46
|
end
|
@@ -52,7 +56,7 @@ module RailsAppVersion
|
|
52
56
|
included do
|
53
57
|
def version
|
54
58
|
@version ||= railties.find do |railtie|
|
55
|
-
railtie.is_a?(RailsAppVersion::
|
59
|
+
railtie.is_a?(RailsAppVersion::Railtie)
|
56
60
|
end.version
|
57
61
|
end
|
58
62
|
end
|
@@ -64,7 +68,7 @@ module RailsAppVersion
|
|
64
68
|
included do
|
65
69
|
def env
|
66
70
|
@env ||= railties.find do |railtie|
|
67
|
-
railtie.is_a?(RailsAppVersion::
|
71
|
+
railtie.is_a?(RailsAppVersion::Railtie)
|
68
72
|
end.env
|
69
73
|
end
|
70
74
|
end
|