formify 0.1.0 → 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
  SHA256:
3
- metadata.gz: e6986f5a092a5b5c13abbd8daeff88ea4571d69b647db4684843ef1107704434
4
- data.tar.gz: 401a723a94bd78ef45c677f1b32435b037ce76785f37cfad18ddb731c1d086f7
3
+ metadata.gz: af1c67735bac715a5cfa41f75acda000a3d99c2ce720d957254cf83efd4ce040
4
+ data.tar.gz: 7090193f7ad579c1f88f1c86a4dacebeb8ca7eabb6610ef3e0ab542e7514b8e9
5
5
  SHA512:
6
- metadata.gz: dae0ce0a184c7793fa3880b14a956ea9a4c4fcde301d251a6ef7e5220d9939a076480537eb20150cd6df100f958cb8971a51c3f2dd91234aaec0781f1e2acc5d
7
- data.tar.gz: 5cafd37279bedd6aa9ae96e37e286de0be761b1c5f2a65e798e00ff1ad1aac173e41616a64033a3ad0b2f334278692e04be4fa3f10a1db7e2bb46069288edb36
6
+ metadata.gz: b17d24827e1ed589fdbb4bea7eeca6701a8a0cfa577b8973812c51ac1122b7457578ea4fdfffffd58f1c5cbc327f542e666d470fc7073b2a22b27b00e645048e
7
+ data.tar.gz: c778682708e0b4881b31fa7ddb71ac3633e17d2f45855a14bec4af1fe27a42f1dbd25194c3407affaa051bc3e2fd7777de3d8d93999f40bcd4d5bfdb46869e30
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- formify (0.1.0)
4
+ formify (0.1.1)
5
5
  resonad
6
6
 
7
7
  GEM
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
@@ -1,3 +1,3 @@
1
1
  module Formify
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
Binary file
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate form Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -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
@@ -0,0 +1,9 @@
1
+ <% module_namespacing do -%>
2
+ class <%= name.split('/').last %>
3
+ include Formify::Form
4
+
5
+ def save
6
+ raise NotImplementedError
7
+ end
8
+ end
9
+ <% end -%>
@@ -0,0 +1,12 @@
1
+ require 'rails_helper'
2
+ require 'formify/spec_helpers'
3
+
4
+ describe Forms::<%= class_name %> do
5
+ include Formify::SpecHelpers
6
+
7
+ let(:attributes) do
8
+ {
9
+
10
+ }
11
+ end
12
+ 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.0
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-08 00:00:00.000000000 Z
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
- rubyforge_project:
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.