ape 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +18 -11
- data/bin/ape_server +4 -4
- data/lib/ape/reporter.rb +5 -4
- data/lib/ape/reporters/html_reporter.rb +1 -1
- data/lib/ape/validators/service_document_validator.rb +2 -2
- data/lib/ape/version.rb +1 -1
- data/web/index.html +4 -1
- metadata +55 -68
- data/lib/ape/handler.rb +0 -39
- data/lib/ape/server.rb +0 -44
data/Rakefile
CHANGED
@@ -7,9 +7,14 @@ require 'rake/rdoctask'
|
|
7
7
|
$:.unshift File.dirname(__FILE__) + '/lib'
|
8
8
|
require 'ape'
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
ape_dependencies = {
|
11
|
+
:sinatra => '>= 0.9.4',
|
12
|
+
:erubis => '>= 2.5.0',
|
13
|
+
}
|
14
|
+
|
15
|
+
begin
|
16
|
+
require 'jeweler'
|
17
|
+
Jeweler::Tasks.new do |s|
|
13
18
|
s.name = 'ape'
|
14
19
|
s.version = Ape::VERSION::STRING
|
15
20
|
s.authors = ['Tim Bray', 'David Calavera']
|
@@ -27,12 +32,15 @@ def spec
|
|
27
32
|
|
28
33
|
s.rubyforge_project = 'ape'
|
29
34
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
s.
|
34
|
-
s.add_dependency 'mocha', '>= 0.9.0'
|
35
|
+
ape_dependencies.each do |name, version|
|
36
|
+
s.add_dependency name.to_s, version
|
37
|
+
end
|
38
|
+
s.add_development_dependency :mocha, '>= 0.9.0'
|
35
39
|
end
|
40
|
+
|
41
|
+
Jeweler::GemcutterTasks.new
|
42
|
+
rescue LoadError
|
43
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
36
44
|
end
|
37
45
|
|
38
46
|
def install_gem(*args)
|
@@ -44,9 +52,8 @@ end
|
|
44
52
|
desc 'Install the necessary dependencies'
|
45
53
|
task :setup do
|
46
54
|
installed = Gem::SourceIndex.from_installed_gems
|
47
|
-
|
48
|
-
|
49
|
-
installed.find_name(dep.name, dep.version_requirements).empty? }.each do |dep|
|
55
|
+
ape_dependencies.select { |name, version|
|
56
|
+
installed.find_name(name.to_s, version).empty? }.each do |dep|
|
50
57
|
puts "Installing #{dep} ..."
|
51
58
|
install_gem dep.name, "-v '#{dep.version_requirements.to_s}'"
|
52
59
|
end
|
data/bin/ape_server
CHANGED
@@ -4,10 +4,9 @@
|
|
4
4
|
$:.unshift File.dirname(__FILE__) + '/../lib'
|
5
5
|
|
6
6
|
require 'rubygems'
|
7
|
-
require 'mongrel'
|
8
7
|
require 'optparse'
|
9
|
-
|
10
|
-
require '
|
8
|
+
|
9
|
+
require File.dirname(__FILE__) + '/../sinatra/atom_exerciser'
|
11
10
|
|
12
11
|
OPTIONS = {
|
13
12
|
:host => '0.0.0.0',
|
@@ -25,4 +24,5 @@ parser = OptionParser.new do |opts|
|
|
25
24
|
opts.parse!(ARGV)
|
26
25
|
end
|
27
26
|
|
28
|
-
Ape
|
27
|
+
::Ape.home = OPTIONS.delete(:home)
|
28
|
+
AtomExerciser.run!(OPTIONS)
|
data/lib/ape/reporter.rb
CHANGED
@@ -4,8 +4,8 @@ module Ape
|
|
4
4
|
require File.dirname(__FILE__) + '/util.rb'
|
5
5
|
include Ape::Util
|
6
6
|
|
7
|
-
attr_accessor :header, :footer, :debug, :dialogs, :diarefs, :dianum, :server
|
8
|
-
|
7
|
+
attr_accessor :header, :footer, :debug, :dialogs, :diarefs, :dianum, :server, :options
|
8
|
+
|
9
9
|
def steps
|
10
10
|
@steps ||= []
|
11
11
|
end
|
@@ -13,8 +13,9 @@ module Ape
|
|
13
13
|
def self.instance(key, opts = {})
|
14
14
|
reporter = resolve_plugin(key, 'reporters', 'reporter')
|
15
15
|
raise StandardError, "Unknown reporter: #{key}, outputs supported: #{supported_outputs}" unless reporter
|
16
|
-
reporter.debug = opts
|
17
|
-
reporter.server = opts
|
16
|
+
reporter.debug = opts.delete(:debug) || false
|
17
|
+
reporter.server = opts.delete(:server) || false
|
18
|
+
reporter.options = opts
|
18
19
|
reporter.dialogs = {}
|
19
20
|
reporter.diarefs = {}
|
20
21
|
reporter.dianum = 1
|
@@ -6,7 +6,7 @@ module Ape
|
|
6
6
|
|
7
7
|
def validate(opts = {})
|
8
8
|
init_service_document(opts[:uri])
|
9
|
-
init_service_collections(opts[:uri])
|
9
|
+
init_service_collections(opts[:uri]) if @service_document
|
10
10
|
end
|
11
11
|
|
12
12
|
def init_service_document(uri)
|
@@ -51,4 +51,4 @@ module Ape
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
|
-
end
|
54
|
+
end
|
data/lib/ape/version.rb
CHANGED
data/web/index.html
CHANGED
@@ -40,7 +40,10 @@
|
|
40
40
|
-->
|
41
41
|
<hr/>
|
42
42
|
<p>The Ape source code may be found at
|
43
|
-
<a href="http://
|
43
|
+
<a href="http://github.com/calavera/Ape">github.com/calavera/Ape</a>. You can install a local
|
44
|
+
Ape and run it just fine; see
|
45
|
+
<a href="http://thinkincode.net/2008/2/22/the-ape-meets-ruby-gems">The Ape meets
|
46
|
+
RubyGems</a>
|
44
47
|
|
45
48
|
<hr/>
|
46
49
|
<p>Ape Logo by <a href="http://www.urbanhonking.com/ideasfordozens">Greg
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Bray
|
@@ -11,27 +11,17 @@ bindir: bin
|
|
11
11
|
cert_chain: []
|
12
12
|
|
13
13
|
date: 2009-10-27 00:00:00 +01:00
|
14
|
-
default_executable:
|
14
|
+
default_executable: ape_server
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: sinatra
|
18
18
|
type: :runtime
|
19
19
|
version_requirement:
|
20
20
|
version_requirements: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
22
|
- - ">="
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
25
|
-
version:
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: mongrel
|
28
|
-
type: :runtime
|
29
|
-
version_requirement:
|
30
|
-
version_requirements: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 1.1.3
|
24
|
+
version: 0.9.4
|
35
25
|
version:
|
36
26
|
- !ruby/object:Gem::Dependency
|
37
27
|
name: erubis
|
@@ -43,19 +33,9 @@ dependencies:
|
|
43
33
|
- !ruby/object:Gem::Version
|
44
34
|
version: 2.5.0
|
45
35
|
version:
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: rubyforge
|
48
|
-
type: :runtime
|
49
|
-
version_requirement:
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: "0.4"
|
55
|
-
version:
|
56
36
|
- !ruby/object:Gem::Dependency
|
57
37
|
name: mocha
|
58
|
-
type: :
|
38
|
+
type: :development
|
59
39
|
version_requirement:
|
60
40
|
version_requirements: !ruby/object:Gem::Requirement
|
61
41
|
requirements:
|
@@ -72,80 +52,78 @@ executables:
|
|
72
52
|
extensions: []
|
73
53
|
|
74
54
|
extra_rdoc_files:
|
75
|
-
- README
|
76
55
|
- LICENSE
|
56
|
+
- README
|
77
57
|
files:
|
78
|
-
-
|
58
|
+
- LICENSE
|
59
|
+
- README
|
60
|
+
- Rakefile
|
61
|
+
- lib/ape.rb
|
62
|
+
- lib/ape/atomURI.rb
|
63
|
+
- lib/ape/auth/google_login_credentials.rb
|
64
|
+
- lib/ape/auth/wsse_credentials.rb
|
65
|
+
- lib/ape/authent.rb
|
66
|
+
- lib/ape/categories.rb
|
67
|
+
- lib/ape/coll_element.rb
|
79
68
|
- lib/ape/collection.rb
|
80
|
-
- lib/ape/
|
81
|
-
- lib/ape/
|
69
|
+
- lib/ape/crumbs.rb
|
70
|
+
- lib/ape/entry.rb
|
71
|
+
- lib/ape/escaper.rb
|
72
|
+
- lib/ape/feed.rb
|
73
|
+
- lib/ape/html.rb
|
74
|
+
- lib/ape/invoker.rb
|
82
75
|
- lib/ape/invokers/deleter.rb
|
83
76
|
- lib/ape/invokers/getter.rb
|
84
77
|
- lib/ape/invokers/poster.rb
|
85
78
|
- lib/ape/invokers/putter.rb
|
79
|
+
- lib/ape/names.rb
|
80
|
+
- lib/ape/print_writer.rb
|
86
81
|
- lib/ape/reporter.rb
|
87
|
-
- lib/ape/escaper.rb
|
88
|
-
- lib/ape/atomURI.rb
|
89
|
-
- lib/ape/categories.rb
|
90
|
-
- lib/ape/invoker.rb
|
91
|
-
- lib/ape/validator_dsl.rb
|
92
|
-
- lib/ape/version.rb
|
93
|
-
- lib/ape/coll_element.rb
|
94
|
-
- lib/ape/feed.rb
|
95
|
-
- lib/ape/service.rb
|
96
|
-
- lib/ape/auth/google_login_credentials.rb
|
97
|
-
- lib/ape/auth/wsse_credentials.rb
|
98
|
-
- lib/ape/authent.rb
|
99
|
-
- lib/ape/entry.rb
|
100
|
-
- lib/ape/handler.rb
|
101
|
-
- lib/ape/reporters/html_template.eruby
|
102
|
-
- lib/ape/reporters/html_reporter.rb
|
103
82
|
- lib/ape/reporters/atom_reporter.rb
|
104
|
-
- lib/ape/reporters/text_reporter.rb
|
105
83
|
- lib/ape/reporters/atom_template.eruby
|
106
|
-
- lib/ape/
|
84
|
+
- lib/ape/reporters/html_reporter.rb
|
85
|
+
- lib/ape/reporters/html_template.eruby
|
86
|
+
- lib/ape/reporters/text_reporter.rb
|
87
|
+
- lib/ape/samples.rb
|
88
|
+
- lib/ape/service.rb
|
107
89
|
- lib/ape/util.rb
|
108
|
-
- lib/ape/names.rb
|
109
90
|
- lib/ape/validator.rb
|
91
|
+
- lib/ape/validator_dsl.rb
|
110
92
|
- lib/ape/validators/entry_posts_validator.rb
|
93
|
+
- lib/ape/validators/media_linkage_validator.rb
|
111
94
|
- lib/ape/validators/media_posts_validator.rb
|
112
|
-
- lib/ape/validators/service_document_validator.rb
|
113
95
|
- lib/ape/validators/sanitization_validator.rb
|
114
|
-
- lib/ape/validators/media_linkage_validator.rb
|
115
|
-
- lib/ape/validators/sorting_validator.rb
|
116
96
|
- lib/ape/validators/schema_validator.rb
|
117
|
-
- lib/ape/
|
118
|
-
- lib/ape.rb
|
119
|
-
-
|
97
|
+
- lib/ape/validators/service_document_validator.rb
|
98
|
+
- lib/ape/validators/sorting_validator.rb
|
99
|
+
- lib/ape/version.rb
|
120
100
|
- samples/atom_schema.txt
|
121
|
-
- samples/unclean_xhtml_entry.eruby
|
122
101
|
- samples/basic_entry.eruby
|
123
102
|
- samples/categories_schema.txt
|
124
103
|
- samples/mini_entry.eruby
|
104
|
+
- samples/service_schema.txt
|
105
|
+
- samples/unclean_xhtml_entry.eruby
|
125
106
|
- test/test_helper.rb
|
126
|
-
- test/unit/reporter_test.rb
|
127
|
-
- test/unit/invoker_test.rb
|
128
107
|
- test/unit/ape_test.rb
|
129
|
-
- test/unit/
|
130
|
-
- test/unit/collection_test.rb
|
108
|
+
- test/unit/authent_test.rb
|
131
109
|
- test/unit/coll_element_test.rb
|
132
|
-
- test/unit/
|
110
|
+
- test/unit/collection_test.rb
|
111
|
+
- test/unit/invoker_test.rb
|
112
|
+
- test/unit/reporter_test.rb
|
113
|
+
- test/unit/samples_test.rb
|
133
114
|
- test/unit/service_test.rb
|
134
|
-
- test/unit/
|
115
|
+
- test/unit/validators_test.rb
|
135
116
|
- web/ape.css
|
136
117
|
- web/ape_logo.png
|
137
118
|
- web/index.html
|
138
119
|
- web/info.png
|
139
|
-
- README
|
140
|
-
- LICENSE
|
141
|
-
- Rakefile
|
142
120
|
has_rdoc: true
|
143
121
|
homepage: http://ape.rubyforge.org
|
144
122
|
licenses: []
|
145
123
|
|
146
124
|
post_install_message:
|
147
|
-
rdoc_options:
|
148
|
-
|
125
|
+
rdoc_options:
|
126
|
+
- --charset=UTF-8
|
149
127
|
require_paths:
|
150
128
|
- lib
|
151
129
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -167,5 +145,14 @@ rubygems_version: 1.3.5
|
|
167
145
|
signing_key:
|
168
146
|
specification_version: 3
|
169
147
|
summary: The Atom Protocol Exerciser
|
170
|
-
test_files:
|
171
|
-
|
148
|
+
test_files:
|
149
|
+
- test/test_helper.rb
|
150
|
+
- test/unit/reporter_test.rb
|
151
|
+
- test/unit/invoker_test.rb
|
152
|
+
- test/unit/ape_test.rb
|
153
|
+
- test/unit/samples_test.rb
|
154
|
+
- test/unit/collection_test.rb
|
155
|
+
- test/unit/coll_element_test.rb
|
156
|
+
- test/unit/validators_test.rb
|
157
|
+
- test/unit/service_test.rb
|
158
|
+
- test/unit/authent_test.rb
|
data/lib/ape/handler.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'mongrel'
|
3
|
-
require 'ape'
|
4
|
-
|
5
|
-
module Ape
|
6
|
-
|
7
|
-
# Implements the APE application handler for processing
|
8
|
-
# and responding to requests. See process for more detail.
|
9
|
-
class Handler < Mongrel::HttpHandler
|
10
|
-
|
11
|
-
# Called by Mongrel with Mongrel::HttpRequest and
|
12
|
-
# Mongrel::HttpResponse objects. Creates an Ape
|
13
|
-
# instance for the request and responds with its report.
|
14
|
-
def process(request, response)
|
15
|
-
cgi = Mongrel::CGIWrapper.new(request, response)
|
16
|
-
|
17
|
-
uri = cgi['uri'].strip
|
18
|
-
user = cgi['username'].strip
|
19
|
-
pass = cgi['password'].strip
|
20
|
-
|
21
|
-
if uri.empty?
|
22
|
-
response.start(200, true) do |header, body|
|
23
|
-
header['Content-Type'] = 'text/plain'
|
24
|
-
body << 'URI argument is required'
|
25
|
-
end
|
26
|
-
return
|
27
|
-
end
|
28
|
-
|
29
|
-
format = request.params['HTTP_ACCEPT'] == 'text/plain' ? 'text' : 'html'
|
30
|
-
ape = Ape.new({ :crumbs => true, :output => format, :server => true })
|
31
|
-
(user && pass) ? ape.check(uri, user, pass) : ape.check(uri)
|
32
|
-
|
33
|
-
response.start(200, true) do |header, body|
|
34
|
-
header['Content-Type'] = 'text/html'
|
35
|
-
ape.report(body)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/lib/ape/server.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'mongrel'
|
3
|
-
require 'ape/handler'
|
4
|
-
require 'ape/samples'
|
5
|
-
|
6
|
-
module Ape
|
7
|
-
|
8
|
-
# Manages and initializes the Mongrel handler. See run for more details.
|
9
|
-
class Server
|
10
|
-
|
11
|
-
# Starts the Mongrel handler with options given in +options+ and
|
12
|
-
# maps the <b>/</b>, <b>/ape</b> and <b>/atompub/go</b> URIs to handlers.
|
13
|
-
#
|
14
|
-
# ==== Options
|
15
|
-
# * :host - the IP address to bind to
|
16
|
-
# * :port - the port number to listen on
|
17
|
-
# * :directory - the ape home directory
|
18
|
-
def self.run(options)
|
19
|
-
::Ape.home = options[:home]
|
20
|
-
|
21
|
-
mongrel = Mongrel::Configurator.new(:host => options[:host], :port => options[:port]) do
|
22
|
-
log "=> Booting mongrel"
|
23
|
-
begin
|
24
|
-
log "=> The ape starting on http://#{options[:host]}:#{options[:port]}"
|
25
|
-
listener do
|
26
|
-
redirect '/', '/web/index.html'
|
27
|
-
uri '/web', :handler =>
|
28
|
-
Mongrel::DirHandler.new(
|
29
|
-
File.expand_path(File.dirname(__FILE__) + '/../../web'), true)
|
30
|
-
uri '/atompub/go', :handler => Handler.new
|
31
|
-
end
|
32
|
-
rescue Errno::EADDRINUSE
|
33
|
-
log "ERROR: Address (#{options[:host]}:#{options[:port]}) is already in use"
|
34
|
-
exit 1
|
35
|
-
end
|
36
|
-
trap("INT") { stop }
|
37
|
-
trap("TERM") { stop }
|
38
|
-
log "=> Ctrl-C to shutdown"
|
39
|
-
run
|
40
|
-
end
|
41
|
-
mongrel.join
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|