create_component 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4415812646282c3e5fb560092b22194c4b22d7ff
4
+ data.tar.gz: ce0a0335bf6dce0bafdf6b66bd311ba7000fb1ac
5
+ SHA512:
6
+ metadata.gz: da4d1d5315b0f3d1dc3d701309a091c62af623096fda92261234ec2abf1c42800347c42bf9e5b4d98dc52969a5843325a90bb156ffcd6200d653cda2a85997e0
7
+ data.tar.gz: aefbf45f8957c08037dab4d7b63b49c09b29bdc86edf59237cb41689aeb73fa89534496bf1ed6ba0bd4eb6d5effcc71026bd26bf552dd93f916661fbaa981333
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in create_component.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ create_component (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (10.4.2)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ bundler (~> 1.14)
16
+ create_component!
17
+ rake (~> 10.0)
18
+
19
+ BUNDLED WITH
20
+ 1.14.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Frank Kair
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # CreateComponent
2
+
3
+ Simple script to avoid creating folders and typing React component boilerplate code.
4
+
5
+ ## Installation
6
+
7
+ $ gem install create_component
8
+
9
+ ## Usage
10
+
11
+ Granted that you're in your project's root directory and you have a sub-directory `/src/components`, just call:
12
+
13
+ $ component reactComponentName
14
+
15
+ and _voilà_!
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/component ADDED
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ unless not ARGV.empty?
4
+ puts 'No component name was given.'
5
+ exit(1)
6
+ end
7
+
8
+ component = ARGV[0]
9
+ component_js = "#{component}.js"
10
+ index_js = "index.js"
11
+
12
+ # Changes directory to src/components
13
+ root = Dir.pwd
14
+ unless Dir.exist?("#{root}/src/components")
15
+ puts "Directory src/components doesn't exist."
16
+ exit(1)
17
+ end
18
+ Dir.chdir("#{root}/src/components")
19
+
20
+ # Creates directory
21
+ Dir.mkdir(component)
22
+ Dir.chdir(component)
23
+
24
+ # Creates files
25
+ system("touch #{component_js}")
26
+ system("touch #{index_js}")
27
+
28
+ # index.js
29
+ contents = "export { default } from './#{component}';"
30
+ open(index_js, 'a') do |f|
31
+ f << contents
32
+ end
33
+
34
+ # Component.js
35
+ import_react_statement = "import React from 'react';"
36
+ export_default_statement = "export default;"
37
+ open(component_js, 'a') do |f|
38
+ f << import_react_statement
39
+ f << "\n"
40
+ f << export_default_statement
41
+ end
42
+
43
+ puts "#{component_js} and #{index_js} created succesfully at /src/components!"
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'create_component/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "create_component"
8
+ spec.version = CreateComponent::VERSION
9
+ spec.authors = ["Frank Kair"]
10
+ spec.email = ["frankkair@gmail.com"]
11
+
12
+ spec.summary = "Simple script to create React components."
13
+ spec.description = "Simple script to create React components."
14
+ spec.homepage = "https://github.com/FrankKair/create-component"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f =~ /docs\// }
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.14"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1 @@
1
+ require "create_component/version"
@@ -0,0 +1,3 @@
1
+ module CreateComponent
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: create_component
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Frank Kair
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-08-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Simple script to create React components.
42
+ email:
43
+ - frankkair@gmail.com
44
+ executables:
45
+ - component
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bin/component
55
+ - create_component.gemspec
56
+ - lib/create_component.rb
57
+ - lib/create_component/version.rb
58
+ homepage: https://github.com/FrankKair/create-component
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.4.5.1
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Simple script to create React components.
82
+ test_files: []