cpb-generators 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/readme.feature +9 -1
- data/lib/cpb/generators/class_generator.rb +2 -4
- data/lib/cpb/generators/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cee2db2244f9939350efa9450b8f91c1608253d
|
4
|
+
data.tar.gz: 692db79c10b103d3c2f6b19f8d1dd21f218b23b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ee2d1f19621704bd1367a3a7527308360e686a73b3270a2b96df25eea56cc7f96997e3b35c42b25db1105d23c7fa6e0af2cc468e1bfc1b2651939e8ac03cdb8
|
7
|
+
data.tar.gz: 178a920917eed2ca89a0ceec0449aa62ec39cf51191c3c5081f8e61eb11a1c90eb01ee312f7147a30c3a563f2de80baab28e4c88ed7882f4833b4d31d53b3d59
|
data/features/readme.feature
CHANGED
@@ -10,7 +10,15 @@ Feature: I can install cpb-generators and generate files
|
|
10
10
|
"""
|
11
11
|
And I run `bundle install`
|
12
12
|
When I run `bundle exec cpb entity many/namespace/new_name`
|
13
|
-
Then
|
13
|
+
Then the file "lib/many/namespace/new_name.rb" should contain:
|
14
|
+
"""
|
15
|
+
module Many
|
16
|
+
module Namespace
|
17
|
+
class NewName
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
"""
|
14
22
|
And a file named "spec/many/namespace/new_name_spec.rb" should exist
|
15
23
|
|
16
24
|
Scenario: Usage post installation
|
@@ -46,10 +46,8 @@ module Cpb
|
|
46
46
|
|
47
47
|
unless parts.empty?
|
48
48
|
i = parts.length
|
49
|
-
parts.inject(constant_string(i
|
50
|
-
|
51
|
-
i -= 1
|
52
|
-
return_value
|
49
|
+
parts.inject(constant_string(i,"class",first_part)) do |memo, namespace|
|
50
|
+
constant_string(i-=1,"module",namespace,memo)
|
53
51
|
end
|
54
52
|
else
|
55
53
|
"class #{first_part}\nend"
|