create_component 0.0.2 → 0.0.3

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: f56c89df33814e17d9dce7a3e85f119b2a0a5577
4
- data.tar.gz: e4ad540869ba97bd52250ed52adbcb78c7f28681
3
+ metadata.gz: 15679e02588019cbb86cbf430efc0c907f03236c
4
+ data.tar.gz: 906c148d941162392d7354bdb31f7eabe8c73f32
5
5
  SHA512:
6
- metadata.gz: c638d9f6b3d56e7e4cd57b6c897ae09deaa80186af8fd17f923b50f49b84a2e57bba931db0330e85abb976ee7e033bf72ff1596d323c10d2b2b9387fb2a361fd
7
- data.tar.gz: b35fc02898cc7d7a46413c64c30ece320b227c18d4b8e44b79b4a797e2b0d499b7c3a7964120c1a509f1b581269a06ecb87a80a54cddf87a879a0c08c5a40d4b
6
+ metadata.gz: dc9e6a1dfe3e4afdd5e1375e2bac708b17b8fa75c24ba31983665040fa2724c037afc6ad9567cbb0c5eaf46f3af0eb461a87b54517b8c1c02f5f26ce4f39a176
7
+ data.tar.gz: b7a06c49bc91b9981d363bcffc916db61cb8afbaf9e87c9f412a003ed913635b7741ab67eaa168a9db22d6f7963f69496e513482e7fec68bd3316d2286aef0c6
data/README.md CHANGED
@@ -2,7 +2,7 @@
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.
5
+ Provided that on your project's **root** directory you have a sub-directory `/src` or `/src/components`, this script will create a folder with the name of the component with two files inside.
6
6
 
7
7
  **MyComponent.js**
8
8
  ```
data/bin/component CHANGED
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
-
3
- unless not ARGV.empty?
4
- puts 'No component name was given.'
5
- exit(1)
2
+ unless !ARGV.empty?
3
+ puts 'No component name was given.'
4
+ exit(1)
6
5
  end
7
6
 
8
7
  component = ARGV[0]
@@ -12,12 +11,12 @@ index_js = "index.js"
12
11
  # Changes directory to 'src/components/' or 'src/'
13
12
  root = Dir.pwd
14
13
  unless Dir.exist?("#{root}/src")
15
- puts "Directory src doesn't exist."
16
- exit(1)
14
+ puts "Directory src doesn't exist."
15
+ exit(1)
17
16
  end
18
17
 
19
18
  destination = "/src/components"
20
- if !Dir.exist?("#{root}#{destination}")
19
+ unless Dir.exist?("#{root}#{destination}")
21
20
  destination = "/src"
22
21
  end
23
22
  Dir.chdir("#{root}#{destination}")
@@ -32,17 +31,19 @@ system("touch #{index_js}")
32
31
 
33
32
  # index.js
34
33
  contents = "export { default } from './#{component}';"
35
- open(index_js, 'a') do |f|
36
- f << contents
34
+ open(index_js, 'a') do |file|
35
+ file << contents
36
+ file << "\n"
37
37
  end
38
38
 
39
39
  # Component.js
40
40
  import_react_statement = "import React from 'react';"
41
41
  export_default_statement = "export default;"
42
- open(component_js, 'a') do |f|
43
- f << import_react_statement
44
- f << "\n"
45
- f << export_default_statement
42
+ open(component_js, 'a') do |file|
43
+ file << import_react_statement
44
+ file << "\n"
45
+ file << export_default_statement
46
+ file << "\n"
46
47
  end
47
48
 
48
49
  puts "#{component_js} and #{index_js} created succesfully at #{destination}!"
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["frankkair@gmail.com"]
11
11
 
12
12
  spec.summary = "Simple script to create React components."
13
- spec.description = "Simple script to create React components."
13
+ spec.description = "Script to create React components."
14
14
  spec.homepage = "https://github.com/FrankKair/create-component"
15
15
  spec.license = "MIT"
16
16
 
@@ -1,3 +1,3 @@
1
1
  module CreateComponent
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
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.2
4
+ version: 0.0.3
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-10 00:00:00.000000000 Z
11
+ date: 2017-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: Simple script to create React components.
41
+ description: Script to create React components.
42
42
  email:
43
43
  - frankkair@gmail.com
44
44
  executables: