create_component 0.0.3 → 0.1.1

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: 15679e02588019cbb86cbf430efc0c907f03236c
4
- data.tar.gz: 906c148d941162392d7354bdb31f7eabe8c73f32
3
+ metadata.gz: a1d634f7d8b07e19f53374da3c28817d32652626
4
+ data.tar.gz: a3b59569b1387fba17dc7df92242a18effefecc5
5
5
  SHA512:
6
- metadata.gz: dc9e6a1dfe3e4afdd5e1375e2bac708b17b8fa75c24ba31983665040fa2724c037afc6ad9567cbb0c5eaf46f3af0eb461a87b54517b8c1c02f5f26ce4f39a176
7
- data.tar.gz: b7a06c49bc91b9981d363bcffc916db61cb8afbaf9e87c9f412a003ed913635b7741ab67eaa168a9db22d6f7963f69496e513482e7fec68bd3316d2286aef0c6
6
+ metadata.gz: ec5d04a1859e267e6d06b9dd23cb4a38e30a97f188be282df630d4fe5cf4de16327f1b4f38d21d435f0c98bb0da545efef62cbf3e2334dcd75bb44ea55c1215e
7
+ data.tar.gz: d1afe79ddf334476787560df6bb991c43b15176939055d9644509e3eff0d2642c2d65716aa9da325b0f91ccbdd1faef55ec5b3b42fe7852ebec389d3cb00d46f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- create_component (0.0.1)
4
+ create_component (0.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -17,4 +17,4 @@ DEPENDENCIES
17
17
  rake (~> 10.0)
18
18
 
19
19
  BUNDLED WITH
20
- 1.14.6
20
+ 1.15.3
data/README.md CHANGED
@@ -26,3 +26,5 @@ In your project's root directory, just call:
26
26
  $ component MyComponent
27
27
 
28
28
  and _voilà_!
29
+
30
+ (You can also use a `--story` flag to create a **MyComponent.storybook.js** file if you're using [Storybook](https://github.com/storybooks/storybook))
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
- require "bundler/gem_tasks"
2
- task :default => :spec
1
+ require 'bundler/gem_tasks'
2
+ task default: :spec
data/bin/component CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
- unless !ARGV.empty?
2
+ if ARGV.empty?
3
3
  puts 'No component name was given.'
4
4
  exit(1)
5
5
  end
6
6
 
7
7
  component = ARGV[0]
8
8
  component_js = "#{component}.js"
9
- index_js = "index.js"
9
+ index_js = 'index.js'
10
10
 
11
11
  # Changes directory to 'src/components/' or 'src/'
12
12
  root = Dir.pwd
@@ -15,10 +15,8 @@ unless Dir.exist?("#{root}/src")
15
15
  exit(1)
16
16
  end
17
17
 
18
- destination = "/src/components"
19
- unless Dir.exist?("#{root}#{destination}")
20
- destination = "/src"
21
- end
18
+ destination = '/src/components'
19
+ destination = '/src' unless Dir.exist?("#{root}#{destination}")
22
20
  Dir.chdir("#{root}#{destination}")
23
21
 
24
22
  # Creates director
@@ -38,12 +36,20 @@ end
38
36
 
39
37
  # Component.js
40
38
  import_react_statement = "import React from 'react';"
41
- export_default_statement = "export default;"
39
+ export_default_statement = 'export default;'
42
40
  open(component_js, 'a') do |file|
43
41
  file << import_react_statement
44
42
  file << "\n"
45
43
  file << export_default_statement
46
44
  file << "\n"
47
45
  end
48
-
49
46
  puts "#{component_js} and #{index_js} created succesfully at #{destination}!"
47
+
48
+ # Component.story.js
49
+ story_destination = "#{root}/stories"
50
+ if ARGV[1] == '--story'
51
+ Dir.chdir(story_destination)
52
+ story_js = "#{component}.story.js"
53
+ system("touch #{story_js}")
54
+ puts "#{story_js} was created at #{story_destination}!"
55
+ end
@@ -1,23 +1,23 @@
1
- # coding: utf-8
1
+
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'create_component/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "create_component"
7
+ spec.name = 'create_component'
8
8
  spec.version = CreateComponent::VERSION
9
- spec.authors = ["Frank Kair"]
10
- spec.email = ["frankkair@gmail.com"]
9
+ spec.authors = ['Frank Kair']
10
+ spec.email = ['frankkair@gmail.com']
11
11
 
12
- spec.summary = "Simple script to create React components."
13
- spec.description = "Script to create React components."
14
- spec.homepage = "https://github.com/FrankKair/create-component"
15
- spec.license = "MIT"
12
+ spec.summary = 'Simple script to create React components.'
13
+ spec.description = 'Script to create React components.'
14
+ spec.homepage = 'https://github.com/FrankKair/create-component'
15
+ spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f =~ /docs\// }
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.14"
22
- spec.add_development_dependency "rake", "~> 10.0"
21
+ spec.add_development_dependency 'bundler', '~> 1.14'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
23
  end
@@ -1 +1 @@
1
- require "create_component/version"
1
+ require 'create_component/version'
@@ -1,3 +1,3 @@
1
1
  module CreateComponent
2
- VERSION = "0.0.3"
2
+ VERSION = '0.1.1'.freeze
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.3
4
+ version: 0.1.1
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-23 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler