Showing posts with label Rails Ruby Sinarta. Show all posts
Showing posts with label Rails Ruby Sinarta. Show all posts

Friday, March 20, 2009

Chapter 49: Sinatra Course #6

  1. Unit 6 starts on page 38. Instruction on how to connect to Postgress: http://gist.github.com/68277
  2. Page 39 was the code for crud.rb and pages 40-43 explains the different parts of the code.
  3. Created new.erb and show.erb. (p.42, 43)
  4. Ran "ruby crud.rb" and it worked. (p.43)
  5. Stopped on Exercise at bottom of page 43. Open Source Web Designs: http://www.oswd.org/

Chapter 48: Sinatra Course #5

  1. Text Reversing Service: Unit 5 starts on page 32.
  2. Did everything on page 32 and it worked as shown on page 33.
  3. Did everything on page 34 and saw no change. (p.34)
  4. QUESTION: Where to put show.erb? My guess is under views.
  5. Made the changes on top of page 35 and it worked. (p.35)
  6. Did #1 at bottom of page 35, but only had partial information (did not know "severe-night-58" string yet; see step 4 on next page) to do step #2. Did as much as possible.
  7. Step 3: Set up Git. (done) (p.36)
  8. Step 4: Set up Heroku. Now I have step 6 above string. It is "deep-wind-75".
  9. Step 5: Created remote add alias. Used "page36" $ git remote add page36 git@heroku.com:deep-wind-75.git
  10. Step 6: Deployed to Heroku: $ git push page36 master (p.37)
    Enter passphrase for key '/home/jasnow/.ssh/id_rsa':
    Counting objects: 7, done.
    Compressing objects: 100% (7/7), done.
    Writing objects: 100% (7/7), 870 bytes, done.
    Total 7 (delta 0), reused 0 (delta 0)
    -----> Heroku receiving push
    -----> Rack app detected
    Compiled slug size is 0.0MB
    -----> Launching........ done
    App deployed to Heroku
    To git@heroku.com:deep-wind-75.git
    * [new branch] master -> master
  11. Tried it in browser and it worked. http://deep-wind-75.heroku.com/reverse
  12. End of Unit 5.

Chapter 47: Sinatra Course #4

  • Views: Did the stuff on page 27 and 28 to add Views to electric-robot-51 and it worked.
  • Now to Layouts: Created layout.erb and copies contents from zip file. (p.29)
  • Then created "public" directory and copies contents (7 files) from zip file .(p.29-30)
  • $ git add . ; $ git commit -m 'committing public files'
    [master]: created edeffeb: "committing public files"
    7 files changed, 117 insertions(+), 0 deletions(-)
    create mode 100644 public/images/Thumbs.db
    create mode 100644 public/images/background.png
    create mode 100644 public/images/background_bottom.gif
    create mode 100644 public/images/background_content.gif
    create mode 100644 public/images/background_top.gif
    create mode 100644 public/images/nw.gif
    create mode 100644 public/stylesheets/style.css
    $ git push heroku master
    Enter passphrase for key '/home/jasnow/.ssh/id_rsa':
    Counting objects: 18, done.
    Compressing objects: 100% (15/15), done.
    Writing objects: 100% (16/16), 4.72 KiB, done.
    Total 16 (delta 4), reused 0 (delta 0)
    -----> Heroku receiving push
    -----> Rack app detected
    Compiled slug size is 0.0MB
    -----> Launching........ done
    To App deployed to Herokugit@heroku.com:electric-robot-51.git
    08779c4..edeffeb master -> master

Chapter 46: Sinatra Course #3

  1. Started some of the Heroku during Chapter 39 of this blog.
  2. Got my Heroku account.
  3. Installed heroku gem file. [~] $ gem install heroku (p.23)
    Successfully installed thor-0.9.9
    Successfully installed sequel-2.10.0
    Successfully installed taps-0.2.9
    Successfully installed heroku-0.6.1
    4 gems installed
    Installing ri documentation for thor-0.9.9...
    Installing ri documentation for sequel-2.10.0...
    Installing ri documentation for taps-0.2.9...
    Installing ri documentation for heroku-0.6.1...
    Installing RDoc documentation for thor-0.9.9...
    Installing RDoc documentation for sequel-2.10.0...
    Installing RDoc documentation for taps-0.2.9...
    Installing RDoc documentation for heroku-0.6.1...
  4. Had a lot of problems running heroku keys:add" so I created a shell script, heroku, and added it to my $HOME/bin directory . $ heroku keys:add (p.23)
    Uploading ssh public key C:\Users\/.ssh/id_rsa.pub
  5. Create config.ru in $HOME directory and put 'require "myapp"' and "run Sinatra::Application" in it.
  6. Set up Git (init, add, commit) for myapp. (p.24)
  7. Installed Git for Cygwin from Cygwin repository. (done)
  8. Run this: $ heroku create --remote 9p.25)
    Created http://electric-robot-51.heroku.com/ | git@heroku.com:electric-robot-51.git
    Git remote heroku added
  9. Ran this: $ heroku list 9p.25)
    young-night-98
    electric-robot-51
  10. Create git-remote: $ git remote add electricrobot git@heroku.com:electric-robot-51.git (p.25)
    $ git remote add electric git@heroku.com:electri
    c-robot-51.git
    fatal: remote electric already exists.
  11. Did this and got error: $ git push electricrobot master
    fatal: exec ssh failed.
    fatal: The remote end hung up unexpectedly
  12. Had to install OpenSSH from Cygwin repository.
  13. Got different response: $ git push heroku master (p.26)
    The authenticity of host 'heroku.com (75.101.145.87)' can't be established.
    RSA key fingerprint is .
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'heroku.com,75.101.145.87' (RSA) to the list of known ho
    sts.
    Permission denied (publickey).
    fatal: The remote end hung up unexpectedly
  14. Ran step 10: "Confirm:" $ heroku info --app electric-robot-51
    === electric-robot-51
    Web URL: http://electric-robot-51.heroku.com/
    Git Repo: git@heroku.com:electric-robot-51.git
    Collaborators: jasnow@hotmail.com
  15. Save this URL: http://heroku.disqus.com/heroku_api_and_external_git_access/
  16. http://zylstra.wordpress.com/2008/08/29/overcome-herokus-permission-denied-publickey-problem/
  17. Started over. Printed out a couple things. Read them. Redid "ssh-keygen -t dsa" and "heroku keys:add".
  18. Then tried the push again: $ git push heroku master
    The authenticity of host 'heroku.com (75.101.163.44)' can't be established.
    RSA key fingerprint is .
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'heroku.com,75.101.163.44' (RSA) to the list of known hosts.
    Enter passphrase for key '/home//.ssh/id_dsa':
    Counting objects: 14, done.
    Compressing objects: 100% (10/10), done.
    Writing objects: 100% (14/14), 2.76 KiB, done.
    Total 14 (delta 1), reused 0 (delta 0)

    -----> Heroku receiving push
    FAILED
    ! Heroku push rejected, no Rails or Rack app detected.

    error: hooks/pre-receive exited with error code 1
    To git@heroku.com:electric-robot-51.git
    ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'git@heroku.com:electric-robot-51.git'
  19. SINATRA INTERVIEW EXAMPLE: $ mkdir wiki
    $ cd wiki
    $ git init
    Initialized empty Git repository in /cygdrive/c/Documents and Settings/jasnow/gitlcalrepo/wiki/.git/
    $ heroku create
    Created http://severe-moon-59.heroku.com/ | git@heroku.com:severe-moon-59.git
    Git remote heroku added
  20. $ git push heroku master
    Enter passphrase for key '/home/jasnow/.ssh/id_rsa':
    Counting objects: 4, done.
    Compressing objects: 100% (3/3), done.
    Writing objects: 100% (4/4), 831 bytes, done.
    Total 4 (delta 0), reused 0 (delta 0)
    -----> Heroku receiving push
    -----> Rack app detected
    Compiled slug size is 0.0MB
    -----> Launching......... done
    App deployed to Heroku
    To git@heroku.com:severe-moon-59.git

    * [new branch] master -> master
  21. Now that Wiki example works, I repeated it for original example (see step 18). $ git push heroku master
    Enter passphrase for key '/home/jasnow/.ssh/id_rsa':
    Counting objects: 17, done.
    Compressing objects: 100% (12/12), done.
    Writing objects: 100% (17/17), 3.04 KiB, done.
    Total 17 (delta 2), reused 0 (delta 0)
    -----> Heroku receiving push
    -----> Rack app detected
    Compiled slug size is 0.0MB
    -----> Launching........ done
    App deployed to Heroku
    To git@heroku.com:electric-robot-51.git
    * [new branch] master -> master
  22. http://electric-robot-51.heroku.com/ worked.
  23. http://severe-moon-59.heroku.com/Home worked.

Chapter 45: Sinatra Course #2

  • Unit 2 starts on page 19. Moved App. 1 (GIT) to this section.
  • Created directory "mkdir sinatra_program" under gitlocalrepo directory. (p.19)
  • Then put "require 'sinatra' into myapp.rb and ran it. :$ ruby myapp.rb (p.20)
    == Sinatra/0.9.1.1 has taken the stage on 4567 for development with backup from Mon
    grel
  • Then I open and browser window with http://localhost:4567 and got this: Sinatra doesn't know this ditty.


  • Try this:
    get '/' do
    "Hello World"
    end
  • Then I add "get" handler with just a comment and it worked. Then added 'Welcome from RubyLearning' and it worked. (p.21)
  • PROBLEM: Have a problem getting Cygwin to take the Control-C.
  • QUESTION: Unclear why GIT was mentioned in this section. We did not use it.

Chapter 44: Sinatra Course #1

  1. Read Sinatra Interview. http://rubylearning.com/blog/2009/03/20/interview-ryan-tomayko-on-sinatra/
  2. Subscribed to Sinatra Forums and printed out forums emails I missed.
  3. Downloaded Sinatra ebook and printed it out.
  4. Started reading ebook. Installed Sinatra: [~] $ gem install sinatra (p.16)
    Successfully installed rack-0.9.1
    Successfully installed sinatra-0.9.1.1
    2 gems installed
    Installing ri documentation for rack-0.9.1...
    Installing ri documentation for sinatra-0.9.1.1...
    Installing RDoc documentation for rack-0.9.1...
    Installing RDoc documentation for sinatra-0.9.1.1...
  5. Then installed builder and haml gems. [~] $ gem install builder haml (p.16)
    Successfully installed builder-2.1.2
    Successfully installed haml-2.0.9
    2 gems installed
    Installing ri documentation for builder-2.1.2...
    ERROR: While generating documentation for builder-2.1.2
    ... MESSAGE: Unhandled special: Special: type=17, text=""
    ... RDOC args: --ri --op C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/doc/build
    er-2.1.2/ri --title Builder -- Easy XML Building --main README --line-numbers --qui
    et lib CHANGES Rakefile README doc/releases/builder-1.2.4.rdoc doc/releases/builder
    -2.0.0.rdoc doc/releases/builder-2.1.1.rdoc
    (continuing with the rest of the installation)
    Installing ri documentation for haml-2.0.9...
    ERROR: While generating documentation for haml-2.0.9
    ... MESSAGE: Unhandled special: Special: type=17, text=""
    ... RDOC args: --ri --op C:/cygdrive/c/deepdive/InstantRails-2.0-win/ruby/doc/haml-
    2.0.9/ri --title Haml --main README.rdoc --exclude lib/haml/buffer.rb --line-number
    s --inline-source --quiet lib FAQ MIT-LICENSE VERSION README.rdoc REVISION
    (continuing with the rest of the installation)
    Installing RDoc documentation for builder-2.1.2...
    Installing RDoc documentation for haml-2.0.9...
  6. Installed mongrel. [~] $ gem install mongrel (p.16)
    Successfully installed mongrel-1.1.5-x86-mswin32-60
    1 gem installed
    Installing ri documentation for mongrel-1.1.5-x86-mswin32-60...
    Installing RDoc documentation for mongrel-1.1.5-x86-mswin32-60...
  7. Ran: gem specification mongrel (p.17) and got 155 wc-lines of output. See: http://www.pastie.org/422175
  8. Downloaded sqlite3.def, sqlite3.dll, and sqlite3.exe and put them in Ruby's bin directory. (p.17)
  9. Then I install sqlite3-ruby gem: gem install sqlite3-ruby -v=1.2.3 (p.18)
  10. Successfully installed sqlite3-ruby-1.2.3-x86-mswin32
    1 gem installed
    Installing ri documentation for sqlite3-ruby-1.2.3-x86-mswin32...
    Installing RDoc documentation for sqlite3-ruby-1.2.3-x86-mswin32...
  11. Finally installed activerecord. $ gem install activerecord (p. 18)
    Successfully installed activesupport-2.3.2
    Successfully installed activerecord-2.3.2
    2 gems installed
    Installing ri documentation for activesupport-2.3.2...
    Installing ri documentation for activerecord-2.3.2...
    Installing RDoc documentation for activesupport-2.3.2...
    Installing RDoc documentation for activerecord-2.3.2...
  12. Finished with "Unit 1" of Sinatra Course.