rails_app_version 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec8b9fb82abafba7d8a6cc3e95b908be05ff5ed00b1150cdc8002bfa65bd1a23
4
- data.tar.gz: 16aa8846723ac2fe2321139bd125084357fb739cdd23fd86a0955a4ade4eb1ec
3
+ metadata.gz: 521458301f505b418494a8ff6cc39fe5f40c4b192f2cfb5f8183186c3161101d
4
+ data.tar.gz: c5ac04bdaaff5a942e831511df3a8eeed9b564cfbcd213e05cf79a0140a1325a
5
5
  SHA512:
6
- metadata.gz: a0057f8dbd4ee9e2ab10ff7d0b8f795ede4c4a3b8644cff9a31d4b7683cd6d7451ed01ac22b5aa51f4fd2d80b50545205bd27365059fc428c6c903f77cb5d290
7
- data.tar.gz: 181f9d0d1def9eeca5c46034ad0848cd1094d0fd4ba9ecd080c2772b331d62e634bd7c2e60b5d01f9bf5696705f58142953bf0110085b42a73bbf85bb1a5734f
6
+ metadata.gz: 68e00da37bc81058bd32825d1d02a4a96bff4383a5d457bae668a01fa4f5b1c929dc8cbb9d3b6b874688802691b2a7591185305a0125ce6c1526d9c31e80d066
7
+ data.tar.gz: f9e53048da586ed9c9d8c7927bc840144dbb7e3f13655b09da398368b88c3cb401ca8d7a3b926696d58b3439de7c2941d5fb0d7157616d45a348bb86f6d732ff
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAppVersion
4
- VERSION = "0.2.0"
4
+ VERSION = "1.0.0"
5
5
  end
@@ -3,6 +3,7 @@
3
3
  require "rails"
4
4
  require "rails/application"
5
5
  require "rails_app_version/version"
6
+ require "action_controller/railtie"
6
7
 
7
8
  module RailsAppVersion
8
9
  class Version < Gem::Version
@@ -11,15 +12,19 @@ module RailsAppVersion
11
12
  (to_s).parameterize
12
13
  end
13
14
  end
14
- class Engine < ::Rails::Engine
15
+ class Railtie < ::Rails::Railtie
15
16
  attr_reader :app_config, :version, :env
16
17
 
18
+ def root
19
+ @root ||= Pathname.new(File.expand_path("..", __dir__))
20
+ end
21
+
17
22
  rake_tasks do
18
23
  namespace :app do
19
24
  namespace :version do
20
25
  desc "Copy config/app_version.yml to the main app config directory"
21
26
  task :config do
22
- source = RailsAppVersion::Engine.root.join("config", "app_version.yml")
27
+ source = RailsAppVersion::Railtie.root.join("config", "app_version.yml")
23
28
  destination = Rails.root.join("config", "app_version.yml")
24
29
 
25
30
  FileUtils.cp(source, destination)
@@ -30,13 +35,24 @@ module RailsAppVersion
30
35
  end
31
36
  end
32
37
 
38
+ # Console
39
+ console do
40
+ # rubocop:disable Rails/Output
41
+ puts "Welcome to the Rails console!"
42
+ puts "Ruby version: #{RUBY_VERSION}"
43
+ puts "Application environment: #{Rails.application.env}"
44
+ puts "Application version: #{Rails.application.version}"
45
+ puts "To exit, press `Ctrl + D`."
46
+ # rubocop:enable Rails/Output
47
+ end
48
+
33
49
  initializer "fetch_config" do |app|
34
50
  @app_config = begin
35
51
  app.config_for(:app_version, env: Rails.env)
36
52
  rescue RuntimeError
37
53
  # Load the default configuration from the gem, if the app does not have one
38
54
  require "erb"
39
- yaml = Engine.root.join("config", "app_version.yml")
55
+ yaml = Railtie.root.join("config", "app_version.yml")
40
56
  all_configs = ActiveSupport::ConfigurationFile.parse(yaml).deep_symbolize_keys
41
57
  all_configs[:shared]
42
58
  end
@@ -52,7 +68,7 @@ module RailsAppVersion
52
68
  included do
53
69
  def version
54
70
  @version ||= railties.find do |railtie|
55
- railtie.is_a?(RailsAppVersion::Engine)
71
+ railtie.is_a?(RailsAppVersion::Railtie)
56
72
  end.version
57
73
  end
58
74
  end
@@ -64,7 +80,7 @@ module RailsAppVersion
64
80
  included do
65
81
  def env
66
82
  @env ||= railties.find do |railtie|
67
- railtie.is_a?(RailsAppVersion::Engine)
83
+ railtie.is_a?(RailsAppVersion::Railtie)
68
84
  end.env
69
85
  end
70
86
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_app_version
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: appraisal
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Get the version of your Rails app
42
56
  email:
43
57
  - terminale@gmail.com