This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FOREST_EMAIL=sandro@munda.me FOREST_PASSWORD=lumberjack forest login | |
envsecret=$(forest environments:create -p 82 -n TestFeatureX -u http://my.application.com:4294 | awk '$1 ~ /^ *FOREST_ENV_SECRET/ {print $2}') | |
forest schema:apply --secret $envsecret | |
envid=$(forest environments:list -p 82 | awk '$2 ~ "TestFeatureX" {print $1; exit}') | |
forest environments:copy-layout 2200 $envid -p 82 --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export my data from my local database | |
pg_dump -h localhost -p 5446 -U forest forest_live_demo_rails --no-owner --no-acl -f database.sql | |
# Import my data to the Heroku database | |
heroku pg:psql DATABASE_URL --app lumber-deploy-to-production < database.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
seyz:LumberDeployToProdExample/ (master) $ git push heroku master | |
Counting objects: 25, done. | |
Delta compression using up to 4 threads. | |
Compressing objects: 100% (20/20), done. | |
Writing objects: 100% (25/25), 21.56 KiB | 5.39 MiB/s, done. | |
Total 25 (delta 9), reused 0 (delta 0) | |
remote: Compressing source files... done. | |
remote: Building source: | |
remote: | |
remote: -----> Node.js app detected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* /forest/products.js */ | |
const Liana = require('forest-express-sequelize'); | |
const models = require('../models'); | |
Liana.collection('products', { | |
actions: [{ | |
name: 'Import data', | |
endpoint: '/forest/products/actions/import-data', | |
type: 'global', | |
fields: [{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* /forest/companies.js */ | |
const Liana = require('forest-express-sequelize'); | |
Liana.collection('companies', { | |
searchFields: ['name', 'industry'], | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /config/initializers/forest_liana.rb | |
ForestLiana.env_secret = Rails.application.secrets.forest_env_secret | |
ForestLiana.auth_secret = Rails.application.secrets.forest_auth_secret | |
ForestLiana.integrations = { | |
stripe: { | |
api_key: ENV['STRIPE_SECRET_KEY'], | |
mapping: 'Customer.stripe_id' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The value MUST be formatted like this. | |
{ | |
value: [{ | |
label: <string> , | |
values: { value: <number> } | |
}, { | |
label: <string> , | |
values: { value: <number> } | |
}, …] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The value MUST be formatted like this. | |
{ | |
value: [{ | |
key: <string> , | |
value: <number> | |
}, { | |
key: <string> , | |
value: <number> | |
}, …] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The value MUST be formatted like this. | |
{ | |
value: <number> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /lib/forest_liana/collections/product.rb | |
class Forest::Product | |
include ForestLiana::Collection | |
collection :Product | |
segment 'Bestsellers' do | |
products = ActiveRecord::Base.connection.execute(""" | |
SELECT products.id, COUNT(orders.*) | |
FROM products |
NewerOlder