redux_gen 0.2.0 → 0.2.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: 254c8606222f75ce4b34a4c97f4d9a1604478ce6
4
- data.tar.gz: 3c041557d88664e7c9d9cc6ac944c9e13bbf290d
3
+ metadata.gz: 712045449b8613b4ae9236640a5ad2b04f871aec
4
+ data.tar.gz: d6884d1933f6833213386cfb48be46c27f26e26b
5
5
  SHA512:
6
- metadata.gz: 2f7f212484c57db9118570be4292f4aee610efe064bb8263bc41dc4a5a78ad6dc3e662ff12e24b60e294c36e4e736a7b3442f0c047659cff15da172c2a3eab9b
7
- data.tar.gz: b1db935663fed3db092abcce6526ad052b214078c67b964445fa57e8afca8d3a71f0c8c87e77d3a78ed779510b870fce0c48efbbb0a75a996fa6e785b7e90c7d
6
+ metadata.gz: 0da03aae73c0d8597f5e18cdf4c6af2d4928db5aa4d46851d625026406a602202a174bca89b0ec7cf216c9369e24cae5fe0068aa35c749afd6c5355f910f87a6
7
+ data.tar.gz: 89796feb12cef351fe4137ad56676d19e2d70aed06f5b20ebecb326f379018fdadda54579d9ab3622694716a78d6accd3f73dc711c5b1ff73b7cf1544a535807
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- redux_gen (0.2.0)
4
+ redux_gen (0.2.1)
5
5
  thor (~> 0.20.0)
6
6
 
7
7
  GEM
@@ -4,7 +4,7 @@ module ReduxGen
4
4
 
5
5
  def initialize(component, name)
6
6
  @renderer = Template.renderer_for component
7
- @name = name
7
+ @name = Validations.sanitize component, name
8
8
  end
9
9
 
10
10
  def render
@@ -14,7 +14,13 @@ module ReduxGen
14
14
  end
15
15
 
16
16
  def self.component_path(component, name)
17
- "#{directory(component)}/#{name}.js"
17
+ "#{directory(component)}/#{sanitize(component, name)}.js"
18
+ end
19
+
20
+ def self.sanitize component, name
21
+ first = name.split.first
22
+ rest = name.split[1..-1].map(&:capitalize).join
23
+ (component == "component" ? first.capitalize : first) + rest
18
24
  end
19
25
  end
20
26
  end
@@ -1,3 +1,3 @@
1
1
  module ReduxGen
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/redux_gen.rb CHANGED
@@ -10,9 +10,11 @@ module ReduxGen
10
10
  def new(component, name)
11
11
  Validations.validate component
12
12
  Validations.validate_directory_for component
13
- path = Validations.component_path(component, name)
13
+ path = Validations.component_path component, name
14
14
  template = Template.new(component, name).render
15
- open(path, 'w').write(template)
15
+ open(path, 'w') do |output|
16
+ output.write template
17
+ end
16
18
  end
17
19
  end
18
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redux_gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esteban Hernandez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-11 00:00:00.000000000 Z
11
+ date: 2017-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler