A quick guide on how to setup Node.js development environment.
Previous versions of these install instructions had been tested with:
| # lib/tasks/db.rake | |
| namespace :db do | |
| desc "Dumps the database to db/APP_NAME.dump" | |
| task :dump => :environment do | |
| cmd = nil | |
| with_config do |app, host, db, user| | |
| cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
| end | |
| puts cmd |
| # This is a skeleton for testing models including examples of validations, callbacks, | |
| # scopes, instance & class methods, associations, and more. | |
| # Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
| # | |
| # I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
| # so if you have any, please share! | |
| # | |
| # @kyletcarlson | |
| # | |
| # This skeleton also assumes you're using the following gems: |
| FROM ruby:2.3.1 | |
| # Install dependencies | |
| RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
| # Set an environment variable where the Rails app is installed to inside of Docker image: | |
| ENV RAILS_ROOT /var/www/app_name | |
| RUN mkdir -p $RAILS_ROOT | |
| # Set working directory, where the commands will be ran: |
| require 'rails_helper' | |
| RSpec.describe TodosController, :type => :controller do | |
| describe "GET #index" do | |
| #describe "POST #create" do | |
| #describe "GET #show" do | |
| #describe "PATCH #update" do (or PUT #update) | |
| #describe "DELETE #destroy" do | |
| #describe "GET #new" do |
A quick guide on how to setup Node.js development environment.
Previous versions of these install instructions had been tested with:
| #!/usr/bin/env bash | |
| # fork from https://gist.github.com/jakemhiller/d342ad51505addf78ec628a16fd3280f | |
| changed_files="$(git diff-tree -r --name-only --no-commit-id $1 $2)" | |
| check_run() { | |
| echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
| } | |
| check_run package.json "npm prune && npm install" |
| require 'mina/bundler' | |
| require 'mina/rails' | |
| require 'mina/git' | |
| require 'mina/rvm' | |
| # Usually mina focuses on deploying to one host and the deploy options are therefore simple. | |
| # In our case, there is a number of possible servers to deploy to, it is therefore necessary to | |
| # specify the host that we are targeting. | |
| server = ENV['server'] | |
| # Since the same host can have multiple applications running in parallel, it is necessary to |
| # Mina Deploy | |
| # =========== | |
| # | |
| # Adapted from Creative deploy stack in Manabalss v4, Mar.2015, updated to support staging on Jun.2015 | |
| # On first deploy do: mina setup --verbose | |
| # Then do : mina deploy[initialize] --trace | |
| # | |
| # Usage examples: | |
| # mina deploy[soft,seed,compile] to=staging # deploy task with all options | a simple `mina deploy` will deploy to production | |
| # mina rake[db:seed] # for multi-argument tasks # mina 'rake[payments:refund[arg1\,arg2]]' |
| # config/deploy.rb | |
| require 'mina/bundler' | |
| require 'mina/rails' | |
| require 'mina/git' | |
| require 'mina/rvm' | |
| # ter_mode 这个要设置,不然在 mac 下输密码有问题 | |
| set :term_mode, nil | |
| set :rvm_path, '/usr/local/rvm/bin/rvm' |
| require 'mina/bundler' | |
| require 'mina/rails' | |
| require 'mina/git' | |
| require 'mina/rvm' # for rvm support. (http://rvm.io) | |
| set :domain, 'deploy@host' | |
| set :repository, 'git... | |
| set :branch, 'master' | |
| set :shared_paths, ['config/database.yml', 'config/application.yml', 'log', 'tmp/sockets', 'tmp/pids'] |