corrupt 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -4,7 +4,12 @@ Bare-bones Rack based MVC framework.
4
4
 
5
5
  So many buzz-words, it could kill a baby seal.
6
6
 
7
- == Getting Started
7
+ === Code
8
+
9
+ * Github: http://github.com/Oshuma/corrupt.rack
10
+ * Rubyforge: http://rubyforge.org/projects/corrupt
11
+
12
+ === Getting Started
8
13
 
9
14
  If you haven't already:
10
15
 
@@ -3,10 +3,8 @@ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
3
3
  # Dependencies.
4
4
  begin
5
5
  require 'dm-core'
6
- require 'dm-timestamps'
7
6
  require 'haml'
8
7
  require 'logger'
9
- require 'maruku' # TODO: Might get removed.
10
8
  require 'singleton'
11
9
  require 'sqlite3'
12
10
  require 'yaml'
@@ -28,14 +26,14 @@ require 'corrupt/generators'
28
26
  require 'corrupt/framework/controller'
29
27
 
30
28
  module Corrupt
31
- VERSION = '0.3.5'
29
+ VERSION = '0.3.6'
32
30
 
33
- # Setup the Corrupt environment.
31
+ # Setup the Corrupt environment. This just calls Corrupt::System.boot!
34
32
  def self.boot!
35
33
  Corrupt::System.boot!
36
34
  end
37
35
 
38
- # Output a version string.
36
+ # Output the Corrupt version string.
39
37
  def self.to_version
40
38
  "Corrupt v#{VERSION}"
41
39
  end
@@ -3,6 +3,8 @@ module Corrupt
3
3
  # This is the main Rack app, which is ran through
4
4
  # run Corrupt::App
5
5
  class App
6
+ # Returns a proper Rack response in the form of:
7
+ # [status, headers, content]
6
8
  def self.call(env)
7
9
  Router.dispatch(env['PATH_INFO'])
8
10
  end
@@ -1,6 +1,7 @@
1
1
  module Corrupt
2
2
  autoload :ClientHelpers, 'corrupt/client/helpers'
3
3
 
4
+ # The Corrupt command-line Client.
4
5
  class Client
5
6
  include ClientHelpers
6
7
 
@@ -9,10 +10,12 @@ module Corrupt
9
10
  @options = {}
10
11
  end
11
12
 
13
+ # Class wrapper to the instance method Corrupt::Client#run.
12
14
  def self.run
13
15
  new.run
14
16
  end
15
17
 
18
+ # Handles ARGV input from the client.
16
19
  def run
17
20
  input = OptionParser.new do |opts|
18
21
  opts.banner = "Usage: #{File.basename($0)} [options]"
@@ -1,4 +1,5 @@
1
1
  module Corrupt
2
+ # A few helpful methods, mainly used in the command-line Client.
2
3
  module ClientHelpers
3
4
 
4
5
  # Output an error message to +stream+ (defaults to $stderr).
@@ -13,6 +14,8 @@ module Corrupt
13
14
  opts[:stream].send(opts[:method], string)
14
15
  end
15
16
 
17
+ # After Corrupt::Client#run has setup <tt>@options</tt>, this method
18
+ # determines what action to take.
16
19
  def take_action!
17
20
  Corrupt::Generators::App.new(@options[:path]) if @options[:path]
18
21
  end
@@ -24,13 +24,15 @@ module Corrupt
24
24
  # Return the full Rack response in this format:
25
25
  # [status, headers, content]
26
26
  # An optional +status+ may be passed; defaults to 200.
27
+ #
28
+ # An optional block may be passed, which will yield a Corrupt::Template object.
27
29
  def return_response(status = 200)
28
30
  yield template if block_given?
29
31
  self.content = template.render
30
32
  [status, headers, content]
31
33
  end
32
34
 
33
- # Set the template to be rendered.
35
+ # Set the template file to be rendered.
34
36
  def template(file = nil)
35
37
  @template ||= Corrupt::Template.new(file)
36
38
  end
@@ -1,7 +1,7 @@
1
1
  module Corrupt
2
2
  module Generators
3
- # autoload :Fileutils, 'fileutils'
4
3
 
4
+ # Generator to create a new Corrupt application.
5
5
  class App
6
6
 
7
7
  # A list of directories to create when making a new application.
@@ -3,6 +3,10 @@ module Corrupt
3
3
  # Handles URL dispatching for the application.
4
4
  # Routes are stored in a class variable, accessible by Router.routes.
5
5
  class Router
6
+ # The Router is normally used like this:
7
+ # Corrupt::Router.new do |route|
8
+ # route.map '/path', :controller => 'Kickass', :action => 'take_names'
9
+ # end
6
10
  def initialize(&block)
7
11
  @@routes = []
8
12
  yield self if block_given?
@@ -1,7 +1,8 @@
1
1
  module Corrupt
2
2
 
3
+ # This class is responsible for setting view variables and rendering a template file.
3
4
  class Template
4
- # TODO: Maybe parameterize the layout option?
5
+ # TODO: Maybe add a layout option?
5
6
  def initialize(file)
6
7
  # FIXME: This is rather ugly; maybe raise a 'view not found' exception?
7
8
  if file
@@ -14,6 +15,8 @@ module Corrupt
14
15
  @variables = {}
15
16
  end
16
17
 
18
+ # This captures any key/value pair called on the Template object
19
+ # and saves them for later use in the rendered template file.
17
20
  def method_missing(name, *args)
18
21
  # Trip the trailing '='
19
22
  name = name.to_s.gsub!(/[=]$/, '')
@@ -22,6 +25,8 @@ module Corrupt
22
25
 
23
26
  # Renders the file with any variables and returns an HTML string.
24
27
  # Wraps the file inside of the layout.
28
+ #
29
+ # Currently only supports Haml templates.
25
30
  def render
26
31
  wrap = Haml::Engine.new(File.read(@layout))
27
32
  wrap.render do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: corrupt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Campbell
@@ -9,10 +9,29 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-17 00:00:00 -05:00
13
- default_executable:
14
- dependencies: []
15
-
12
+ date: 2009-04-18 00:00:00 -05:00
13
+ default_executable: corrupt
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: dm-core
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.11
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: haml
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.0.9
34
+ version:
16
35
  description: No nonsense Rack-based framework.
17
36
  email:
18
37
  - dale@save-state.net
@@ -20,8 +39,8 @@ executables:
20
39
  - corrupt
21
40
  extensions: []
22
41
 
23
- extra_rdoc_files: []
24
-
42
+ extra_rdoc_files:
43
+ - README
25
44
  files:
26
45
  - Rakefile
27
46
  - README
@@ -71,13 +90,18 @@ files:
71
90
  - tasks/notes.rake
72
91
  - tasks/spec.rake
73
92
  - tasks/util.rake
74
- has_rdoc: false
75
- homepage: http://corrupt.save-state.net/
93
+ has_rdoc: true
94
+ homepage: http://github.com/Oshuma/corrupt.rack/
76
95
  licenses: []
77
96
 
78
97
  post_install_message:
79
- rdoc_options: []
80
-
98
+ rdoc_options:
99
+ - --title
100
+ - Corrupt API
101
+ - --main
102
+ - README
103
+ - --inline-source
104
+ - --line-numbers
81
105
  require_paths:
82
106
  - lib
83
107
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -97,7 +121,7 @@ requirements: []
97
121
  rubyforge_project: corrupt
98
122
  rubygems_version: 1.3.2
99
123
  signing_key:
100
- specification_version: 3
124
+ specification_version: 2
101
125
  summary: Rack-based MVC framework.
102
126
  test_files: []
103
127