cpb-generators 0.1.0 → 0.1.1

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
2
  SHA1:
3
- metadata.gz: 9ba26f6029d31aca25618826901c9ab020f141db
4
- data.tar.gz: 6f2f126251b3228bdbbe72cc4ef5b357a367c1cd
3
+ metadata.gz: 6434d531210bbe68b924f68261e48c0240d7496d
4
+ data.tar.gz: cc4a5914f47d335adfd0806c9189404baa955fbe
5
5
  SHA512:
6
- metadata.gz: ff877cbe9d783993329f140474893bfc00d99a2d0069109da0bd8f845a40e7161d384c58d01cc349ff8eabda3c7f6852887962bde507efeba86c0ed257da0348
7
- data.tar.gz: 21607da2b95383f369e1fc4990f8cc4e8e6e53ff9dcbe3e95d80c2a490184b2b2dd380d3de19732622854acc326bcd4012aed6faea766354f2035d52048f49f1
6
+ metadata.gz: 65bb66ea286ff2406faf18b0b9f8c585728ba09207084b27513f9cf328fd0a35e13e313b0f2afae14064f136a0a9486fe5570c92b5555412aeedc7d78caedc3d
7
+ data.tar.gz: 3e4eb1393727e71607953604c2e0e1440b5b9c3263e73455e718e9323b3136f5709f735c403da43a2c7930e83fc5c3eef544f9a0568e3174e52ce914ebb9c2cf
@@ -9,9 +9,9 @@ Feature: I can install cpb-generators and generate files
9
9
  end
10
10
  """
11
11
  And I run `bundle install`
12
- When I run `bundle exec cpb entity namespace/new_name`
13
- Then a file named "lib/namespace/new_name.rb" should exist
14
- And a file named "spec/namespace/new_name_spec.rb" should exist
12
+ When I run `bundle exec cpb entity many/namespace/new_name`
13
+ Then a file named "lib/many/namespace/new_name.rb" should exist
14
+ And a file named "spec/many/namespace/new_name_spec.rb" should exist
15
15
 
16
16
  Scenario: Usage post installation
17
17
  Given a Gemfile setup with:
@@ -20,6 +20,7 @@ Feature: I can install cpb-generators and generate files
20
20
  gem 'cpb-generators', path: '../..'
21
21
  end
22
22
  """
23
- And I run `bundle exec cpb entity namespace/class_name`
23
+ And I run `bundle exec cpb entity many/namespace/class_name`
24
24
  When I run `bundle exec rspec`
25
25
  Then the output should contain "pending"
26
+ Then the output should contain "Many::Namespace::ClassName"
@@ -42,10 +42,9 @@ module Cpb
42
42
  end
43
43
 
44
44
  def verbose_namespace_definition(name)
45
- first_part, parts = described_class(name).split("::").reverse
45
+ first_part, *parts = described_class(name).split("::").reverse
46
46
 
47
- if parts
48
- parts = Array(parts)
47
+ unless parts.empty?
49
48
  i = parts.length
50
49
  parts.inject(lambda { "#{tabs(parts.length)}class #{first_part}\n#{tabs(parts.length)}end\n" }) do |memo, namespace|
51
50
  lambda do
@@ -1,5 +1,5 @@
1
1
  module Cpb
2
2
  module Generators
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -14,6 +14,18 @@ describe Cpb::Generators::ClassGenerator do
14
14
  capture(:stdout) { gen.invoke_all }
15
15
  end
16
16
 
17
+ describe 'deep namespacing' do
18
+ before do
19
+ run_generator %w(many/namespaces/here)
20
+ end
21
+
22
+ describe 'the spec' do
23
+ subject { file('lib/many/namespaces/here.rb') }
24
+
25
+ it { should contain(/module Many/) }
26
+ end
27
+ end
28
+
17
29
  describe 'the generated files' do
18
30
  before do
19
31
  run_generator %w(posts)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpb-generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Buxton