A simple rake task that replicates the rails console for Lotus Framework
I assume that your config/application.rb is the place where you
initialize all Lotus boot config
below is my config/application.rb for your interest
# config/application.rb
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
module Blog
class Application < Lotus::Application
configure do
layout :application
routes 'config/routes'
load_paths << 'app'
controller_pattern "%{controller}Controller::%{action}"
view_pattern "%{controller}::%{action}"
end
end
endnext, we add pry gem into our app by editing our Gemfile
# Gemfile
source 'https://rubygems.org'
gem 'lotusrb', github: 'lotus/lotus'
gem 'lotus-utils', github: 'lotus/utils'
gem 'lotus-helpers', github: 'lotus/helpers'
gem 'lotus-model', github: 'lotus/model'
gem 'lotus-controller', github: 'lotus/controller'
gem 'lotus-view', github: 'lotus/view'
gem 'lotus-router', github: 'lotus/router'
gem 'pry'and make sure you run bundle install after that.
Now we create a Rakefile with following task
# Rakefile
desc 'Application console'
task :console do
exec 'bundle exec pry -r./config/application.rb'
endand now you can run bundle exec rake console to get all the sweetness of Rails console in Lotus.
Let's hope the next version of Lotus will bundle similar tool.
@rogerleite: I'll wait till Lotus is officially released and then work out what to do