rambo 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +70 -0
  2. data/bin/rambo +71 -0
  3. data/lib/rambo/env.rb +1 -1
  4. metadata +18 -9
  5. data/README +0 -32
@@ -0,0 +1,70 @@
1
+ Rambo - The alternative web framework for Ruby
2
+ ==============================================
3
+
4
+ Installation
5
+ ------------
6
+
7
+ To install the gem:
8
+
9
+ sudo gem install rambo
10
+
11
+ Hello World Example
12
+ -------------------
13
+
14
+ Smallest example, create a file called HomeController.rb with:
15
+
16
+ class HomeController < Rambo::Controller
17
+ def index
18
+ "hello world"
19
+ end
20
+ end
21
+
22
+ Now create a config.ru file to tell rack how to run the application eg:
23
+
24
+ #!/usr/bin/env ruby
25
+
26
+ require 'rubygems'
27
+ require 'rambo'
28
+
29
+ app = Rambo::Server.new
30
+
31
+ run app
32
+
33
+ Now you can run it with your favourite rack-based server, eg:
34
+
35
+ thin start -R config.ru
36
+
37
+ Creating a new application
38
+ --------------------------
39
+
40
+ Use the rambo executable to create a new skeleton application:
41
+
42
+ rambo blog
43
+
44
+ This should generate the minimal skeleton like this:
45
+
46
+ Generating application blog ...
47
+ creating blog/
48
+ creating blog/controller/BlogController.rb
49
+ creating blog/rambo.yml
50
+ creating blog/config.ru
51
+
52
+ Run the example using:
53
+
54
+ rackup
55
+
56
+ Head over to:
57
+
58
+ http://localhost:9292/
59
+
60
+ Features
61
+ --------
62
+
63
+ * No Ruby object base class modifications
64
+ * Lightweight and fast
65
+ * Rack-based so works with most web servers (thin, mongrel, passenger)
66
+ * Web applications can be deployed to Heroku
67
+ * fast static file serving
68
+ * Template agnostic
69
+ * Database agnostic
70
+ * Library only 60k
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/ruby
2
+
3
+ app_name = ARGV[0]
4
+
5
+ unless app_name
6
+ puts "usage: rambo <application_name>"
7
+ exit(0)
8
+ end
9
+
10
+ if File.exist?(app_name)
11
+ puts "folder with name #{app_name} already exists, exiting."
12
+ exit(0)
13
+ end
14
+
15
+ puts "Generating application #{app_name} ..."
16
+
17
+ puts "creating #{app_name}/"
18
+ Dir.mkdir(app_name)
19
+ Dir.mkdir("#{app_name}/view")
20
+ Dir.mkdir("#{app_name}/controller")
21
+
22
+ default_controller = "#{app_name.downcase.gsub(/^[a-z]|\s+[a-z]/) { |a| a.upcase }}Controller"
23
+ puts "creating #{app_name}/controller/#{default_controller}.rb"
24
+
25
+ controller_content =<<EOF
26
+ class #{default_controller} < Rambo::Controller
27
+ def index
28
+ @message = "Response from #{default_controller}#index"
29
+ erb :index
30
+ end
31
+
32
+ def ping
33
+ "pong"
34
+ end
35
+ end
36
+ EOF
37
+
38
+ File.open("#{app_name}/controller/#{default_controller}.rb", 'w') { |f| f.write(controller_content) }
39
+
40
+ puts "creating #{app_name}/view/index.erb"
41
+
42
+ view_content =<<EOF
43
+ <h3><%= @message %></h3>
44
+ EOF
45
+
46
+ File.open("#{app_name}/view/index.erb", 'w') { |f| f.write(view_content) }
47
+
48
+ puts "creating #{app_name}/view/layout.erb"
49
+
50
+ layout_content =<<EOF
51
+ <h1>Rambo Application: #{app_name}</h1>
52
+ <%= yield %>
53
+ EOF
54
+
55
+ File.open("#{app_name}/view/layout.erb", 'w') { |f| f.write(layout_content) }
56
+
57
+ puts "creating #{app_name}/rambo.yml"
58
+
59
+ config_content =<<EOF
60
+ rambo:
61
+ default_controller: #{app_name}
62
+ reload_classes: true
63
+ EOF
64
+
65
+ File.open("#{app_name}/rambo.yml", 'w') { |f| f.write(config_content) }
66
+
67
+ puts "creating #{app_name}/config.ru"
68
+
69
+ rack_config = "require 'rubygems'\nrequire 'rambo'\napp=Rambo::Server.new\nrun app\n"
70
+
71
+ File.open("#{app_name}/config.ru", 'w') { |f| f.write(rack_config) }
@@ -4,7 +4,7 @@
4
4
  module Rambo
5
5
  class Env
6
6
  def self.config
7
- @@config ||= YAML.load_file("config.yml") rescue nil
7
+ @@config ||= YAML.load_file("rambo.yml") rescue nil
8
8
  @@config ||= {}
9
9
  end
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rambo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Taylor
@@ -11,18 +11,27 @@ cert_chain: []
11
11
 
12
12
  date: 2009-12-30 00:00:00 +00:00
13
13
  default_executable:
14
- dependencies: []
15
-
16
- description: rambo is an experimental ruby web framework
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rack
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.1
24
+ version:
25
+ description: rambo is an alternative web framework for ruby
17
26
  email: moomerman@gmail.com
18
- executables: []
19
-
27
+ executables:
28
+ - rambo
20
29
  extensions: []
21
30
 
22
31
  extra_rdoc_files: []
23
32
 
24
33
  files:
25
- - README
34
+ - README.md
26
35
  - lib/rambo.rb
27
36
  - lib/rambo/application_context.rb
28
37
  - lib/rambo/application_request.rb
@@ -67,7 +76,7 @@ requirements: []
67
76
  rubyforge_project: rambo
68
77
  rubygems_version: 1.3.5
69
78
  signing_key:
70
- specification_version: 3
71
- summary: rambo is an experimental ruby web framework based on rack
79
+ specification_version: 2
80
+ summary: rambo is an alternative web framework for ruby based on rack
72
81
  test_files: []
73
82
 
data/README DELETED
@@ -1,32 +0,0 @@
1
- To install the gem:
2
-
3
- gem sources -a http://gems.github.com
4
- sudo gem install moomerman-rambo
5
-
6
- Smallest example (see the hello app in the example folder)
7
-
8
- class HomeController < Rambo::Controller
9
- def index
10
- "hello world"
11
- end
12
- end
13
-
14
- To run the Blog example:
15
-
16
- git clone git://github.com/moomerman/rambo.git
17
- cd rambo/example/blog/
18
- rake db:setup # check config.yml for your specific db settings
19
- rake server
20
-
21
- head over to http://localhost:4000/
22
-
23
- Features:
24
- = No Ruby object base class modifications
25
- = Lightweight and fast
26
- = Rack-based so works with most web servers (thin, mongrel, passenger)
27
- = Ability to proxy request to n backend app servers [experimental]
28
- = Request caching built in
29
- = fast static file serving
30
- = works with erb or haml templates (more to come)
31
- = DataMapper integration
32
- = Library only 60k