macournoyer-invisible 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +63 -0
- data/Rakefile +64 -0
- data/app_generators/flat/flat_generator.rb +40 -0
- data/app_generators/flat/templates/README +10 -0
- data/app_generators/flat/templates/app.rb +16 -0
- data/app_generators/flat/templates/rack.ru +17 -0
- data/app_generators/full/full_generator.rb +80 -0
- data/app_generators/full/templates/README +10 -0
- data/app_generators/full/templates/Rakefile +16 -0
- data/app_generators/full/templates/app.rb +7 -0
- data/app_generators/full/templates/config/boot.rb +5 -0
- data/app_generators/full/templates/config/env.rb +18 -0
- data/app_generators/full/templates/config/env/development.rb +6 -0
- data/app_generators/full/templates/config/env/production.rb +7 -0
- data/app_generators/full/templates/config/env/test.rb +1 -0
- data/app_generators/full/templates/config/rack.ru +6 -0
- data/app_generators/full/templates/gitignore +3 -0
- data/app_generators/full/templates/public/stylesheets/ie.css +16 -0
- data/app_generators/full/templates/public/stylesheets/print.css +21 -0
- data/app_generators/full/templates/public/stylesheets/screen.css +242 -0
- data/app_generators/full/templates/spec/app_spec.rb +7 -0
- data/app_generators/full/templates/spec/spec_helper.rb +14 -0
- data/app_generators/full/templates/test/app_test.rb +7 -0
- data/app_generators/full/templates/test/test_helper.rb +15 -0
- data/app_generators/full/templates/views/layout.erb +18 -0
- data/bin/invisible +18 -0
- data/invisible.gemspec +119 -0
- data/lib/invisible.rb +212 -0
- data/lib/invisible/core_ext.rb +12 -0
- data/lib/invisible/erb.rb +16 -0
- data/lib/invisible/erubis.rb +14 -0
- data/lib/invisible/haml.rb +14 -0
- data/lib/invisible/helpers.rb +5 -0
- data/lib/invisible/mock.rb +20 -0
- data/lib/invisible/reloader.rb +22 -0
- metadata +119 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
require "erubis"
|
2
|
+
|
3
|
+
class Invisible
|
4
|
+
# Evaluate the Erubis template in +file+ and returns the
|
5
|
+
# result as a string.
|
6
|
+
# Use with +render+:
|
7
|
+
#
|
8
|
+
# render erb(:muffin)
|
9
|
+
#
|
10
|
+
def erb(file)
|
11
|
+
path = File.join(@root, "views", file.to_s)
|
12
|
+
Erubis::Eruby.load_file("#{path}.erb").result(binding)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "haml"
|
2
|
+
|
3
|
+
class Invisible
|
4
|
+
# Evaluate the Haml template in +file+ and returns the
|
5
|
+
# result as a string.
|
6
|
+
# Use with +render+:
|
7
|
+
#
|
8
|
+
# render haml(:muffin)
|
9
|
+
#
|
10
|
+
def haml(file)
|
11
|
+
path = File.join(@root, "views", file.to_s)
|
12
|
+
Haml::Engine.new(File.read("#{path}.haml")).render(self)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Invisible
|
2
|
+
# Return a mocked request for the app.
|
3
|
+
# See: http://rack.rubyforge.org/doc/classes/Rack/MockRequest.html
|
4
|
+
def mock
|
5
|
+
@mock ||= Rack::MockRequest.new(@app)
|
6
|
+
end
|
7
|
+
|
8
|
+
# Contains methods to call each HTTP method on @app.
|
9
|
+
#
|
10
|
+
# get("/") # Will call @app.mock.get("/")
|
11
|
+
# session[:user] # Will call @app.session[:user]
|
12
|
+
#
|
13
|
+
module MockMethods
|
14
|
+
HTTP_METHODS.each { |m| module_eval "def #{m}(*a); @app.mock.#{m}(*a) end" }
|
15
|
+
|
16
|
+
# Delegate some request helpers to the app
|
17
|
+
def session; @app.session end
|
18
|
+
def params; @app.params end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Invisible
|
2
|
+
# Reloader all the code loaded using the Invisible#load method.
|
3
|
+
# Use with the Reloader middleware.
|
4
|
+
def reload!
|
5
|
+
loaded = @loaded.uniq
|
6
|
+
@loaded = []
|
7
|
+
[@actions, @with, @layouts, @views].each { |c| c.clear }
|
8
|
+
loaded.each { |f| load(f) }
|
9
|
+
end
|
10
|
+
|
11
|
+
# Middleware to reload the app on each request
|
12
|
+
class Reloader
|
13
|
+
def initialize(app, reloadable)
|
14
|
+
@app, @reloadable = app, reloadable
|
15
|
+
end
|
16
|
+
|
17
|
+
def call(env)
|
18
|
+
@reloadable.reload!
|
19
|
+
@app.call(env)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: macournoyer-invisible
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marc-Andre Cournoyer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-11-11 21:00:00 -08:00
|
13
|
+
default_executable: invisible
|
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: 0.4.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: markaby
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0.5"
|
34
|
+
version:
|
35
|
+
description: Invisible is like a giant robot combining the awesomeness of Rails, Merb, Camping and Sinatra. Except, it's tiny (100 sloc).
|
36
|
+
email: macournoyer@gmail.com
|
37
|
+
executables:
|
38
|
+
- invisible
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README
|
43
|
+
files:
|
44
|
+
- README
|
45
|
+
- Rakefile
|
46
|
+
- invisible.gemspec
|
47
|
+
- bin/invisible
|
48
|
+
- lib/invisible
|
49
|
+
- lib/invisible/core_ext.rb
|
50
|
+
- lib/invisible/erb.rb
|
51
|
+
- lib/invisible/erubis.rb
|
52
|
+
- lib/invisible/haml.rb
|
53
|
+
- lib/invisible/helpers.rb
|
54
|
+
- lib/invisible/mock.rb
|
55
|
+
- lib/invisible/reloader.rb
|
56
|
+
- lib/invisible.rb
|
57
|
+
- app_generators/flat
|
58
|
+
- app_generators/flat/flat_generator.rb
|
59
|
+
- app_generators/flat/templates
|
60
|
+
- app_generators/flat/templates/app.rb
|
61
|
+
- app_generators/flat/templates/rack.ru
|
62
|
+
- app_generators/flat/templates/README
|
63
|
+
- app_generators/full
|
64
|
+
- app_generators/full/full_generator.rb
|
65
|
+
- app_generators/full/templates
|
66
|
+
- app_generators/full/templates/app.rb
|
67
|
+
- app_generators/full/templates/config
|
68
|
+
- app_generators/full/templates/config/boot.rb
|
69
|
+
- app_generators/full/templates/config/env
|
70
|
+
- app_generators/full/templates/config/env/development.rb
|
71
|
+
- app_generators/full/templates/config/env/production.rb
|
72
|
+
- app_generators/full/templates/config/env/test.rb
|
73
|
+
- app_generators/full/templates/config/env.rb
|
74
|
+
- app_generators/full/templates/config/rack.ru
|
75
|
+
- app_generators/full/templates/gitignore
|
76
|
+
- app_generators/full/templates/public
|
77
|
+
- app_generators/full/templates/public/stylesheets
|
78
|
+
- app_generators/full/templates/public/stylesheets/ie.css
|
79
|
+
- app_generators/full/templates/public/stylesheets/print.css
|
80
|
+
- app_generators/full/templates/public/stylesheets/screen.css
|
81
|
+
- app_generators/full/templates/Rakefile
|
82
|
+
- app_generators/full/templates/README
|
83
|
+
- app_generators/full/templates/spec
|
84
|
+
- app_generators/full/templates/spec/app_spec.rb
|
85
|
+
- app_generators/full/templates/spec/spec_helper.rb
|
86
|
+
- app_generators/full/templates/test
|
87
|
+
- app_generators/full/templates/test/app_test.rb
|
88
|
+
- app_generators/full/templates/test/test_helper.rb
|
89
|
+
- app_generators/full/templates/views
|
90
|
+
- app_generators/full/templates/views/layout.erb
|
91
|
+
has_rdoc: true
|
92
|
+
homepage: http://github.com/macournoyer/invisible
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options:
|
95
|
+
- --main
|
96
|
+
- README
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: "0"
|
104
|
+
version:
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: "0"
|
110
|
+
version:
|
111
|
+
requirements: []
|
112
|
+
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 1.2.0
|
115
|
+
signing_key:
|
116
|
+
specification_version: 2
|
117
|
+
summary: The Invisible Web Framework
|
118
|
+
test_files: []
|
119
|
+
|