dice_bag 1.3.2 → 1.3.3

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: 5a746ff933e6fc286fb83e0773837318e7c5474305f134522becee1a7633062a
4
- data.tar.gz: 2ef5740432f756bb865e9fd4b6ba16f4959ad9e907c8acbabb7f25cab78a50f4
3
+ metadata.gz: 5904157b01abe47270b498bcfc8774f0e957f1684f4a41801fb7cd37b8d8a0c1
4
+ data.tar.gz: 7cfa5ac9041c69b21fd3129e841a3d6f6b1fb41aa33bacf47629dae5f2d296a5
5
5
  SHA512:
6
- metadata.gz: bdefa0ab34fafe43c4be1c1e0de92ef4623ace5004bbb271c5da49a0c245299e3422c5d110411227654c1854485f6b561433527641f5e3bdd97bb46fb963a498
7
- data.tar.gz: c3904fd8f758752bbb2ebd572f7a0b99814ed91c5d52ffc0dc35a020d7e6ae41bd2fc5d4d0b01400d86a92aeab11a01a37e56fb3fdf23feb02ce409c45c6ff81
6
+ metadata.gz: 0d88e2ff2d7cbc111140e34062854dde082b6c6dd0f21ebf19b04656a5e129e57f65910a62178fd862f77430340d5081c2141cdeb30f4b43081c0b6a2755f151
7
+ data.tar.gz: 1fe7033f94c1d15294582f90586ade1c67edd936becd5c67bca58ecc6ac7254a28f528d7b846053d806ab91737ad8ce65fa4c2e0471bc31e9a13ceee535dca9c
@@ -3,9 +3,12 @@ module DiceBag
3
3
  class Project
4
4
  DEFAULT_NAME = "project"
5
5
 
6
+ # TODO: how to find the name of the project in non Rails apps?
6
7
  def self.name
7
- # TODO: how to do find the name of the project in no-rails environments?
8
- defined?(Rails) ? Rails.application.class.parent_name.downcase : DEFAULT_NAME
8
+ return DEFAULT_NAME unless defined?(Rails)
9
+
10
+ parent_name_method = Module.respond_to?(:module_parent_name) ? :module_parent_name : :parent_name
11
+ Rails.application.class.send(parent_name_method).downcase
9
12
  end
10
13
 
11
14
  def self.config_files(filename)
@@ -1,3 +1,3 @@
1
1
  module DiceBag
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
3
3
  end
@@ -8,5 +8,33 @@ describe DiceBag::Project do
8
8
  it "should give me a default name for non Rails apps" do
9
9
  expect(project.name).to eq(DiceBag::Project::DEFAULT_NAME)
10
10
  end
11
+
12
+ context "Rails app" do
13
+ let(:name) { "HelloService" }
14
+ let(:rails) { Class.new }
15
+ before { stub_const("Rails", rails) }
16
+
17
+ describe "Rails < 6.1" do
18
+ before do
19
+ allow(Module).to receive(:parent_name).and_return(name)
20
+ allow(rails).to receive_message_chain(:application, :class, :parent_name).and_return(name)
21
+ end
22
+
23
+ it "uses the :parent_name method" do
24
+ expect(project.name).to eq("helloservice")
25
+ end
26
+ end
27
+
28
+ describe "Rails >= 6.1" do
29
+ before do
30
+ allow(Module).to receive(:module_parent_name).and_return(name)
31
+ allow(rails).to receive_message_chain(:application, :class, :module_parent_name).and_return(name)
32
+ end
33
+
34
+ it "uses the :module_parent_name method" do
35
+ expect(project.name).to eq("helloservice")
36
+ end
37
+ end
38
+ end
11
39
  end
12
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dice_bag
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-01-08 00:00:00.000000000 Z
12
+ date: 2019-05-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -128,10 +128,12 @@ files:
128
128
  - spec/command_spec.rb
129
129
  - spec/configuration_spec.rb
130
130
  - spec/spec_helper.rb
131
- homepage: https://github.com/mdsol/dice_bag
131
+ homepage:
132
132
  licenses:
133
133
  - MIT
134
- metadata: {}
134
+ metadata:
135
+ homepage_uri: https://github.com/mdsol/dice_bag
136
+ changelog_uri: https://github.com/mdsol/dice_bag/blob/develop/CHANGELOG.md
135
137
  post_install_message:
136
138
  rdoc_options: []
137
139
  require_paths:
@@ -147,14 +149,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
149
  - !ruby/object:Gem::Version
148
150
  version: '0'
149
151
  requirements: []
150
- rubyforge_project:
151
- rubygems_version: 2.7.6
152
+ rubygems_version: 3.0.3
152
153
  signing_key:
153
154
  specification_version: 4
154
155
  summary: Dice Bag is a library of rake tasks for configuring web apps in the style
155
156
  of The Twelve-Factor App. It also provides continuous integration tasks that rely
156
157
  on the configuration tasks.
157
158
  test_files:
159
+ - spec/command_spec.rb
158
160
  - spec/spec_helper.rb
159
161
  - spec/configuration_spec.rb
160
- - spec/command_spec.rb