Bacancy Technology
Bacancy Technology represents the connected world, offering innovative and customer-centric information technology experiences, enabling Enterprises, Associates and the Society to Rise™.
12+
Countries where we have happy customers
1050+
Agile enabled employees
06
World wide offices
12+
Years of Experience
05
Agile Coaches
14
Certified Scrum Masters
1000+
Clients projects
1458
Happy customers
Artificial Intelligence
Machine Learning
Salesforce
Microsoft
SAP
March 28, 2024
This Ruby script automates several tasks related to managing dependencies and converting ERB templates to Slim templates within a Rails application.
Firstly, it defines a method do_bundle which ensures that dependencies are installed using Bundler.with_unbundled_env before executing bundle install.
The script then announces the commencement of applying Slim templating, appending the slim-rails gem to the Gemfile, and injecting html2slim-ruby3 gem within the development group, alongside a descriptive comment. Following this, it executes the do_bundle method to install dependencies.
Next, it employs conversion commands (erb2slim) to transform layout files (application.html.erb, mailer.html.erb, and mailer.text.erb) into Slim templates, all while utilizing the -d flag to indicate a dry run. Additionally, it runs RuboCop with autocorrection enabled (-AS) to ensure code quality.
Finally, it outputs a message confirming the successful switch to Slim templating.
Store above file in your local system as ruby file and You can use this template while creating new application as below
rails new blog -m ~/slim_template.rb