- Add initializer to
config/application.rb - Add new class to
app/models/spree/calculators/[class_name].rb - Add logic to class file
Class must have the following methods:
def self.description
"Custom FlexiRate"
end
| @import "select2"; |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/css/font-awesome.min.css"> | |
| <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css"> | |
| </head> | |
| <body> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js" type="text/javascript"></script> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js" type="text/javascript"></script> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/react/0.11.0/react.js"></script> |
config/application.rbapp/models/spree/calculators/[class_name].rbClass must have the following methods:
def self.description
"Custom FlexiRate"
end
| # ***config/application.rb*** | |
| module SpreeDemo | |
| class Application < Rails::Application | |
| # more awesome code here... | |
| config.to_prepare do |config| | |
| # more code here... | |
| config.autoload_paths += %W(#{config.root}/lib/spree/) |
SSH into Root
$ ssh root@123.123.123.123
Change Root Password
| # 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 |
| 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 |
require 'mina/bundler'| require 'mina/bundler' | |
| require 'mina/rails' | |
| require 'mina/git' | |
| require 'mina/rvm' # for rvm support. (http://rvm.io) | |
| set :domain, 'esdb.cn' | |
| set :identity_file, '/User/somebody/.ssh/somebody.pem' | |
| set :deploy_to, '/home/ubuntu/apps/xxx.com' | |
| set :repository, 'ssh://git@bitbucket.org/somebody/xxx.com.git' | |
| set :branch, 'master' |