- Remove existing
.gitfolder viarm -rf .git - Initiate new repo via
git init - Add and commit all files
git add .andgit commit -m "Initial import from billet" - Add remote repository:
git remote add origin REPO_URL - Push the repo
git push -u origin master
- Rename module application in
config/application.rb - Rename name of module in constand definition
config/initializers/uptime.rb - Rename default database for development and test in
config/database.yml - Rename all names of containers and variales in
docker-compose.yml - Rename name of session store in
config/initializers/session_store.rb
- Rename application and and other project based config values in
config/settings.yml - Rename application in the header of
README.md - Add description to the 'Synopsis' section
- Change production domain in 'Synopsis' section
- Edit
db/seed.rbto fill database automaticaly (especially email of single user)
- This documentation is not required for your project, thus just remove section 'How to use it'
Describe your project here
- Production site: https://billet.dev
- Install required ruby version. The actual one can be found in
./.ruby-version. Now it is3.0.2. - Install nodejs version. The actual one can be found in
./assets/.node-version. Now it is17.0.1. - Install
yarnpackage manager.
Install another dependencies from Brewfile via
$ brew bundleInstall required libraries from Gemfile via
$ bundleRun database setup. This will set up the database and populate it with initial data.
$ bin/rake db:create db:migrate db:seedForeman is able to run everything whats needed via single command. Check Procfile to read more:
foreman startIt runs the following processes:
web. The http server. It can be run separately via commandbin/rails s -b 0.0.0.0worker. The background job processor. Run it separately via commandbin/sidekiq -C config/sidekiq.ymlrpc. The part of anycable. Separate command isbin/anycablews. The part of anycable. It is separate binary which can be run asanycable-go --host=localhost --port=3334 -headers=cookie,Authorization,origin
lvh.me is the default domain, configured in example
configuration files. Use lvh.me:3000 and its subdomains
to access the application in development.
That's it.
- Make sure you've run
bin/rake db:migrate RAILS_ENV=test - Running
bin/rakewill run unit tests, then, if all pass, run acceptance tests - We do unit testing with rspec. To run just unit tests run
bin/rake spec. To run a single one, runbin/rspec spec/path/to/spec.rb. - To run rubocop, just
bin/rubocop. Do not forget to do it before commit. bin/brakemanchecks code for security vulnerabilities.bin/bundle audit check --updatechecks public known vulnerabilities in the libraries.
There are several fundamental changes and concepts were applied to the framework. Some of them work well in a vanilla Ruby on Rails application, but it is not customary to use it by default.
An application is split by engines by on controllers level only. All models should be left in app/models. To generate new engine use namespace generator via command bin/rails generate namespace NamespaceName. There are several config options available.
--begin_chain current_company. All resource controllers starts chaining with a root method where everything should be available. For example class Company has many projects, thuscurrent_company.projectswill be called in controllerprojects_controller.--access cancanwith optionsfake,cancan,httpandnone--route prefixto change route prefix where engine will be available. By default it is lowercased underscored namespace name.--api false(ortrue). A namespace will be optimised for api only if it'strue.
https://github.com/cimon-io/billet-isolated-assets
All configuration variables should be stored in the config/settings.yml file via config gem. Also it should define ENV variables to rewrite defaults.
All initializers have been split by 4 subfolders: core, libs, concerns and monkeypatches.
corefolder contains rails initializers.libsfolders is for libraries and gems configuration and initializations.concernscontent patches and includes areActiveRecord::Baseand other base classes of rails.monkeypatchesfolder contains the hard patches of ruby core, rails libraries and other low level libraries.
action_view_assets_url_helper.rbpatches theAssetUrlHelperand it needs for newassetsto find resources forimage_urland other helpers.active_record_database_statements.rbpatches ActiveRecord and it allows to useRETURNINGstatement to define postgresql procedures.
DATABASE_URL, TEST_ENV_NUMBER, DATABASE_POOL
glipper and drappers
unobtrusive_resources with pagination
mute_action
attr_accessor_with_default
deny_destroy
true?(value)
plur
t and th
display_attribute and human_attribute_name
datalink and datalink_if
controller method meta_for and helper page_meta_for
flash_styleclass- do not render flash if xhr
e
custom_number_to_percentage with alias ntp
markdown_to_html, markdown_to_html_if and md
smart_sentence
smart_sanitize and should_sanitized?