Project

poro-rails

0.01
No commit activity in last 3 years
No release in over 3 years
This gem provides generators of Plain Old Ruby Objects, Form Objects, and Service Objects for Ruby on Rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 10.0
 Project Readme

poro-rails

This gem provides generators of Plain Old Ruby Objects, Form Objects and Service Objects for Ruby on Rails.

Installation

gem 'poro-rails', group: :development

And then execute:

$ bundle

Or install it yourself as:

$ gem install poro-rails

Usage

Plain Old Ruby Objects

Generate a plain old ruby object via command line:

$ rails g poro Person
      create  app/models/person.rb
      invoke  test_unit
      create    test/models/person_test.rb

These files are created (if it use RSpec in your project, it creates a spec file):

# app/models/person.rb
class Person
  # include ActiveModel::Model
end
# test/models/person_test.rb
require 'test_helper'

class PersonTest < ActiveSupport::TestCase
  # test "the truth" do
  #   assert true
  # end
end

Form Objects

Generate a form object via command line:

$ rails g form create_user
      create  app/forms/create_user_form.rb
      invoke  test_unit
      create    test/forms/create_user_form_test.rb

These files are created (if it use RSpec in your project, it creates a spec file):

# app/forms/create_user_form.rb
class CreateUserForm
  # include ActiveModel::Model
end
# test/forms/create_user_form_test.rb
require 'test_helper'

class CreateUserFormTest < ActiveSupport::TestCase
  # test "the truth" do
  #   assert true
  # end
end

Service Objects

Generate a service object via command line:

$ bin/rails g service create_payment
      create  app/services/create_payment_service.rb
      invoke  test_unit
      create    test/services/create_payment_service_test.rb

These files are created (if it use RSpec in your project, it creates a spec file):

# app/services/create_payment_service.rb
class CreatePaymentService
  # include ActiveModel::Model
end
# test/services/create_payment_service_test.rb
require 'test_helper'

class CreatePaymentServiceTest < ActiveSupport::TestCase
  # test "the truth" do
  #   assert true
  # end
end

License

MIT