However, seems I need to use a quick Sinatra application. https://github.com/sinatra/sinatra-book/blob/master/book/Introduction.markdown#hello-world-application
I'm not sure what this is. In following the README file (or markdown), I'll need to install RubyGems.
https://rubygems.org/
To use RubyGems, seems I'll need to install Ruby.
https://www.ruby-lang.org/en/
To install Ruby on my local Windows machine, seems it'll be easiest with the Installer.
http://rubyinstaller.org/downloads/
While installing Ruby, I selected all 3 checkboxes (using ToolKit for GUI development, adding Ruby exe to PATH, and auto-launching .rb and .rbw files with Ruby). Finish the installation.
Here's where I installed my Gem and Ruby programs.
Here's how I checked my programs were installed correctly. Checking Ruby first, then RubyGems.
NOTE: If you already have this program open, then you'll probably need to close and reopen the program so that Cygwin will refresh with the system environment variables.
Interesting, I ran into an issue where 'gem' command is not found in Cygwin. I found these articles to help me understand why.
http://stackoverflow.com/questions/3831131/rubygems-cygwin-posix-path-not-found-by-ruby-exe
http://blog.mmediasys.com/2008/10/27/handy-tip-dont-mix-one-click-installer-with-cygwin/
So, I install Ruby from within the Cygwin setup.
Run the commands again to see if RubyGems is now properly installed within Cygwin.
$ gem
Yes, fixed!
Now, I go back to GitHub's tutorial to continue (from Installation section).
Since I was a little confused on what all to install to get a basic Sinatra app running, I followed the instructions based on this quick tutorial. Mind you, I didn't know Ruby and had to watch the quick "Ruby for Newbies" screencast.
http://code.tutsplus.com/tutorials/singing-with-sinatra--net-18965
I created my "basics.rb" file in my new folder called "RubyProjects".
Next, I ran my file with Ruby from within my Cygwin (which I changed to RubyProjects directory).
Now I see the results in my browser as mentioned in the tutorial.
I'm not going to finish this 'tutsplus' tutorial since I understand the basics now. I' now I go back to GitHub's tutorial to continue (from Installation section). I update my file to look similar to the one in GitHub's tutorial.
To see these changes take effect, I enter command (while focus in Cygwin window): Ctrl + C
And the Sinatra server should stop (i.e. shutdown).
Next, I re-run the same command ($ ruby basics.rb) and see the update in the browser (refreshed).
Yes, we finished this simple instruction/tutorial from the referenced Sinatra on GitHub.
https://github.com/sinatra/sinatra-book/blob/master/book/Introduction.markdown#hello-world-application
Now what? Let's look back at: https://developer.github.com/guides/basics-of-authentication/
Seems GitHub tutorial is stating this is my app. Most likely it's referring to this app being registered in GitHub. So, I'll need to commit this app in my GitHub and then register this app.
For this example, I'll just create a public repo in my GitHub. (Be sure to add .gitignore for Ruby.)
Here it is @ https://github.com/gradney/basics-of-authentication
I'll clone this repo to my local, copy the "basics.rb" file into my local clone, update the file name to "server.rb" as mentioned in the tutorial, and then push/commit this up to my online GitHub repo.
I update the "server.rb" with the code in the section "Accepting User Authorization".
https://developer.github.com/guides/basics-of-authentication/#accepting-user-authorization
I also add the subfolder "views" with the file "index.erb" into my cloned folder. I commit to online repo.
I register my application according to GitHub tutorial.
In Cygwin, I navigate to the project folder and attempt to start this application in Sinatra server. But, didn't work. I stop and restarted, and still didn't work. One of my imports ('require' libraries is not recognized). I'll need to install this gem.
$ gem install rest-client
I get an error stating I need to install the development tools first. :(
I tried the following command, but this didn't work.
$ gem install bundler
I found this online article and tied this command
$ curl -sSL https://get.rvm.io | bash -s stable
Still does not seem to be working.
I just might need to build my own native libraries. boo.
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit#building-the-devkit
$ gem install json_pure (successful!)
$ gem update (there are so many errors resulting from "The compiler failed to generate an executable file.")
Yep, I'm going to need to do something else here with Sinatra. Dang, why does GitHub only have a tutorial on GitHub Authentication using a quick app in Ruby (via Sinatra)??? Awwww.....being difficult. Use an app that's platform independent in tutorials....that's the lesson today.
Some helpful troubleshooting tips:
https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting
http://collaborate.je/2014/08/setting-ruby-rails-windows-7-via-cygwin/http://stackoverflow.com/questions/20688671/failed-to-build-gem-native-extension-on-windows-7-the-system-cannot-find-the
https://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html
No comments:
Post a Comment