waw 0.3.0 → 0.3.1
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/{test/spec/fixtures/empty/waw.deploy → .gemtest} +0 -0
- data/CHANGELOG.md +85 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +37 -0
- data/{LICENCE.rdoc → LICENCE.md} +2 -2
- data/Manifest.txt +19 -0
- data/{README.rdoc → README.md} +11 -9
- data/Rakefile +23 -0
- data/lib/waw.rb +3 -10
- data/lib/waw/controllers/action_controller.rb +7 -2
- data/lib/waw/controllers/static/matcher.rb +77 -8
- data/lib/waw/controllers/static/waw_access.rb +2 -2
- data/lib/waw/loader.rb +3 -0
- data/lib/waw/version.rb +14 -0
- data/{test/spec → spec}/assumptions_spec.rb +1 -0
- data/{test/spec → spec}/controllers/action_controller_spec.rb +1 -1
- data/{test/spec → spec}/controllers/static/waw_access_spec.rb +1 -2
- data/{test/spec → spec}/environment_utils_spec.rb +1 -1
- data/{test/spec → spec}/ext/core/hash_spec.rb +1 -0
- data/{test/spec → spec}/fixtures.rb +0 -0
- data/{test/spec → spec}/fixtures/action/config/default.cfg +0 -0
- data/{test/spec → spec}/fixtures/action/lib/action_controller_test.rb +1 -1
- data/{test/spec → spec}/fixtures/action/waw.deploy +0 -0
- data/{test/spec → spec}/fixtures/action/waw.routing +0 -0
- data/{test/spec/fixtures/empty/waw.routing → spec/fixtures/empty/waw.deploy} +0 -0
- data/spec/fixtures/empty/waw.routing +0 -0
- data/{test/spec → spec}/fullstate/on_class_spec.rb +1 -1
- data/{test/spec → spec}/fullstate/on_instance_spec.rb +1 -1
- data/{test/spec → spec}/fullstate/session_spec.rb +1 -1
- data/{test/spec → spec}/fullstate/variable_spec.rb +1 -1
- data/{test/spec → spec}/resource_collection_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -0
- data/{test/spec → spec}/tools/mail/mail_agent_spec.rb +1 -1
- data/{test/spec → spec}/tools/mail/mail_spec.rb +1 -1
- data/{test/spec → spec}/tools/mail/mailbox_spec.rb +1 -1
- data/{test/spec → spec}/tools/mail/template_spec.rb +1 -1
- data/{test/spec → spec}/validation/array_validation_spec.rb +1 -1
- data/{test/spec → spec}/validation/array_validator_spec.rb +1 -1
- data/{test/spec → spec}/validation/date_validation_spec.rb +1 -1
- data/{test/spec → spec}/validation/datetime_validation_spec.rb +1 -0
- data/{test/spec → spec}/validation/default_validation_spec.rb +1 -1
- data/{test/spec → spec}/validation/disjuctive_validation_spec.rb +1 -1
- data/{test/spec → spec}/validation/errors_spec.rb +1 -1
- data/{test/spec → spec}/validation/file_validator_spec.rb +1 -1
- data/{test/spec → spec}/validation/mail_validation_spec.rb +1 -1
- data/{test/spec → spec}/validation/missing_validation_spec.rb +1 -1
- data/{test/spec → spec}/validation/same_validation_spec.rb +1 -1
- data/{test/spec → spec}/validation/signature_intuition_spec.rb +1 -1
- data/{test/spec → spec}/validation/signature_spec.rb +1 -2
- data/{test/spec → spec}/validation/validation_spec.rb +1 -2
- data/spec/waw_spec.rb +8 -0
- data/{test/spec → spec}/wspec/html_analysis/tag_spec.rb +1 -1
- data/{test/spec → spec}/wspec/html_analysis_spec.rb +1 -1
- data/tasks/debug_mail.rake +78 -0
- data/tasks/debug_mail.txt +13 -0
- data/tasks/gem.rake +68 -0
- data/tasks/oldies.rake +22 -0
- data/tasks/spec_test.rake +79 -0
- data/tasks/unit_test.rake +77 -0
- data/tasks/yard.rake +51 -0
- data/test/bricks/action_controller/config/test.cfg +3 -0
- data/test/bricks/action_controller/logs/webapp.log +489 -0
- data/test/bricks/action_controller/logs/webapp.log.20110122 +84 -0
- data/test/bricks/action_controller/test/action_controller.wspec +6 -0
- data/test/bricks/action_controller/test/test_all.rb +20 -0
- data/test/bricks/action_controller/waw.deploy +1 -0
- data/test/bricks/action_controller/waw.routing +15 -0
- data/test/bricks/static_controller/logs/webapp.log +193 -50
- data/test/bricks/static_controller/logs/webapp.log.20110122 +84 -0
- data/test/bricks/static_controller/test/static_controller.wspec +17 -5
- data/waw.gemspec +191 -0
- data/waw.noespec +59 -0
- metadata +332 -90
- data/test/spec/test_all.rb +0 -7
File without changes
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# Version 0.3.1
|
2
|
+
|
3
|
+
* Major enhancements
|
4
|
+
|
5
|
+
* Added &, | and negate on wawaccess's Matchers
|
6
|
+
* Fixed #447: user-friendly message when params is forgotten in action method signature
|
7
|
+
* Cleaned the gemspec to include official dependencies
|
8
|
+
|
9
|
+
* On the devel side
|
10
|
+
|
11
|
+
* Bumped to ruby.noe 1.3.0
|
12
|
+
* Spec tests moved under spec/ instead of test/spec
|
13
|
+
* Removed the vendor library, as all dependencies are official gems
|
14
|
+
|
15
|
+
# Version 0.3.0
|
16
|
+
|
17
|
+
* Added a Matcher class in StaticController, and matcher dsl rule in .wawaccess
|
18
|
+
* Modified some WawAccess API (env is passed instead of path at different places)
|
19
|
+
* Kernel application has been extended to support internal requests
|
20
|
+
* A DateTimeValidator has been added to the validation framework
|
21
|
+
* Waw::ActionController::JSGeneration becomes a controller. This allows setting
|
22
|
+
configuration variable 'code_at_startup' to false (no code generated as a file
|
23
|
+
at all) and including generated javascript as follows:
|
24
|
+
|
25
|
+
waw.routing
|
26
|
+
map '/webservices.js' do
|
27
|
+
run ::Waw::ActionController::JSGeneration.new
|
28
|
+
end
|
29
|
+
|
30
|
+
layout.wtpl
|
31
|
+
<script type="text/javascript" src="/webservices.js"></script>
|
32
|
+
|
33
|
+
* Set Rack version to 1.2.1
|
34
|
+
* Fixed a bug with waw-profile when encountering relative links.
|
35
|
+
* Moved to rspec 2.4.0
|
36
|
+
|
37
|
+
# Version 0.2.1
|
38
|
+
|
39
|
+
* Layouts have been cleaned. The empty layout is less complete than before
|
40
|
+
* Layouts force the waw version that is loaded by config.ru to a version greater
|
41
|
+
than the one that created the layout.
|
42
|
+
* Bug/Feature #260 related to inclusion of ::Waw::Validation has been implemented
|
43
|
+
* Bug/Feature #261 related to self referencing resource files has been implemented.
|
44
|
+
* Features #305 and #306 related to default validators and validators taking blocks
|
45
|
+
have been implemented.
|
46
|
+
|
47
|
+
# Version 0.2.0
|
48
|
+
|
49
|
+
## Broken features and APIs (by order of importance)
|
50
|
+
|
51
|
+
* Major changes due to wlang version 0.9.0 (see Changelog there). Waw 0.2.0 verifies
|
52
|
+
that a wlang gem >= 0.9.0 is installed in rubygems.
|
53
|
+
* The 'using self' syntax is deprecated in .wtpl files. Equivalence can be obtained
|
54
|
+
trough 'share all' (see also auto-waw-scoping later)
|
55
|
+
|
56
|
+
## New features
|
57
|
+
|
58
|
+
* All methods in Waw::ScopeUtils are automatically present in all wlang scopes as
|
59
|
+
low priority variables (aka auto-waw-scoping)
|
60
|
+
* wlang executable ensures that it executes the current version
|
61
|
+
* 'waw create' applies WLang::encode(upper_name, 'ruby/method-case') for computing
|
62
|
+
the lower project name.
|
63
|
+
|
64
|
+
## Bugfixes
|
65
|
+
|
66
|
+
* bug #290: Rack >= 1.1.0 is verified through rubygems
|
67
|
+
* feature #259: CSS and JS files are sorted by names when put in css_files and js_files wlang
|
68
|
+
variables
|
69
|
+
|
70
|
+
# Version 0.1.3
|
71
|
+
|
72
|
+
## Broken features and APIs (by order of importance)
|
73
|
+
|
74
|
+
* wawspec become wspec, all old invocations and assertions have been removed
|
75
|
+
* 'scenario' and 'because' in wspec are considered deprecated (but can still be used).
|
76
|
+
They are replaced by 'requirement' and 'therefore'
|
77
|
+
|
78
|
+
## New features
|
79
|
+
|
80
|
+
* A mail agent has been added in tools. It expects a smtp_config variable in Waw.config.
|
81
|
+
This agent really send mails in 'production' and 'acceptation' deployment modes. In
|
82
|
+
'devel' and 'test' modes, it simply put mails in internal mailboxes accessible through
|
83
|
+
accessors (see ::Waw::Tools::MailAgent)
|
84
|
+
* validation architecture has been consolidated and is well tested
|
85
|
+
* wawaccess files refactored and consolidated.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
waw (0.3.1)
|
5
|
+
json (>= 1.1.9)
|
6
|
+
rack (~> 1.2.1)
|
7
|
+
wlang (~> 0.10.1)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
bluecloth (2.0.9)
|
13
|
+
diff-lcs (1.1.2)
|
14
|
+
json (1.5.1)
|
15
|
+
rack (1.2.1)
|
16
|
+
rake (0.8.7)
|
17
|
+
rspec (2.4.0)
|
18
|
+
rspec-core (~> 2.4.0)
|
19
|
+
rspec-expectations (~> 2.4.0)
|
20
|
+
rspec-mocks (~> 2.4.0)
|
21
|
+
rspec-core (2.4.0)
|
22
|
+
rspec-expectations (2.4.0)
|
23
|
+
diff-lcs (~> 1.1.2)
|
24
|
+
rspec-mocks (2.4.0)
|
25
|
+
wlang (0.10.1)
|
26
|
+
yard (0.6.4)
|
27
|
+
|
28
|
+
PLATFORMS
|
29
|
+
ruby
|
30
|
+
|
31
|
+
DEPENDENCIES
|
32
|
+
bluecloth (~> 2.0.9)
|
33
|
+
bundler (~> 1.0)
|
34
|
+
rake (~> 0.8.7)
|
35
|
+
rspec (~> 2.4.0)
|
36
|
+
waw!
|
37
|
+
yard (~> 0.6.4)
|
data/{LICENCE.rdoc → LICENCE.md}
RENAMED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
# Licence
|
2
2
|
|
3
3
|
The MIT License
|
4
4
|
|
5
|
-
Copyright (c) 2009 Bernard & Louis Lambeau and the University of Louvain
|
5
|
+
Copyright (c) 2009-2011 Bernard & Louis Lambeau and the University of Louvain
|
6
6
|
(Universite Catholique de Louvain, Louvain-la-Neuve, Belgium)
|
7
7
|
|
8
8
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
data/Manifest.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
.gemtest
|
2
|
+
bin/**/*
|
3
|
+
CHANGELOG.md
|
4
|
+
Gemfile
|
5
|
+
Gemfile.lock
|
6
|
+
layouts/**/*
|
7
|
+
layouts/static/public/.wawaccess
|
8
|
+
layouts/static/public/pages/.wawaccess
|
9
|
+
layouts/static/public/templates/.wawaccess
|
10
|
+
lib/**/*
|
11
|
+
LICENCE.md
|
12
|
+
Manifest.txt
|
13
|
+
Rakefile
|
14
|
+
README.md
|
15
|
+
spec/**/*
|
16
|
+
tasks/**/*
|
17
|
+
test/**/*
|
18
|
+
waw.gemspec
|
19
|
+
waw.noespec
|
data/{README.rdoc → README.md}
RENAMED
@@ -1,10 +1,18 @@
|
|
1
|
-
|
1
|
+
# Waw, making web applications simple
|
2
2
|
|
3
3
|
Waw is a web framework written in Ruby. It provides an alternative to Rails and other frameworks
|
4
4
|
written in Ruby as well. It is designed to be somewhere in the middle between Rails (sometimes a
|
5
|
-
bit too heavy) and Rack (not really a framework, sometimes too low-level).
|
5
|
+
bit too heavy) and Rack/Sinatra (not really a framework, sometimes too low-level).
|
6
6
|
|
7
|
-
|
7
|
+
Waw has been originally designed in the ReQuest research project of the University of Louvain, has
|
8
|
+
been entirely rewritten in ruby, and is still actively developped to reach its first real stable
|
9
|
+
version ;-)
|
10
|
+
|
11
|
+
## Links
|
12
|
+
|
13
|
+
http://github.com/blambeau/waw
|
14
|
+
|
15
|
+
## Main features
|
8
16
|
|
9
17
|
Waw basically provides an overall architecture for web sites and/or applications. Its main
|
10
18
|
features are
|
@@ -23,10 +31,4 @@ features are
|
|
23
31
|
- When things become too restrictive for you (you don't fit the architecture exactly) you can
|
24
32
|
access lower stages ... edit the underlying Rack configuration and install your own services
|
25
33
|
in a few minutes, bypassing waw when needed!
|
26
|
-
|
27
|
-
== Dependencies
|
28
|
-
|
29
|
-
Waw requires the following ruby gems
|
30
34
|
|
31
|
-
- rack >= 1.1.0 (provided through <code>gem install rack</code>)
|
32
|
-
- wlang >= 0.9.0 (provided in the vendors folder)
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
begin
|
2
|
+
gem "bundler", "~> 1.0"
|
3
|
+
require "bundler/setup"
|
4
|
+
rescue LoadError => ex
|
5
|
+
puts ex.message
|
6
|
+
abort "Bundler failed to load, (did you run 'gem install bundler' ?)"
|
7
|
+
end
|
8
|
+
|
9
|
+
# Dynamically load the gem spec
|
10
|
+
$gemspec_file = File.expand_path('../waw.gemspec', __FILE__)
|
11
|
+
$gemspec = Kernel.eval(File.read($gemspec_file))
|
12
|
+
|
13
|
+
# We run tests by default
|
14
|
+
task :default => :test
|
15
|
+
|
16
|
+
#
|
17
|
+
# Install all tasks found in tasks folder
|
18
|
+
#
|
19
|
+
# See .rake files there for complete documentation.
|
20
|
+
#
|
21
|
+
Dir["tasks/*.rake"].each do |taskfile|
|
22
|
+
instance_eval File.read(taskfile), taskfile
|
23
|
+
end
|
data/lib/waw.rb
CHANGED
@@ -2,9 +2,7 @@ $waw_deprecated_io = nil
|
|
2
2
|
require 'singleton'
|
3
3
|
require 'waw/ext/core'
|
4
4
|
require 'waw/ext/rack'
|
5
|
-
|
6
|
-
# Main waw module, providing the strict micro kernel of waw loader
|
7
|
-
#
|
5
|
+
require 'waw/version'
|
8
6
|
module Waw
|
9
7
|
|
10
8
|
# Requirements on gems for this version
|
@@ -14,9 +12,6 @@ module Waw
|
|
14
12
|
:json => '>= 1.1.9'
|
15
13
|
}
|
16
14
|
|
17
|
-
# Waw version
|
18
|
-
VERSION = "0.3.0".freeze
|
19
|
-
|
20
15
|
# Waw loading mutex
|
21
16
|
WAW_KERNELS_LOCK = Mutex.new
|
22
17
|
|
@@ -74,10 +69,8 @@ end
|
|
74
69
|
|
75
70
|
# Now, make ruby requires
|
76
71
|
require 'rubygems'
|
77
|
-
Waw::GEM_REQUIREMENTS.each_pair {|name, version|
|
78
|
-
|
79
|
-
require(name.to_s)
|
80
|
-
}
|
72
|
+
Waw::GEM_REQUIREMENTS.each_pair {|name, version| gem(name.to_s, version)}
|
73
|
+
require 'waw/loader'
|
81
74
|
require 'waw/errors'
|
82
75
|
require 'waw/scope_utils'
|
83
76
|
require 'waw/ext'
|
@@ -73,8 +73,13 @@ module Waw
|
|
73
73
|
@critical = true
|
74
74
|
|
75
75
|
# Create the action instance
|
76
|
-
|
77
|
-
|
76
|
+
meth = instance_method(name)
|
77
|
+
if meth.arity != 1
|
78
|
+
raise WawError, "Action #{self}::#{name} is missing its 'params' argument"
|
79
|
+
else
|
80
|
+
action = Waw::ActionController::Action.new(name, @signature, @routing, self, meth)
|
81
|
+
actions[name] = action
|
82
|
+
end
|
78
83
|
|
79
84
|
# Installs the class method that returns the action
|
80
85
|
instance_eval <<-EOF
|
@@ -1,18 +1,13 @@
|
|
1
1
|
module Waw
|
2
2
|
class StaticController < ::Waw::Controller
|
3
|
-
class
|
3
|
+
class AbstractMatcher
|
4
4
|
include Waw::ScopeUtils
|
5
|
-
|
5
|
+
|
6
6
|
# Waw access on which this matcher is defined
|
7
7
|
attr_reader :wawaccess
|
8
8
|
|
9
|
-
|
10
|
-
attr_reader :predicate
|
11
|
-
|
12
|
-
# Creates a matcher instance
|
13
|
-
def initialize(wawaccess, predicate)
|
9
|
+
def initialize(wawaccess)
|
14
10
|
@wawaccess = wawaccess
|
15
|
-
@predicate = predicate
|
16
11
|
end
|
17
12
|
|
18
13
|
# Returns wawaccess's folder
|
@@ -25,11 +20,85 @@ module Waw
|
|
25
20
|
wawaccess.req_path
|
26
21
|
end
|
27
22
|
|
23
|
+
def &(other)
|
24
|
+
unless other.is_a?(AbstractMatcher)
|
25
|
+
raise ArgumentError, "Matcher expected for &, #{other} received"
|
26
|
+
end
|
27
|
+
AndMatcher.new(wawaccess, self, other)
|
28
|
+
end
|
29
|
+
|
30
|
+
def |(other)
|
31
|
+
unless other.is_a?(AbstractMatcher)
|
32
|
+
raise ArgumentError, "Matcher expected for |, #{other} received"
|
33
|
+
end
|
34
|
+
OrMatcher.new(wawaccess, self, other)
|
35
|
+
end
|
36
|
+
|
37
|
+
def negate
|
38
|
+
NegateMatcher.new(wawaccess, self)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
class Matcher < AbstractMatcher
|
44
|
+
|
45
|
+
# Matcher's predicate
|
46
|
+
attr_reader :predicate
|
47
|
+
|
48
|
+
# Creates a matcher instance
|
49
|
+
def initialize(wawaccess, predicate)
|
50
|
+
super(wawaccess)
|
51
|
+
@predicate = predicate
|
52
|
+
end
|
53
|
+
|
28
54
|
# Does the matcher matches a given path?
|
29
55
|
def matches?(env)
|
30
56
|
instance_eval &predicate
|
31
57
|
end
|
32
58
|
|
33
59
|
end # class Matcher
|
60
|
+
|
61
|
+
class NegateMatcher < AbstractMatcher
|
62
|
+
|
63
|
+
def initialize(wawaccess, operand)
|
64
|
+
super(wawaccess)
|
65
|
+
@operand = operand
|
66
|
+
end
|
67
|
+
|
68
|
+
# Does the matcher matches a given path?
|
69
|
+
def matches?(env)
|
70
|
+
!@operand.matches?(env)
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
class AndMatcher < AbstractMatcher
|
76
|
+
|
77
|
+
def initialize(wawaccess, left, right)
|
78
|
+
super(wawaccess)
|
79
|
+
@left, @right = left, right
|
80
|
+
end
|
81
|
+
|
82
|
+
# Does the matcher matches a given path?
|
83
|
+
def matches?(env)
|
84
|
+
@left.matches?(env) && @right.matches?(env)
|
85
|
+
end
|
86
|
+
|
87
|
+
end # class AndMatcher
|
88
|
+
|
89
|
+
class OrMatcher < AbstractMatcher
|
90
|
+
|
91
|
+
def initialize(wawaccess, left, right)
|
92
|
+
super(wawaccess)
|
93
|
+
@left, @right = left, right
|
94
|
+
end
|
95
|
+
|
96
|
+
# Does the matcher matches a given path?
|
97
|
+
def matches?(env)
|
98
|
+
@left.matches?(env) || @right.matches?(env)
|
99
|
+
end
|
100
|
+
|
101
|
+
end # class AndMatcher
|
102
|
+
|
34
103
|
end # class StaticController
|
35
104
|
end # module Waw
|
@@ -65,7 +65,7 @@ module Waw
|
|
65
65
|
|
66
66
|
def recognized_pattern?(pattern)
|
67
67
|
[FalseClass, TrueClass, String,
|
68
|
-
Regexp, Waw::Validation::Validator, StaticController::
|
68
|
+
Regexp, Waw::Validation::Validator, StaticController::AbstractMatcher].any?{|c| c===pattern}
|
69
69
|
end
|
70
70
|
|
71
71
|
# Adds a child in the hierarchy
|
@@ -190,7 +190,7 @@ module Waw
|
|
190
190
|
if pattern.validate(matching_file(path))
|
191
191
|
return Match.new(self, path, block)
|
192
192
|
end
|
193
|
-
when StaticController::
|
193
|
+
when StaticController::AbstractMatcher
|
194
194
|
if pattern.matches?(env)
|
195
195
|
return Match.new(self, path, block)
|
196
196
|
end
|
data/lib/waw/loader.rb
ADDED
data/lib/waw/version.rb
ADDED