UC Berkeley, School of Public Health, California Childhood Leukemia Study
Childhood Leukemia International Consortium
-
ruby >= 2.1
-
ImageMagick (which may require MacPorts)
-
ImageMagick is used to image manipulation
-
-
For the time being, do not use apostrophes in the filenames of any uploaded files. I think that Paperclip does not deal with them, at least using expiring_url, and somehow the signature is incorrect.
-
possible fix … www.davesouth.org/stories/make-url-friendly-filenames-in-paperclip-attachments
# Copy secret_token file. cp config/initializers/secret_token.rb.example config/initializers/secret_token.rb # Copy and setup database file. cp config/database.yml.example config/database.yml # Copy and add your own gmail credentials. cp config/initializers/mail.rb.example config/initializers/mail.rb
Possible For standard ruby users, install mysql gem …
# If using mysql ... # On Mac OS X: # sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql # On Mac OS X Leopard: # sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config # ... I had to install the mysql gem like so ... sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Everybody join hands together now to install some gems …
# # Some gems require manual installation for one reason or another. # # (sudo may or may not be required or desired. # Usage of sudo will/may cause gem installation in /usr/lib # which may then require using sudo when running rake tasks # or other things. `gem list` and `sudo gem list` will differ. # I recommend avoiding using sudo with rvm, but its your # kitchen.) # gem source -a http://gemcutter.org gem source -a http://gems.github.com sudo gem install bundler # preferably use bundler to install all specific gem versions sudo bundle install
then we continue …
# Add your own session secret to config/initializers/secret_token.rb # generate a 128 character hex string perfect for using as your secret. rake secret rake db:migrate # add some expected items (loads fixtures OVERWRITING some db data) rake app:setup script/rails s # login to your app # The first administrator/deputy must be created via the command line. # Others can be created via the command line or web app. # rake app:deputize username=<Your Username> # # # The CLIC site no longer uses this functionality, but it has not been # removed from the app. Just the menu item. Don't bother starting it. # start sunspot:solr server (sunspot:solr:start does not work in jruby) [jakewendt@ccls-01:~] > sudo su -l tomcat [tomcat@ccls-01:~] > cd /var/lib/tomcat5/webapps/clic/WEB-INF [tomcat@ccls-01:WEB-INF] > rake sunspot:solr:run RAILS_ENV=production & # log MAY BE at /var/lib/tomcat5/webapps/clic/WEB-INF/log/sunspot-solr-production.log
Inline documentation is sparse and incomplete, but I’m working on it.
sudo gem install rdoc --source http://gemcutter.org rake doc:plugins rake doc:app open doc/app/README_rdoc.html
-
Fix
expire_fragment "#{request.try(:host_with_port)}#{page_path}"so that it works without thetry(not necessary) -
Add to
doc/README_FOR_APP -
one of the images in rdoc isn’t always the correct directory depth and will create a flash error showing this
Gradient images made with Gradient Image Maker
sqlite3 clic.sqlite3.20110809 .dump > clic.sqlite3.20110809.dump
Edit the dump file and remove all lines like …
PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE .... INSERT INTO "schema_migrations" ... DELETE FROM sqlite_sequence; INSERT INTO "sqlite_sequence" .... CREATE UNIQUE INDEX .... CREATE INDEX .... COMMIT;
Convert table name quotes from double quotes to backticks in vim with …
%s/INSERT INTO "/INSERT INTO `/ %s/" VALUES(/` VALUES(/
Import to mysql database
rake db:migrate RAILS_ENV=production mysql -u magee -p --host=cascades.ist.berkeley.edu --port=3347 CCLS_Systems < clic.sqlite3.20110809.dump.forimport
The boolean values did not export/import well, but none were terribly important. This should be noted if ever doing this again with boolean values that do matter.
Forking is frowned upon in jruby so using “start” won’t work.
To start the solr server just “run” it in the background. Can’t seem to get a “commit” to work in production so need to build the index elsewhere and import everything. Not gonna work in the long term. Also has a tendency to crash out silently.
rake sunspot:solr:run & cp ~jakewendt/CCLS_Aust_Covariate_sample.csv ./ rake app:subjects:import --trace rake "sunspot:reindex" --trace
DO NOT USE Date.today, unless the following is what you want.
It will compute a Date and disregard the time zone.
In rails, this means that occassionally Date.today == Date.tomorrow or Date.today == Date.yesterday, depending on what time it is.
The Rails methods of Date.tomorrow and Date.yesterday reference Date.current, which uses the Time.zone, making them more accurate.
I think that DateTime.now and Time.now also ignore the timezone.
Use DateTime.current or Time.zone.now
c ; /bin/rm -rf coverage* ; bundle exec rake ; mv coverage coverage-one-run ; open coverage-one-run/index.html ; nice +20 bundle exec autotest -v --no-full-after-failed
Unfortunately, killing the server could result in lost data that may be cached in memory. At least in theory. I don’t think that rails really caches like that.
CLIC IS ON PORT 3001 !!!!
cd /my/ruby/clic kill -9 `cat tmp/pids/server.pid` git pull bundle install rake db:migrate script/rails server -d -p 3001 -e production
FYI web admin pings this site every 5-10 seconds which will make the log pretty big.