Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sliders

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sliders

  • 0.1.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

🍔 Sliders

Sliders are mini "app-folders" for grouping related code in your Rails application.

Like a slider is not really a burger 🍔 this is not really app folders 😉

Some times you have bundles of code in your app that is related to some specific feature. Extracting to a gem is not really an option as the feature is tightly integrated with the rest of the application. So how do you get a good structure of files in you application?

(Yes, I've been inspired by, or envious at, Hanami and their slices for structuring a Hanami application.)

With sliders you get a namespace folder that groups all you files.

Going from:

app/
├─ controllers/
│  └─ my_feature/
│     ├─ first_controller.rb
│     └─ second_controller.rb
├─ models/
│  └─ my_feature/
│     ├─ record_a.rb
│     └─ record_b.rb
├─ jobs/
│  └─ my_feature/
│     └─ run_in_background_job.rb
└─ interactors/
   └─ my_feature/
      └─ important_feature_task.rb

To:

app/
└─ sliders/
   └─ my_feature/
      ├─ controllers/
      │  ├─ first_controller.rb
      │  └─ second_controller.rb
      ├─ models/
      │  ├─ record_a.rb
      │  └─ record_b.rb
      ├─ jobs/
      │  └─ run_in_background_job.rb
      └─ interactors/
         └─ important_feature_task.rb

Future plan is to group all your sliders tests in a test/sliders/my_feature folder as well.

Installation

Add this line to your application's Gemfile:

gem "sliders"

And then execute:

$ bundle

Usage

Create your slider folder

$ rails g slider my_feature

This creates the app/sliders/ folder and a module and folder for your feature.

Now you can just use regular generators to create thing in MyFeature namespace and sliders will create the files in your slider folder.

Generators that will now create files in slider folder:

  • controllers
  • scaffold
  • helpers
  • mailers
  • jobs
  • active record model

Contributing

Feel free to open PR with fixes for generators for that creates files outside of sliders folder.

Known generators that will not do what you expect:

  • view
    • controller
    • mailer
    • scaffold
  • action cable
  • action mailbox
  • tests
    • controller
    • model
    • scaffold
    • mailer
    • job
    • integration
    • helper
    • system?
  • fixtures (part of model tests)
  • components?

Other things we need to fix:

  • loading fixtures from slider fixture foldeer

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 03 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc