rails_env_prompt 0.2.0 → 1.0.3

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
- SHA1:
3
- metadata.gz: 1f2c5b4dc4ae6193817d082dc67dc50dd08ef669
4
- data.tar.gz: 0fdf81d473085e6aec62ba99b4cda05993c3e1cb
2
+ SHA256:
3
+ metadata.gz: 87ebd0c44cea8f3e036144384823b8bf9e615370097b305fb550071c2b4f7560
4
+ data.tar.gz: 905eaf47bd13897857597c36b25d47fb6fba8962ad78b3268f0d8812d196c248
5
5
  SHA512:
6
- metadata.gz: 0bac5c661088bc1845dba4bc9e13cb94f245ef174823860ea1d07610a712e34e275ad7271cfe5889f5e2e0a81e30d05de17fd1f7b5cc48d2c8163a00ee13877f
7
- data.tar.gz: 207d036d54a0581db9207a47b024aeb69bc5c284808661fab253a8956cf27be1d2447183c378822ba151a7b66576802a80673512c1d45a626a677acca88ecfd2
6
+ metadata.gz: 7cea7c22d61b726e78fc205e505ad7ddfab6acd2c7d8bf9c9561ff3043449d5ab1d50cfee1e5cb395450383669a9be70334014c470013b120bdc504fc8e262fe
7
+ data.tar.gz: 2d8bbc9f4553eb202b6141bbc40005c26068b62ae1ad3f882b77c2f9faecf4094c0bae5701efa029c1faeafa39a5e411d896635179a13df0b166a38128f3bb66
data/Gemfile.lock CHANGED
@@ -1,21 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_env_prompt (0.2.0)
4
+ rails_env_prompt (1.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- rake (10.5.0)
9
+ rake (13.0.1)
10
10
 
11
11
  PLATFORMS
12
12
  ruby
13
13
  universal-darwin-18
14
+ universal-darwin-20
15
+ x86_64-darwin-19
14
16
 
15
17
  DEPENDENCIES
16
18
  bundler (~> 1.16)
17
19
  rails_env_prompt!
18
- rake (~> 10.0)
20
+ rake (~> 13.0)
19
21
 
20
22
  BUNDLED WITH
21
- 1.16.3
23
+ 1.17.3
@@ -3,6 +3,18 @@ require 'rails_env_prompt/pry'
3
3
  require 'rails_env_prompt/version'
4
4
 
5
5
  module RailsEnvPrompt
6
+ def self.app_name
7
+ @app_name ||= begin
8
+ application_class = Rails.application.class
9
+
10
+ case
11
+ when application_class.method_defined?(:module_parent_name) then application_class.module_parent_name
12
+ when application_class.method_defined?(:parent_name) then application_class.parent_name
13
+ else application_class.name =~ /::[^:]+\z/ ? -$` : nil
14
+ end
15
+ end
16
+ end
17
+
6
18
  def self.template
7
19
  [
8
20
  '[APP]',
@@ -12,7 +24,7 @@ module RailsEnvPrompt
12
24
  end
13
25
 
14
26
  def self.parse(string)
15
- string.gsub('[APP]', Rails.application.class.parent_name)
27
+ string.gsub('[APP]', app_name)
16
28
  .gsub('[ENV]', colored(Rails.env, environment_color))
17
29
  .gsub('[TENANT]', defined?(Apartment) ? Apartment::Tenant.current : '')
18
30
  end
@@ -2,9 +2,7 @@ require 'irb'
2
2
 
3
3
  module IRB
4
4
  class << self
5
- def setup_with_prompt_override(ap_path)
6
- setup_without_prompt_override(ap_path)
7
-
5
+ def _patch
8
6
  prompt = RailsEnvPrompt.template
9
7
 
10
8
  prompts = {
@@ -34,7 +32,18 @@ module IRB
34
32
  IRB.conf[:PROMPT_MODE] = :RAILS_ENV_PROMPT
35
33
  end
36
34
 
37
- alias setup_without_prompt_override setup
38
- alias setup setup_with_prompt_override
35
+ _setup = instance_method(:setup)
36
+
37
+ if _setup.arity == -2
38
+ define_method(:setup) do |ap_path, argv: ::ARGV|
39
+ _setup.bind(self).call(ap_path, argv: argv)
40
+ _patch
41
+ end
42
+ else
43
+ define_method(:setup) do |ap_path|
44
+ _setup.bind(self).call(ap_path)
45
+ _patch
46
+ end
47
+ end
39
48
  end
40
49
  end
@@ -1,3 +1,3 @@
1
1
  module RailsEnvPrompt
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '1.0.3'.freeze
3
3
  end
@@ -7,6 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.version = RailsEnvPrompt::VERSION
8
8
  spec.authors = ['Rene van Lieshout']
9
9
  spec.email = ['rene@lico.nl']
10
+ spec.licenses = ['MIT']
10
11
 
11
12
  spec.summary = 'Adds current Rails env and Apartment tenant to prompt'
12
13
  spec.description = 'Adds current Rails env and Apartment tenant to prompt'
@@ -23,5 +24,5 @@ Gem::Specification.new do |spec|
23
24
  spec.require_paths = ['lib']
24
25
 
25
26
  spec.add_development_dependency 'bundler', '~> 1.16'
26
- spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rake', '~> 13.0'
27
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_env_prompt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rene van Lieshout
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-27 00:00:00.000000000 Z
11
+ date: 2021-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  description: Adds current Rails env and Apartment tenant to prompt
42
42
  email:
43
43
  - rene@lico.nl
@@ -56,7 +56,8 @@ files:
56
56
  - lib/rails_env_prompt/version.rb
57
57
  - rails_env_prompt.gemspec
58
58
  homepage: https://github.com/rvanlieshout/rails_env_prompt
59
- licenses: []
59
+ licenses:
60
+ - MIT
60
61
  metadata: {}
61
62
  post_install_message:
62
63
  rdoc_options: []
@@ -73,8 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
74
  - !ruby/object:Gem::Version
74
75
  version: '0'
75
76
  requirements: []
76
- rubyforge_project:
77
- rubygems_version: 2.5.2.3
77
+ rubygems_version: 3.0.3
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Adds current Rails env and Apartment tenant to prompt