create_component 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4415812646282c3e5fb560092b22194c4b22d7ff
4
- data.tar.gz: ce0a0335bf6dce0bafdf6b66bd311ba7000fb1ac
3
+ metadata.gz: f56c89df33814e17d9dce7a3e85f119b2a0a5577
4
+ data.tar.gz: e4ad540869ba97bd52250ed52adbcb78c7f28681
5
5
  SHA512:
6
- metadata.gz: da4d1d5315b0f3d1dc3d701309a091c62af623096fda92261234ec2abf1c42800347c42bf9e5b4d98dc52969a5843325a90bb156ffcd6200d653cda2a85997e0
7
- data.tar.gz: aefbf45f8957c08037dab4d7b63b49c09b29bdc86edf59237cb41689aeb73fa89534496bf1ed6ba0bd4eb6d5effcc71026bd26bf552dd93f916661fbaa981333
6
+ metadata.gz: c638d9f6b3d56e7e4cd57b6c897ae09deaa80186af8fd17f923b50f49b84a2e57bba931db0330e85abb976ee7e033bf72ff1596d323c10d2b2b9387fb2a361fd
7
+ data.tar.gz: b35fc02898cc7d7a46413c64c30ece320b227c18d4b8e44b79b4a797e2b0d499b7c3a7964120c1a509f1b581269a06ecb87a80a54cddf87a879a0c08c5a40d4b
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg/
data/README.md CHANGED
@@ -2,14 +2,27 @@
2
2
 
3
3
  Simple script to avoid creating folders and typing React component boilerplate code.
4
4
 
5
+ Provided that on your project's root directory you have a sub-directory `/src/components`, this script will create a folder with the name of the component with two files inside.
6
+
7
+ **MyComponent.js**
8
+ ```
9
+ import React from 'react';
10
+ export default;
11
+ ```
12
+
13
+ **index.js**
14
+ ```
15
+ export { default } from './MyComponent';
16
+ ```
17
+
5
18
  ## Installation
6
19
 
7
20
  $ gem install create_component
8
21
 
9
22
  ## Usage
10
23
 
11
- Granted that you're in your project's root directory and you have a sub-directory `/src/components`, just call:
24
+ In your project's root directory, just call:
12
25
 
13
- $ component reactComponentName
26
+ $ component MyComponent
14
27
 
15
28
  and _voilà_!
data/bin/component CHANGED
@@ -9,15 +9,20 @@ component = ARGV[0]
9
9
  component_js = "#{component}.js"
10
10
  index_js = "index.js"
11
11
 
12
- # Changes directory to src/components
12
+ # Changes directory to 'src/components/' or 'src/'
13
13
  root = Dir.pwd
14
- unless Dir.exist?("#{root}/src/components")
15
- puts "Directory src/components doesn't exist."
14
+ unless Dir.exist?("#{root}/src")
15
+ puts "Directory src doesn't exist."
16
16
  exit(1)
17
17
  end
18
- Dir.chdir("#{root}/src/components")
19
18
 
20
- # Creates directory
19
+ destination = "/src/components"
20
+ if !Dir.exist?("#{root}#{destination}")
21
+ destination = "/src"
22
+ end
23
+ Dir.chdir("#{root}#{destination}")
24
+
25
+ # Creates director
21
26
  Dir.mkdir(component)
22
27
  Dir.chdir(component)
23
28
 
@@ -40,4 +45,4 @@ open(component_js, 'a') do |f|
40
45
  f << export_default_statement
41
46
  end
42
47
 
43
- puts "#{component_js} and #{index_js} created succesfully at /src/components!"
48
+ puts "#{component_js} and #{index_js} created succesfully at #{destination}!"
@@ -1,3 +1,3 @@
1
1
  module CreateComponent
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: create_component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Kair
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-08 00:00:00.000000000 Z
11
+ date: 2017-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -46,6 +46,7 @@ executables:
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
+ - ".gitignore"
49
50
  - Gemfile
50
51
  - Gemfile.lock
51
52
  - LICENSE.txt