create_component 0.0.3 → 0.1.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 +4 -4
 - data/Gemfile.lock +2 -2
 - data/README.md +2 -0
 - data/Rakefile +2 -2
 - data/bin/component +14 -8
 - data/create_component.gemspec +11 -11
 - data/lib/create_component.rb +1 -1
 - data/lib/create_component/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a1d634f7d8b07e19f53374da3c28817d32652626
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a3b59569b1387fba17dc7df92242a18effefecc5
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ec5d04a1859e267e6d06b9dd23cb4a38e30a97f188be282df630d4fe5cf4de16327f1b4f38d21d435f0c98bb0da545efef62cbf3e2334dcd75bb44ea55c1215e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d1afe79ddf334476787560df6bb991c43b15176939055d9644509e3eff0d2642c2d65716aa9da325b0f91ccbdd1faef55ec5b3b42fe7852ebec389d3cb00d46f
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -1,2 +1,2 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require  
     | 
| 
       2 
     | 
    
         
            -
            task : 
     | 
| 
      
 1 
     | 
    
         
            +
            require 'bundler/gem_tasks'
         
     | 
| 
      
 2 
     | 
    
         
            +
            task default: :spec
         
     | 
    
        data/bin/component
    CHANGED
    
    | 
         @@ -1,12 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #!/usr/bin/env ruby
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 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 =  
     | 
| 
      
 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 =  
     | 
| 
       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 =  
     | 
| 
      
 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
         
     | 
    
        data/create_component.gemspec
    CHANGED
    
    | 
         @@ -1,23 +1,23 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 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          =  
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = 'create_component'
         
     | 
| 
       8 
8 
     | 
    
         
             
              spec.version       = CreateComponent::VERSION
         
     | 
| 
       9 
     | 
    
         
            -
              spec.authors       = [ 
     | 
| 
       10 
     | 
    
         
            -
              spec.email         = [ 
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ['Frank Kair']
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ['frankkair@gmail.com']
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
              spec.summary       =  
     | 
| 
       13 
     | 
    
         
            -
              spec.description   =  
     | 
| 
       14 
     | 
    
         
            -
              spec.homepage      =  
     | 
| 
       15 
     | 
    
         
            -
              spec.license       =  
     | 
| 
      
 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 = [ 
     | 
| 
      
 19 
     | 
    
         
            +
              spec.require_paths = ['lib']
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
              spec.add_development_dependency  
     | 
| 
       22 
     | 
    
         
            -
              spec.add_development_dependency  
     | 
| 
      
 21 
     | 
    
         
            +
              spec.add_development_dependency 'bundler', '~> 1.14'
         
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_development_dependency 'rake', '~> 10.0'
         
     | 
| 
       23 
23 
     | 
    
         
             
            end
         
     | 
    
        data/lib/create_component.rb
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require  
     | 
| 
      
 1 
     | 
    
         
            +
            require 'create_component/version'
         
     | 
    
        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. 
     | 
| 
      
 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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-10-26 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |