policy 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/policy/cli.rb +4 -0
- data/lib/policy/cli/locale.erb +1 -1
- data/lib/policy/cli/policy.erb +16 -0
- data/lib/policy/cli/spec.erb +1 -1
- data/lib/policy/version.rb +1 -1
- data/spec/tests/policy/cli_spec.rb +8 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11f8a87bec42ea9a04af224a56604ff2d690a8da
|
4
|
+
data.tar.gz: f8d9626c4298248ef86f91c7720afb8c26f976d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a76b932814bdbf8a70eb7e5ac55dc9ad1d82f93ae8c9d6151ebdceeeea0979e616c8f70637b7a777f50ee1e7ad30013f039d33fd5329665d0e128a06f8af8bd
|
7
|
+
data.tar.gz: 532d978cd83c62e7374d46a00f44c6c4034f9df1e3cccbe386d4f43a1cf60fc926580dc33996bd2892a2e4ca13accd265e256bfabf828c855ac7ad4472be8bb9
|
data/lib/policy/cli.rb
CHANGED
data/lib/policy/cli/locale.erb
CHANGED
data/lib/policy/cli/policy.erb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
<% tabs = 0 -%>
|
3
|
+
<% project.namespaces.each do |item| -%>
|
4
|
+
|
5
|
+
<%= " " * tabs %>module <%= item %>
|
6
|
+
<% tabs += 1 -%>
|
7
|
+
<% end -%>
|
8
|
+
|
9
|
+
<%= " " * tabs %>module <%= project.const %>
|
10
|
+
<% tabs += 1 -%>
|
3
11
|
<% policy.namespaces.each do |item| -%>
|
4
12
|
|
5
13
|
<%= " " * tabs %>module <%= item %>
|
@@ -27,3 +35,11 @@
|
|
27
35
|
<% tabs -= 1 -%>
|
28
36
|
<%= " " * tabs %>end # module <%= item %>
|
29
37
|
<% end -%>
|
38
|
+
|
39
|
+
<% tabs -= 1 -%>
|
40
|
+
<%= " " * tabs %>end # module <%= project.const %>
|
41
|
+
<% project.namespaces.reverse.each do |item| -%>
|
42
|
+
|
43
|
+
<% tabs -= 1 -%>
|
44
|
+
<%= " " * tabs %>end # module <%= item %>
|
45
|
+
<% end -%>
|
data/lib/policy/cli/spec.erb
CHANGED
data/lib/policy/version.rb
CHANGED
@@ -7,7 +7,7 @@ describe Policy::CLI, :sandbox, :capture do
|
|
7
7
|
|
8
8
|
subject { try_in_sandbox { described_class.start options } }
|
9
9
|
|
10
|
-
shared_examples "adding a policy" do |folder
|
10
|
+
shared_examples "adding a policy" do |folder: nil|
|
11
11
|
|
12
12
|
let(:filename) { File.join("app", folder, "foo.rb") }
|
13
13
|
|
@@ -17,7 +17,7 @@ describe Policy::CLI, :sandbox, :capture do
|
|
17
17
|
|
18
18
|
end # examples
|
19
19
|
|
20
|
-
shared_examples "adding a spec" do |folder
|
20
|
+
shared_examples "adding a spec" do |folder: nil|
|
21
21
|
|
22
22
|
let(:filename) { File.join("spec/tests", folder, "foo_spec.rb") }
|
23
23
|
|
@@ -27,7 +27,7 @@ describe Policy::CLI, :sandbox, :capture do
|
|
27
27
|
|
28
28
|
end # examples
|
29
29
|
|
30
|
-
shared_examples "adding locales" do |locales, folder
|
30
|
+
shared_examples "adding locales" do |locales, folder: nil|
|
31
31
|
|
32
32
|
let(:dirname) { File.join("config/locales", folder, "foo") }
|
33
33
|
|
@@ -83,19 +83,20 @@ describe Policy::CLI, :sandbox, :capture do
|
|
83
83
|
|
84
84
|
it "adds namespace to the policy" do
|
85
85
|
content = read_in_sandbox "app/bar/baz/foo.rb"
|
86
|
-
expect(content).to include "module
|
87
|
-
expect(content).to include " module
|
86
|
+
expect(content).to include "module Sandbox"
|
87
|
+
expect(content).to include " module Bar"
|
88
|
+
expect(content).to include " module Baz"
|
88
89
|
end
|
89
90
|
|
90
91
|
it "describes the specification" do
|
91
92
|
content = read_in_sandbox "spec/tests/bar/baz/foo_spec.rb"
|
92
|
-
expect(content).to include "describe Bar::Baz::Foo do"
|
93
|
+
expect(content).to include "describe Sandbox::Bar::Baz::Foo do"
|
93
94
|
end
|
94
95
|
|
95
96
|
it "creates the proper locale" do
|
96
97
|
content = read_in_sandbox "config/locales/bar/baz/foo/en.yml"
|
97
98
|
expect(content).to include "# en:"
|
98
|
-
expect(content).to include " bar/baz/foo:"
|
99
|
+
expect(content).to include " sandbox/bar/baz/foo:"
|
99
100
|
end
|
100
101
|
|
101
102
|
end # context
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: policy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kozin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|