oneshot_task_generator 0.0.1 → 0.1.0
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/README.md +1 -1
- data/lib/generators/oneshot/oneshot_generator.rb +6 -1
- data/lib/generators/oneshot/oneshot_generator/configuration.rb +10 -0
- data/lib/generators/oneshot/oneshot_generator/configurator.rb +19 -0
- data/lib/generators/oneshot/templates/oneshot.rake.erb +5 -0
- data/lib/oneshot_task_generator.rb +1 -0
- data/lib/oneshot_task_generator/version.rb +1 -1
- metadata +4 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: acbff35d1496ac10162cbd82c93167bab47f07b3
         | 
| 4 | 
            +
              data.tar.gz: 4fc4c0346f8a4a84b325ef193eb0dd5790ea62e5
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b943d81ac188cfd3c66036f6c403a042c3773864768aedcfccd5a3aab7fa9ac7ef381dfe47335dedeae31d10d9b584394af866e751eee0ebabbbd6511f2109b2
         | 
| 7 | 
            +
              data.tar.gz: a79c5ad7f9349af14a3456eba9bc69d6cafb51d28138767d774f6c8c7d073fd4e4a12757028fcd45d6a8b4b128b8fc4dc16ef0686a2c71a513c20531290861ec
         | 
    
        data/README.md
    CHANGED
    
    
| @@ -1,12 +1,17 @@ | |
| 1 | 
            +
            require 'generators/oneshot/oneshot_generator/configurator'
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            class OneshotGenerator < Rails::Generators::NamedBase
         | 
| 4 | 
            +
              extend Configurator
         | 
| 5 | 
            +
             | 
| 2 6 | 
             
              source_root File.expand_path('../templates', __FILE__)
         | 
| 3 7 |  | 
| 4 | 
            -
              attr_reader :current, :timestamp, :task_name
         | 
| 8 | 
            +
              attr_reader :current, :timestamp, :task_name, :configuration
         | 
| 5 9 |  | 
| 6 10 | 
             
              def setup
         | 
| 7 11 | 
             
                @current   = Time.current
         | 
| 8 12 | 
             
                @timestamp = @current.strftime('%Y%m%d')
         | 
| 9 13 | 
             
                @task_name = "#{name.underscore}_#{timestamp}"
         | 
| 14 | 
            +
                @configuration = self.class.configuration
         | 
| 10 15 | 
             
              end
         | 
| 11 16 |  | 
| 12 17 | 
             
              def create_file_with_template
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            require 'generators/oneshot/oneshot_generator/configuration'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class OneshotGenerator < Rails::Generators::NamedBase
         | 
| 4 | 
            +
              module Configurator
         | 
| 5 | 
            +
                def configure
         | 
| 6 | 
            +
                  yield(configuration)
         | 
| 7 | 
            +
                end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                def configuration
         | 
| 10 | 
            +
                  @configuration ||= Configuration.new
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
                alias :config :configuration
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                def configuration=(config)
         | 
| 15 | 
            +
                  @configuration = config
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
                alias :config= :configuration=
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: oneshot_task_generator
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0 | 
| 4 | 
            +
              version: 0.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - OSA Shunsuke
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018-02- | 
| 11 | 
            +
            date: 2018-02-08 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         | 
| @@ -110,6 +110,8 @@ files: | |
| 110 110 | 
             
            - Rakefile
         | 
| 111 111 | 
             
            - lib/generators/oneshot/USAGE
         | 
| 112 112 | 
             
            - lib/generators/oneshot/oneshot_generator.rb
         | 
| 113 | 
            +
            - lib/generators/oneshot/oneshot_generator/configuration.rb
         | 
| 114 | 
            +
            - lib/generators/oneshot/oneshot_generator/configurator.rb
         | 
| 113 115 | 
             
            - lib/generators/oneshot/templates/oneshot.rake.erb
         | 
| 114 116 | 
             
            - lib/oneshot_task_generator.rb
         | 
| 115 117 | 
             
            - lib/oneshot_task_generator/version.rb
         |