There are two main testing gems within rails, Rspec and Minitest. Since Minitest ships with Rails, lets focus on how to use it with rails.
If we are starting from scratch, we can create a new app by rails new TestSuite -T
. The -T tells rails not to include any test units upon creating the app. This means that rails will not generate and test or spec files upon generating any scaffolds or models.
We can add minitest to our project by opening ...
Let's check our hostname
hostname
hostname -f
The first command shows short hostname, and the second shows your fully qualified domain name (FQDN).
Next, let's make sure we have the most current packages.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
Make sure to chose a secure MySQL root user password when prompted. MySQL...
Lets open the MySQL shell and create a new user.
mysql -u root -p
CREATE USER 'jimmy'@'localhost' IDENTIFIED BY 'password123';
When we first create a user, it will have no permissions, which means it can even login to the MySQL shell, so we need to give it the needed permissions.
GRANT ALL PRIVILEGES ON * . * TO 'jimmy'@'localhost';
The first asterisk in this command refers to the database, in this case we are givin...
Some of these commands and shortcuts are based off my own .vimrc file, so it may not work for your setup when you try performing some of the below commands.
:Gblame
:Ag count app/controllers
:%s/word/love/gc
:Ag #navigation-wrapper app/assets/stylesheets
space + n
space + t
q w
(then do the commands you'd like repeated)q
again to stop recording@w
(to initiate most recent macro)Updated for Ubuntu 18.04 / 16.04
SSH into the server running your HTTP website as a user with sudo privileges.
You'll need to add the Certbot PPA to your list of repositories. To do so, run the following commands on the command line on the machine:
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo su - root # This has to be run as root.
cd /usr/sbin
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
./certbot-auto
Add the following to your nginx server configuration block vim sites-enabled/yourdomain.com
location ^~ /.well-known/ {
root /usr/share/nginx/html;
}
Add folder for well known mkdir -p /usr/share/nginx/html
Create `mkdir -p /etc/...
materialize-sass
is a Sass powered version of Materialize, a modern responsive front-end framework based on Material Design.
example: http://materialize.labs.my/
source: https://github.com/mkhairi/materialize-rails
Rails 5.1+ The Rails JavaScript helpers has been rewritten in a new gem called rails-ujs and they use vanilla JavaScript, so jQuery is not a dependency of Rails anymore. Since materialize...
// package.json
{
"name": "freelance-camp-fe",
"version": "1.0.0",
"scripts": {
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"tsc": "tsc",
"tsc:w": "tsc -w"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/angular/angular.io/blob/master/LICENSE"
}
],
"dependencies": {
"@an...
Let's first create our API app. The --api makes our app only have the essential code and cuts out any unneeded code an API wouldn't need. The -T tells it not to install any test suite. The -d specifies which database should be used.
rails new app_name --api -T -d postgresql
Create the database.
rails db:create
Use a scaffold.
rails g scaffold NAME title:string description:string file_url:text image_...
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install node
node -v
npm -v
npm install -g typescript
tsc helloworld.ts
/usr/local/bin/tsc -> /usr/local/lib/node_modules/typescript/bin/tsc
/usr/local/bin/tsserve...