hyperactiveform 0.2.0 → 0.3.0

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: 2bf224bb05aa53c3ffa3909697c1de9aec078b5b2b93bb714c986406ec09c96a
4
- data.tar.gz: cd9237240accc63066e2cbb43f52db7f43ba4f767d11dfbd648621988e5ca747
3
+ metadata.gz: c05e1cc748050b5a735f9f2fc3944427e5a3618b8083fa8ab9e3667a8d9f5f9a
4
+ data.tar.gz: e990037c9b3fcbcb5f2e68790c486f1a11bc541bb2680d2a312fa9a8336ca5e4
5
5
  SHA512:
6
- metadata.gz: 6b6c8634a4f830470618386a8e3b1b3dc0ef6b73808d5d74bdd45dd2f0a12f43983ae6a3cc5e0119cff0655a24f5e9902e674d3f78a01a182b743914e267b0f0
7
- data.tar.gz: 78c2b176fdefc0c208ae01e5e884c5a324cd056a0f51177ebb27ca8be78dd93434bca7558814ab28bd79964a16dac9427119c2a422f60e6b117d49420b27142a
6
+ metadata.gz: 56384a8814889a64eb844f60c9eb5eb22335d0143d83a2e2f9dcf662090ce44d9d794bdc632a4a2d672ed07c510718d63bed04e597ec657ca40ac1ec5be66fa4
7
+ data.tar.gz: 9cf4cb7e27b70e97687f19f5f860df6529e925d741c7f42d87c0c28b05a953bffcfeddbc2c72ef172b25af3ab79bc43d641d01d9718bfbbd1bba79a1b902a0b6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2024-12-22
4
+ - Add generators (`rails generate form foo`) ([#2](https://github.com/Intrepidd/hyperactiveform/pull/2) by [@tchiadeu](https://github.com/tchiadeu))
5
+
3
6
  ## [0.2.0] - 2024-12-14
4
7
  - Add callbacks for `assign_form_attributes` and `submit`
5
8
  - Change behavior of `assign_form_attributes`/`submit` to use the default value or nil if no value is provided, rather than keeping the value from `setup`
data/README.md CHANGED
@@ -26,6 +26,16 @@ Run the install generator:
26
26
 
27
27
  this will create an `ApplicationForm` class in your app/forms directory. You can use it as a base class for your form objects.
28
28
 
29
+ ## Generators
30
+
31
+ You can [generate](https://guides.rubyonrails.org/configuring.html#configuring-generators) a form and its tests with the following command:
32
+
33
+ ```
34
+ $ rails generate form FooBar
35
+ ```
36
+
37
+ This will create the `FooBarForm`
38
+
29
39
  ## Usage
30
40
 
31
41
  Here is an example of an `HyperActiveForm` form object:
@@ -0,0 +1,9 @@
1
+ class FormGenerator < Rails::Generators::NamedBase
2
+ source_root File.expand_path("templates", __dir__)
3
+
4
+ def create_application_form
5
+ template 'form.rb', File.join('app/forms', class_path, "#{file_name}_form.rb")
6
+ end
7
+
8
+ hook_for :test_framework
9
+ end
@@ -0,0 +1,2 @@
1
+ class <%= class_name %>Form < ApplicationForm
2
+ end
@@ -1,5 +1,3 @@
1
- require "rails/generators"
2
-
3
1
  module HyperActiveForm
4
2
  module Generators
5
3
  class InstallGenerator < Rails::Generators::Base
@@ -0,0 +1,11 @@
1
+ module Rspec
2
+ module Generators
3
+ class FormGenerator < ::Rails::Generators::NamedBase
4
+ source_root File.expand_path("templates", __dir__)
5
+
6
+ def create_form_spec
7
+ template "form_spec.rb", File.join("spec/forms", class_path, "#{file_name}_form_spec.rb")
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ require '<%= File.exist?('spec/rails_helper.rb') ? 'rails_helper' : 'spec_helper' %>'
2
+
3
+ RSpec.describe <%= class_name %>Form, type: :form do
4
+ pending "add some examples to (or delete) #{__FILE__}"
5
+ end
@@ -0,0 +1,11 @@
1
+ module TestUnit
2
+ module Generators
3
+ class FormGenerator < ::Rails::Generators::NamedBase
4
+ source_root File.expand_path("templates", __dir__)
5
+
6
+ def create_form_test
7
+ template "form_test.rb", File.join("test/forms", class_path, "#{file_name}_form_test.rb")
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class <%= class_name %>FormTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HyperActiveForm
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -7,4 +7,3 @@ end
7
7
 
8
8
  require_relative "hyper_active_form/version"
9
9
  require_relative "hyper_active_form/base"
10
- require_relative "hyper_active_form/generators"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyperactiveform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Siami
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-14 00:00:00.000000000 Z
11
+ date: 2024-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -88,9 +88,15 @@ files:
88
88
  - gemfiles/Gemfile.rails-7.1.x
89
89
  - gemfiles/Gemfile.rails-7.2.x
90
90
  - gemfiles/Gemfile.rails-8.x
91
+ - lib/generators/form/form_generator.rb
92
+ - lib/generators/form/templates/form.rb
93
+ - lib/generators/hyper_active_form/install/install_generator.rb
94
+ - lib/generators/rspec/form_generator.rb
95
+ - lib/generators/rspec/templates/form_spec.rb
96
+ - lib/generators/test_unit/form_generator.rb
97
+ - lib/generators/test_unit/templates/form_test.rb
91
98
  - lib/hyper_active_form.rb
92
99
  - lib/hyper_active_form/base.rb
93
- - lib/hyper_active_form/generators.rb
94
100
  - lib/hyper_active_form/version.rb
95
101
  - lib/hyperactiveform.rb
96
102
  - sig/hyperactiveform.rbs