- Remove existing
.git
folder 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.rb
to 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
yarn
package manager.
Install another dependencies from Brewfile
via
$ brew bundle
Install required libraries from Gemfile
via
$ bundle
Run database setup. This will set up the database and populate it with initial data.
$ bin/rake db:create db:migrate db:seed
Foreman is able to run everything whats needed via single command. Check Procfile
to read more:
foreman start
It runs the following processes:
web
. The http server. It can be run separately via commandbin/rails s -b 0.0.0.0
worker
. The background job processor. Run it separately via commandbin/sidekiq -C config/sidekiq.yml
rpc
. The part of anycable. Separate command isbin/anycable
ws
. 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/rake
will 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/brakeman
checks code for security vulnerabilities.bin/bundle audit check --update
checks 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.projects
will be called in controllerprojects_controller
.--access cancan
with optionsfake
,cancan
,http
andnone
--route prefix
to 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
.
core
folder contains rails initializers.libs
folders is for libraries and gems configuration and initializations.concerns
content patches and includes areActiveRecord::Base
and other base classes of rails.monkeypatches
folder contains the hard patches of ruby core, rails libraries and other low level libraries.
action_view_assets_url_helper.rb
patches theAssetUrlHelper
and it needs for newassets
to find resources forimage_url
and other helpers.active_record_database_statements.rb
patches ActiveRecord and it allows to useRETURNING
statement 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?