renee-core 0.2.0 → 0.3.0
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.md +5 -5
- data/lib/renee_core.rb +91 -0
- data/lib/renee_core/chaining.rb +71 -0
- data/lib/renee_core/env_accessors.rb +72 -0
- data/lib/{renee-core → renee_core}/exceptions.rb +1 -1
- data/lib/{renee-core → renee_core}/matcher.rb +1 -1
- data/lib/renee_core/rack_interaction.rb +50 -0
- data/lib/renee_core/request_context.rb +25 -0
- data/lib/renee_core/responding.rb +110 -0
- data/lib/{renee-core → renee_core}/response.rb +2 -2
- data/lib/renee_core/routing.rb +322 -0
- data/lib/renee_core/transform.rb +18 -0
- data/lib/{renee-core → renee_core}/url_generation.rb +3 -3
- data/lib/renee_core/version.rb +6 -0
- data/renee-core.gemspec +1 -1
- data/test/env_accessors_test.rb +43 -0
- data/test/include_test.rb +1 -1
- data/test/responding_test.rb +1 -1
- data/test/routing_test.rb +5 -5
- data/test/test_helper.rb +1 -1
- data/test/url_generation_test.rb +8 -8
- metadata +19 -18
- data/lib/renee-core.rb +0 -78
- data/lib/renee-core/application.rb +0 -32
- data/lib/renee-core/application/chaining.rb +0 -73
- data/lib/renee-core/application/rack_interaction.rb +0 -45
- data/lib/renee-core/application/request_context.rb +0 -29
- data/lib/renee-core/application/responding.rb +0 -112
- data/lib/renee-core/application/routing.rb +0 -319
- data/lib/renee-core/application/transform.rb +0 -20
- data/lib/renee-core/settings.rb +0 -63
- data/lib/renee-core/version.rb +0 -6
data/lib/renee-core/settings.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
class Renee
|
2
|
-
class Core
|
3
|
-
##
|
4
|
-
# Stores configuration settings for a particular Renee application.
|
5
|
-
# Powers the Renee setup block which is instance eval'ed into this object.
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# Renee::Core.new { ... }.setup { views_path "./views" }
|
9
|
-
#
|
10
|
-
class Settings
|
11
|
-
attr_reader :includes, :variable_types
|
12
|
-
def initialize
|
13
|
-
@includes = []
|
14
|
-
@variable_types = {}
|
15
|
-
@encoding = 'utf-8'
|
16
|
-
register_variable_type :integer, IntegerMatcher
|
17
|
-
register_variable_type :int, :integer
|
18
|
-
end
|
19
|
-
|
20
|
-
# Gets or sets the views_path for an application.
|
21
|
-
#
|
22
|
-
# @param [String] path The path to the view files.
|
23
|
-
#
|
24
|
-
# @example
|
25
|
-
# views_path("./views") => nil
|
26
|
-
# views_path => "./views"
|
27
|
-
#
|
28
|
-
# @api public
|
29
|
-
def views_path(path = nil)
|
30
|
-
path ? @views_path = path : @views_path
|
31
|
-
end
|
32
|
-
|
33
|
-
# Gets or sets the default encoding used.
|
34
|
-
#
|
35
|
-
# @param [String] encoding The encoding to use. e.g. "utf-8"
|
36
|
-
def default_encoding(encoding = nil)
|
37
|
-
encoding ? @encoding = encoding : @encoding
|
38
|
-
end
|
39
|
-
|
40
|
-
# Module(s) to include into the base application.
|
41
|
-
#
|
42
|
-
# @param [Module] mods Modules to include.
|
43
|
-
def include(*mods)
|
44
|
-
mods.each { |mod| includes << mod }
|
45
|
-
end
|
46
|
-
|
47
|
-
# Registers a new variable type for use within {Renee::Application::Routing#variable} and others.
|
48
|
-
# @param [Symbol] name The name of the variable.
|
49
|
-
# @param [Regexp] matcher A regexp describing what part of an arbitrary string to capture.
|
50
|
-
# @return [Renee::Core::Matcher] A matcher
|
51
|
-
def register_variable_type(name, matcher)
|
52
|
-
matcher = case matcher
|
53
|
-
when Matcher then matcher
|
54
|
-
when Array then Matcher.new(matcher.map{|m| @variable_types[m]})
|
55
|
-
when Symbol then @variable_types[matcher]
|
56
|
-
else Matcher.new(matcher)
|
57
|
-
end
|
58
|
-
matcher.name = name
|
59
|
-
@variable_types[name] = matcher
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|