dice_bag 1.3.2 → 1.3.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 +4 -4
- data/lib/dice_bag/project.rb +5 -2
- data/lib/dice_bag/version.rb +1 -1
- data/spec/command_spec.rb +28 -0
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5904157b01abe47270b498bcfc8774f0e957f1684f4a41801fb7cd37b8d8a0c1
|
4
|
+
data.tar.gz: 7cfa5ac9041c69b21fd3129e841a3d6f6b1fb41aa33bacf47629dae5f2d296a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d88e2ff2d7cbc111140e34062854dde082b6c6dd0f21ebf19b04656a5e129e57f65910a62178fd862f77430340d5081c2141cdeb30f4b43081c0b6a2755f151
|
7
|
+
data.tar.gz: 1fe7033f94c1d15294582f90586ade1c67edd936becd5c67bca58ecc6ac7254a28f528d7b846053d806ab91737ad8ce65fa4c2e0471bc31e9a13ceee535dca9c
|
data/lib/dice_bag/project.rb
CHANGED
@@ -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
|
-
|
8
|
-
|
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)
|
data/lib/dice_bag/version.rb
CHANGED
data/spec/command_spec.rb
CHANGED
@@ -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.
|
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-
|
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:
|
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
|
-
|
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
|