Running bundle install should be able to download and install all Ruby Gems dependencies.
This app is using PostgreSQL. Hence, it is necessary to have PostgreSQL running. The database configurations for production and test environments should be defined in the following environment variables:
PG_USERNAMEPG_PASSWORDPG_SIMPLECMS_DEVPG_SIMPLECMS_TEST
A simple git push heroku master should do the job. You might also need to run heroku run rake db:schema:load after the very first deployment, or heroku run rake db:migrate after an update.
This method is tested on Ubuntu Server 14.04.1. Run
source <(curl -sS https://raw.githubusercontent.com/yihangho/SimpleCMS/master/script/server_bootstrap.sh)to bootstrap the server. On your development repository, run
git add remote production <username>@<host>:SimpleCMS.gitReplace <username> with the user on the server that ran the setup script and <host> with the IP/domain of the server. To deploy, just push to the master branch of production remote.
PG_USERNAMEPG_PASSWORDPG_SIMPLECMS_DEVPG_SIMPLECMS_TESTNEW_RELIC_LICENSE_KEYPUSHBULLET_ACCESS_TOKENGA_TRACKING_IDCONTACT_EMAIL
Attaching this attribute to an element will cause MathJax to typeset the content of the element.
Each task should have an input generator and a grader.
Input generator should implement the generate_input method which takes in a seed, and output an array of hashes. The keys to each hash should be the name of a variable, and the values are the values of each variable. Hashes that appear earlier in the output array will be present to the user first. It is important that generate_input will always output the same thing given the same seed. Hence, to randomize the test cases, you may use the Random standard library. An example of a valid input generator:
# Problem statement:
# Given an array of N positive integers, output the K-th smallest number in that array.
def generate_input(seed)
prng = Random.new(seed)
n = 1000
k = prng.rand(n) + 1
numbers = (1..n).to_a.map { prng.rand(10000) }
# In this case, it is guaranteed that N and K will be presented to the user first follow by numbers
[{N: n, K: k}, {numbers: numbers}]
endGrader should implement the grade_answer method which takes in the output of input generator and a string provided by the user (which is the answer to be judged), and output either true or false. An example of a valid grader:
def grade_answer(input, answer)
# Answer must represent an integer
return false unless answer.strip =~ /\A\d+\z/
input[1][:numbers].sort[input[0][:K] - 1] == answer.to_i
end