formify 0.1.0 → 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 +1 -1
 - data/formify.gemspec +0 -12
 - data/lib/formify/version.rb +1 -1
 - data/lib/generators/form/.DS_Store +0 -0
 - data/lib/generators/form/USAGE +8 -0
 - data/lib/generators/form/form_generator.rb +33 -0
 - data/lib/generators/form/templates/form.rb.tt +9 -0
 - data/lib/generators/form/templates/form_spec.rb.tt +12 -0
 - metadata +8 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: af1c67735bac715a5cfa41f75acda000a3d99c2ce720d957254cf83efd4ce040
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7090193f7ad579c1f88f1c86a4dacebeb8ca7eabb6610ef3e0ab542e7514b8e9
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b17d24827e1ed589fdbb4bea7eeca6701a8a0cfa577b8973812c51ac1122b7457578ea4fdfffffd58f1c5cbc327f542e666d470fc7073b2a22b27b00e645048e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c778682708e0b4881b31fa7ddb71ac3633e17d2f45855a14bec4af1fe27a42f1dbd25194c3407affaa051bc3e2fd7777de3d8d93999f40bcd4d5bfdb46869e30
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/formify.gemspec
    CHANGED
    
    | 
         @@ -13,18 +13,6 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       13 
13 
     | 
    
         
             
              spec.homepage      = 'https://www.github.com/ryanwjackson/formify'
         
     | 
| 
       14 
14 
     | 
    
         
             
              spec.license       = 'MIT'
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
              # # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
         
     | 
| 
       17 
     | 
    
         
            -
              # # to allow pushing to a single host or delete this section to allow pushing to any host.
         
     | 
| 
       18 
     | 
    
         
            -
              # if spec.respond_to?(:metadata)
         
     | 
| 
       19 
     | 
    
         
            -
              #   spec.metadata['allowed_push_host'] = 'rubygems.org'
         
     | 
| 
       20 
     | 
    
         
            -
              #   spec.metadata['homepage_uri'] = spec.homepage
         
     | 
| 
       21 
     | 
    
         
            -
              #   spec.metadata['source_code_uri'] = spec.homepage
         
     | 
| 
       22 
     | 
    
         
            -
              #   spec.metadata['changelog_uri'] = 'https://github.com/ryanwjackson/formify/blob/master/CHANGELOG.md'
         
     | 
| 
       23 
     | 
    
         
            -
              # else
         
     | 
| 
       24 
     | 
    
         
            -
              #   raise 'RubyGems 2.0 or newer is required to protect against ' \
         
     | 
| 
       25 
     | 
    
         
            -
              #     'public gem pushes.'
         
     | 
| 
       26 
     | 
    
         
            -
              # end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
16 
     | 
    
         
             
              # Specify which files should be added to the gem when it is released.
         
     | 
| 
       29 
17 
     | 
    
         
             
              # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
         
     | 
| 
       30 
18 
     | 
    
         
             
              spec.files = Dir.chdir(File.expand_path(__dir__)) do
         
     | 
    
        data/lib/formify/version.rb
    CHANGED
    
    
| 
         Binary file 
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rails/generators/named_base'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class FormGenerator < Rails::Generators::NamedBase
         
     | 
| 
      
 4 
     | 
    
         
            +
              source_root File.expand_path('../templates', __FILE__)
         
     | 
| 
      
 5 
     | 
    
         
            +
              # check_class_collision
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              def generate_form
         
     | 
| 
      
 8 
     | 
    
         
            +
                template "form.rb", File.join("app/lib/forms", class_path, "#{file_name}.rb")
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              def generate_form_spec
         
     | 
| 
      
 12 
     | 
    
         
            +
                # template "form_spec.rb", File.join("spec/lib/forms", class_path, "#{file_name}_spec.rb")
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              private
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              def module_namespacing(&block)
         
     | 
| 
      
 18 
     | 
    
         
            +
                content = capture(&block)
         
     | 
| 
      
 19 
     | 
    
         
            +
                modules.each do |mod|
         
     | 
| 
      
 20 
     | 
    
         
            +
                  content = wrap_with_module(content, mod)
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
                concat(content)
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              def modules
         
     | 
| 
      
 26 
     | 
    
         
            +
                @modules ||= ['Forms'] + name.split('/')[0..-2].map(&:to_s).map(&:camelcase)
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              def wrap_with_module(content, mod)
         
     | 
| 
      
 30 
     | 
    
         
            +
                content = indent(content).chomp
         
     | 
| 
      
 31 
     | 
    
         
            +
                "module #{mod}\n#{content}\nend\n"
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: formify
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ryan Jackson
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2019-05- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-05-09 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -91,6 +91,11 @@ files: 
     | 
|
| 
       91 
91 
     | 
    
         
             
            - lib/formify/form.rb
         
     | 
| 
       92 
92 
     | 
    
         
             
            - lib/formify/spec_helpers.rb
         
     | 
| 
       93 
93 
     | 
    
         
             
            - lib/formify/version.rb
         
     | 
| 
      
 94 
     | 
    
         
            +
            - lib/generators/form/.DS_Store
         
     | 
| 
      
 95 
     | 
    
         
            +
            - lib/generators/form/USAGE
         
     | 
| 
      
 96 
     | 
    
         
            +
            - lib/generators/form/form_generator.rb
         
     | 
| 
      
 97 
     | 
    
         
            +
            - lib/generators/form/templates/form.rb.tt
         
     | 
| 
      
 98 
     | 
    
         
            +
            - lib/generators/form/templates/form_spec.rb.tt
         
     | 
| 
       94 
99 
     | 
    
         
             
            homepage: https://www.github.com/ryanwjackson/formify
         
     | 
| 
       95 
100 
     | 
    
         
             
            licenses:
         
     | 
| 
       96 
101 
     | 
    
         
             
            - MIT
         
     | 
| 
         @@ -110,8 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       110 
115 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       111 
116 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       112 
117 
     | 
    
         
             
            requirements: []
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
            rubygems_version: 2.7.6
         
     | 
| 
      
 118 
     | 
    
         
            +
            rubygems_version: 3.0.3
         
     | 
| 
       115 
119 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       116 
120 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       117 
121 
     | 
    
         
             
            summary: Formify gives structure to using form objects in a Rails project.
         
     |