This is a Rails web app for updating the Marknad iPhone app with information on products in Instagram photos featured there. Note: you might want to use your own Access Token, as this sample one might expire. We will update the repo accordiningly.
-
Ruby version
1.9+ Check this by running ruby-v from terminal on Mac or (Git Bash on PC). If you don’t have 1.9 or higher, get rvm and install Ruby version 2.1.1 and then run: rvm –default use 2.1.1 )
-
System dependencies
Rails 4.0+
-
Configuration
(OpenShift) To deploy on openshift, you will need to: In OpenShift, create a new Ruby on Rails application stack. Once your app is up, navigate to your application page.
Clone your app to your local. Preferably in Desktop/app.
Navigate to the marknadUpdater folder in your terminal and delete all the default OpenShift rails project code with: rm -rf * (Make sure you are in your marknadUpdater folder or you might delete a lot of stuff accidentally!)
Now run: git remote add upstream -m master github.com/CodeCloudMe/marknadUpdater.git git pull -s recursive -X theirs upstream master
Awesome you have the right code.
Back to the OpenShift portal.
Once you are on your application page, click "Want to login to your application". Copy the "ssh 53ab76df5973c[.....]" code
Paste that into your terminal. Now, navigate to your source code with: cd app-root/runtime/repo
Now run: rake secret
Copy the secret key that is displayed (should be many letters and numbers)
Now logout with of your OpenShift server with: exit
Now that you’re back into your project folder on local, find your openshift app name by locating it in the list after running from the terminal: rhc setup
Run rhc setup to see a list of your apps. Take note of your Rails app name. It will be “yourOpenShiftAppName” in the following bit. Also, “yourSecretFromTheServer” is the secret code your copied when you raked.
Now that you’re back into your folder, set your SECRET_KEY_BASE: rhc set-env SECRET_KEY_BASE=yourSecretFromTheServer -a yourOpenShiftAppName
Now run:
bundle install bin/rake db:migrate RAILS_ENV=development rails server
(you might need to use sudo in front of some of the commands)
Now push to your OpenShift server with: git push origin master (this may take a few minutes)
Navigate to your OpenShift URL once that’s complete and you should see this: railsupdater-tester588.rhcloud.com/posts
**********
(local)
To run on your computer, clone this repo. Then once you cd into the app deirectory, run:
bundle install bin/rake db:migrate RAILS_ENV=development rails server App will look similar to this: http://railsupdater-tester588.rhcloud.com NOTE: To add fields to a model after you have scaffolded, run: rails generate migration add_column_name_to_*modeName* columnName:string