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 +4 -4
- data/.gitignore +1 -0
- data/README.md +15 -2
- data/bin/component +11 -6
- data/lib/create_component/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f56c89df33814e17d9dce7a3e85f119b2a0a5577
|
4
|
+
data.tar.gz: e4ad540869ba97bd52250ed52adbcb78c7f28681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
24
|
+
In your project's root directory, just call:
|
12
25
|
|
13
|
-
$ component
|
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
|
15
|
-
puts "Directory src
|
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
|
-
|
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
|
48
|
+
puts "#{component_js} and #{index_js} created succesfully at #{destination}!"
|
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.
|
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-
|
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
|