Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
A lightweight web framework for Ruby for creating database-backed web applications with the Model-View-Controller pattern. It features an ActiveRecord pattern ORM, convenient methods for cookie storage for things like session tokens, convenient executables to make development faster (like reloj new name_of_app
), and is designed to be easy to deply. Check out a live app built with reloj and deployed on heroku
Install Reloj at the command prompt if you haven't yet:
gem install reloj
At the command prompt, create a new Reloj application:
reloj new myapp
where "myapp" is the application name.
Change directory to myapp
and start the web server:
cd myapp
reloj server
Using a browser, go to http://localhost:3000
and you'll see:
"Welcome to Reloj!"
Reloj has some built in convenience features to make it easy to set up your database
To name your database, change the dbname value in config/db.yml
. If you need to setup any other values for your local database (username, password, port), you can put them in the same file.
To create a database for your app to use, just run:
bundle exec rake db:create
To destroy the database, run:
bundle exec rake db:delete
To reset the database, run:
bundle exec rake db:reset
Finally, to setup your schema and seed your database, use the db/setup.sql
file. To run this file on the app's databasae, run:
bundle exec rake db:setup
To learn how to manage the database when deploying, scroll down to the Deploy secction
Reloj uses the active record pattern for its object-relational mapping.
To use this functionality in your app, create a class for your model in app/models
and have the model inherit from ModelBase
class Cat < ModelBase
# custom code goes here
finalize!
end
###Some commands:
Cat.all
Cat.find(2)
Create controllers in app/controllers
. Controllers should inherit from ControllerBase
.
class CatsController < ControllerBase
def index
@cats = Cat.all
render :index
end
end
Write your routes in config/routes.rb
module App
ROUTES = Proc.new do
get '/cats', CatsController, :index
get '/cats/new', CatsController, :new
post '/cats', CatsController, :create
end
end
Reloj includes a generator for a sample app. To check it out:
Generate the sample app
reloj generate:sample
Move into the sample app directory
cd reloj_sample
Run the server
reloj server
Navigate to localhost:3000
Reloj is built to make deploying to heroku as easy as possible, here's how:
Make sure there's a procfile in the project's root directory with the following line:
web: bundle exec reloj server
Commit your changes to git
git commit -am "procfile"
Create a new heroku app using the heroku cli
heroku apps:create mynewapp
Push your code to heroku (heroku apps:create should automatically add a remote repo to push to)
git push heroku master
Wait for the push to finish, then create your database tables and seed it as defined in db/setup.sql
heroku run rake db:setup
Wait for the rake task to finish, then open your app:
heroku open
Enjoy your now-deployed app!
FAQs
Unknown package
We found that reloj demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.