Permalink
Browse files

Add minimal ruby web app

  • Loading branch information...
1 parent e98b005 commit 350b11c113093b4eacbcb3cbde35a20cc0f130b8 @jhbabon committed Nov 21, 2012
Showing with 121 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +4 −0 Gemfile
  3. +17 −0 Gemfile.lock
  4. +1 −0 Procfile
  5. +11 −0 config.ru
  6. +87 −0 draft.md
View
@@ -16,3 +16,4 @@ tmp
.yardoc
_yardoc
doc/
+.env
View
@@ -0,0 +1,4 @@
+source :rubygems
+
+gem 'rack'
+gem 'thin'
View
@@ -0,0 +1,17 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ daemons (1.1.9)
+ eventmachine (1.0.0)
+ rack (1.4.1)
+ thin (1.5.0)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ rack
+ thin
View
@@ -0,0 +1 @@
+web: bundle exec thin start -R config.ru -e $RACK_ENV -p $PORT
View
@@ -0,0 +1,11 @@
+# encoding: utf-8
+
+require 'rack'
+
+use Rack::Static,
+ :urls => %w(/humans.txt /css /js),
+ :root => 'public',
+ :cache_control => 'public, max-age=3000000',
+ :index => 'index.html'
+
+run lambda { |env| [404, { 'Content-Type' => 'text/plain' }, ['Not found']] }
View
@@ -0,0 +1,87 @@
+# the interpreter
+ * many interpreters
+ * most important:
+ * MRI (Matz's Ruby Interpreter): 1.8.7, 1.9.3, 2.0.0-preview1
+ * standard interpreter.
+ * REE: only 1.8.7 compatible. Discontinued.
+ * JRuby: can execute java inside ruby. threading.
+ * Rubinius: "provide a rich, high-performance environment for running Ruby code". threading. Byte code VM.
+ * we use MRI 1.9.3
+
+# version manager
+ * you can install many interpreters or different versions of an interpreter.
+ * you can switch the interpreter.
+ * you can test your app against various interpreters.
+ * most importants:
+ * RVM
+ * rbenv
+
+## RVM
+ * the first one.
+ * a lot of people use it.
+ * constant development.
+ * you can:
+ * install many versions of ruby.
+ * switch and a manage them.
+ * gemsets.
+ * ruby per project.
+ * more...
+ * you have a GUI for Mac: http://unfiniti.com/software/mac/jewelrybox/
+ * it's a beast: redefines some shell functions (like `cd`).
+ * needs to install extra packages to install the ruby versions, instead of using the packages in the system.
+
+## rbenv
+ * same principles as RVM: manage and control ruby versions.
+ * does not install it, only manages.
+ * configurable via plugins:
+ * install: with ruby-build
+ * gemsets
+ * it is easier.
+ * more UNIX.
+ * faster
+ * i have no errors since i started using it
+
+# gem
+ * part of the ruby interpreter.
+ * package system for ruby.
+ * share and install all kind of libs.
+ * "A gem is a packaged Ruby application or library. It has a name (e.g. rake) and a version (e.g. 0.4.16)"
+ * if you use a manager, each versions install its own gems.
+ * basic gems: bundler and rake.
+ * config file.
+
+# irb
+ * part of the ruby interpreter.
+ * quick and easy way to execute ruby code.
+ * useful for testing.
+ * example
+
+# bundler
+## the basic.
+ * it is a gem.
+ * manage all the dependencies of your app.
+ * resolves the "dependency hell".
+ * two key files:
+ * Gemfile: declare all the needed gems.
+ * Gemfile.lock: bundle sets all the versions and dependencies.
+ * install and update gems
+ * add all the gems in the Gemfile available in the load path
+## tips and tricks
+ * use groups.
+ * use --path
+ * use bin
+ * example
+
+# rake
+ * it is a gem.
+ * the `make` of ruby.
+ * de facto system to create small tasks.
+ * has its own DSL.
+ * example.
+
+# rails?
+ * something about rails cli.
+ * something about rails libs.
+
+# mini app with sinatra
+ * hello world?

0 comments on commit 350b11c

Please sign in to comment.