synfeld 0.0.4
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/.gitignore +8 -0
- data/History.txt +15 -0
- data/README.rdoc +206 -0
- data/README.txt +206 -0
- data/Rakefile +74 -0
- data/TODO +1 -0
- data/example/public/erb_files/erb_test.erb +16 -0
- data/example/public/haml_files/haml_test.haml +15 -0
- data/example/public/haml_files/home.haml +19 -0
- data/example/public/html_files/html_test.html +14 -0
- data/example/public/images/beef_interstellar_thm.jpg +0 -0
- data/example/public/images/rails.png +0 -0
- data/example/try_me.rb +65 -0
- data/example/try_me.ru +6 -0
- data/lib/synfeld/base.rb +281 -0
- data/lib/synfeld.rb +17 -0
- data/lib/synfeld_info.rb +51 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/synfeld_spec.rb +7 -0
- data/synfeld.gemspec +50 -0
- data/tasks/ann.rake +80 -0
- data/tasks/bones.rake +20 -0
- data/tasks/gem.rake +201 -0
- data/tasks/git.rake +40 -0
- data/tasks/notes.rake +27 -0
- data/tasks/post_load.rake +34 -0
- data/tasks/rdoc.rake +51 -0
- data/tasks/rubyforge.rake +55 -0
- data/tasks/setup.rb +292 -0
- data/tasks/spec.rake +54 -0
- data/tasks/svn.rake +47 -0
- data/tasks/test.rake +40 -0
- data/tasks/zentest.rake +36 -0
- data/test/test_synfeld.rb +0 -0
- data/work/rackmount-test.ru +59 -0
- metadata +134 -0
data/tasks/spec.rake
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
|
3
|
+
require 'spec/rake/verify_rcov'
|
4
|
+
|
5
|
+
namespace :spec do
|
6
|
+
|
7
|
+
desc 'Run all specs with basic output'
|
8
|
+
Spec::Rake::SpecTask.new(:run) do |t|
|
9
|
+
t.ruby_opts = PROJ.ruby_opts
|
10
|
+
t.spec_opts = PROJ.spec.opts
|
11
|
+
t.spec_files = PROJ.spec.files
|
12
|
+
t.libs += PROJ.libs
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Run all specs with text output'
|
16
|
+
Spec::Rake::SpecTask.new(:specdoc) do |t|
|
17
|
+
t.ruby_opts = PROJ.ruby_opts
|
18
|
+
t.spec_opts = PROJ.spec.opts + ['--format', 'specdoc']
|
19
|
+
t.spec_files = PROJ.spec.files
|
20
|
+
t.libs += PROJ.libs
|
21
|
+
end
|
22
|
+
|
23
|
+
if HAVE_RCOV
|
24
|
+
desc 'Run all specs with RCov'
|
25
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
26
|
+
t.ruby_opts = PROJ.ruby_opts
|
27
|
+
t.spec_opts = PROJ.spec.opts
|
28
|
+
t.spec_files = PROJ.spec.files
|
29
|
+
t.libs += PROJ.libs
|
30
|
+
t.rcov = true
|
31
|
+
t.rcov_dir = PROJ.rcov.dir
|
32
|
+
t.rcov_opts = PROJ.rcov.opts + ['--exclude', 'spec']
|
33
|
+
end
|
34
|
+
|
35
|
+
RCov::VerifyTask.new(:verify) do |t|
|
36
|
+
t.threshold = PROJ.rcov.threshold
|
37
|
+
t.index_html = File.join(PROJ.rcov.dir, 'index.html')
|
38
|
+
t.require_exact_threshold = PROJ.rcov.threshold_exact
|
39
|
+
end
|
40
|
+
|
41
|
+
task :verify => :rcov
|
42
|
+
remove_desc_for_task %w(spec:clobber_rcov)
|
43
|
+
end
|
44
|
+
|
45
|
+
end # namespace :spec
|
46
|
+
|
47
|
+
desc 'Alias to spec:run'
|
48
|
+
task :spec => 'spec:run'
|
49
|
+
|
50
|
+
task :clobber => 'spec:clobber_rcov' if HAVE_RCOV
|
51
|
+
|
52
|
+
end # if HAVE_SPEC_RAKE_SPECTASK
|
53
|
+
|
54
|
+
# EOF
|
data/tasks/svn.rake
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
if HAVE_SVN
|
3
|
+
|
4
|
+
unless PROJ.svn.root
|
5
|
+
info = %x/svn info ./
|
6
|
+
m = %r/^Repository Root:\s+(.*)$/.match(info)
|
7
|
+
PROJ.svn.root = (m.nil? ? '' : m[1])
|
8
|
+
end
|
9
|
+
PROJ.svn.root = File.join(PROJ.svn.root, PROJ.svn.path) unless PROJ.svn.path.empty?
|
10
|
+
|
11
|
+
namespace :svn do
|
12
|
+
|
13
|
+
# A prerequisites task that all other tasks depend upon
|
14
|
+
task :prereqs
|
15
|
+
|
16
|
+
desc 'Show tags from the SVN repository'
|
17
|
+
task :show_tags => 'svn:prereqs' do |t|
|
18
|
+
tags = %x/svn list #{File.join(PROJ.svn.root, PROJ.svn.tags)}/
|
19
|
+
tags.gsub!(%r/\/$/, '')
|
20
|
+
tags = tags.split("\n").sort {|a,b| b <=> a}
|
21
|
+
puts tags
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Create a new tag in the SVN repository'
|
25
|
+
task :create_tag => 'svn:prereqs' do |t|
|
26
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
27
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
28
|
+
|
29
|
+
svn = PROJ.svn
|
30
|
+
trunk = File.join(svn.root, svn.trunk)
|
31
|
+
tag = "%s-%s" % [PROJ.name, PROJ.version]
|
32
|
+
tag = File.join(svn.root, svn.tags, tag)
|
33
|
+
msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
|
34
|
+
|
35
|
+
puts "Creating SVN tag '#{tag}'"
|
36
|
+
unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
|
37
|
+
abort "Tag creation failed"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end # namespace :svn
|
42
|
+
|
43
|
+
task 'gem:release' => 'svn:create_tag'
|
44
|
+
|
45
|
+
end # if PROJ.svn.path
|
46
|
+
|
47
|
+
# EOF
|
data/tasks/test.rake
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
namespace :test do
|
6
|
+
|
7
|
+
Rake::TestTask.new(:run) do |t|
|
8
|
+
t.libs = PROJ.libs
|
9
|
+
t.test_files = if test(?f, PROJ.test.file) then [PROJ.test.file]
|
10
|
+
else PROJ.test.files end
|
11
|
+
t.ruby_opts += PROJ.ruby_opts
|
12
|
+
t.ruby_opts += PROJ.test.opts
|
13
|
+
end
|
14
|
+
|
15
|
+
if HAVE_RCOV
|
16
|
+
desc 'Run rcov on the unit tests'
|
17
|
+
task :rcov => :clobber_rcov do
|
18
|
+
opts = PROJ.rcov.opts.dup << '-o' << PROJ.rcov.dir
|
19
|
+
opts = opts.join(' ')
|
20
|
+
files = if test(?f, PROJ.test.file) then [PROJ.test.file]
|
21
|
+
else PROJ.test.files end
|
22
|
+
files = files.join(' ')
|
23
|
+
sh "#{RCOV} #{files} #{opts}"
|
24
|
+
end
|
25
|
+
|
26
|
+
task :clobber_rcov do
|
27
|
+
rm_r 'coverage' rescue nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end # namespace :test
|
32
|
+
|
33
|
+
desc 'Alias to test:run'
|
34
|
+
task :test => 'test:run'
|
35
|
+
|
36
|
+
task :clobber => 'test:clobber_rcov' if HAVE_RCOV
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
# EOF
|
data/tasks/zentest.rake
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
if HAVE_ZENTEST
|
2
|
+
|
3
|
+
# --------------------------------------------------------------------------
|
4
|
+
if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
|
5
|
+
require 'autotest'
|
6
|
+
|
7
|
+
namespace :test do
|
8
|
+
task :autotest do
|
9
|
+
Autotest.run
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Run the autotest loop"
|
14
|
+
task :autotest => 'test:autotest'
|
15
|
+
|
16
|
+
end # if test
|
17
|
+
|
18
|
+
# --------------------------------------------------------------------------
|
19
|
+
if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
|
20
|
+
require 'autotest/rspec'
|
21
|
+
|
22
|
+
namespace :spec do
|
23
|
+
task :autotest do
|
24
|
+
load '.autotest' if test(?f, '.autotest')
|
25
|
+
Autotest::Rspec.run
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Run the autotest loop"
|
30
|
+
task :autotest => 'spec:autotest'
|
31
|
+
|
32
|
+
end # if rspec
|
33
|
+
|
34
|
+
end # if HAVE_ZENTEST
|
35
|
+
|
36
|
+
# EOF
|
File without changes
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'rack/mount'
|
2
|
+
|
3
|
+
#@usher ||= Usher.new(:generator => Usher::Util::Generators::URL.new)
|
4
|
+
|
5
|
+
@app = proc do |env|
|
6
|
+
|
7
|
+
body = "Hi there #{env[ Rack::Mount::Const::RACK_ROUTING_ARGS].inspect}"
|
8
|
+
[
|
9
|
+
200, # Status code
|
10
|
+
{ # Response headers
|
11
|
+
'Content-Type' => 'text/plain',
|
12
|
+
'Content-Length' => body.size.to_s,
|
13
|
+
},
|
14
|
+
[body] # Response body
|
15
|
+
]
|
16
|
+
end
|
17
|
+
|
18
|
+
@set = nil
|
19
|
+
|
20
|
+
def add_a_route(opts = {})
|
21
|
+
method = (opts.delete(:method) || 'GET').upcase
|
22
|
+
string_or_regex = opts.delete(:path) || raise("You have to provide a :path")
|
23
|
+
colon = (RUBY_VERSION =~ /^1.8/)? ':' : ''
|
24
|
+
if string_or_regex.is_a?(String)
|
25
|
+
regex_string = "^" + string_or_regex.gsub(/:(([^\/]+))/){|s| "(?#{colon}<#{$1}>.*)" } + "$"
|
26
|
+
puts regex_string
|
27
|
+
regex = %r{#{regex_string}}
|
28
|
+
else
|
29
|
+
regex = string_or_regex
|
30
|
+
end
|
31
|
+
@set.add_route(@app,
|
32
|
+
{:path_info => regex, :request_method => method.upcase},
|
33
|
+
opts)
|
34
|
+
end
|
35
|
+
|
36
|
+
basic_set = Rack::Mount::RouteSet.new_without_optimizations do |set|
|
37
|
+
@set = set
|
38
|
+
# set.add_route(@app, { :path_info => %r{^/hello/(?:<hi>.*)$}, :request_method => 'GET' },
|
39
|
+
# { :controller => 'spscontroller_a', :action => 'spsaction_a' })
|
40
|
+
# set.add_route(@app, { :path_info => %r{^/hi/(?<ho>.*)$}, :request_method => 'GET' },
|
41
|
+
# { :controller => 'spscontroller_a', :action => 'spsaction_a' })
|
42
|
+
# set.add_route(@app, { :path_info => '/ho/steve', :request_method => 'GET' },
|
43
|
+
# { :controller => 'spscontroller_a', :action => 'spsaction_a' })
|
44
|
+
# set.add_route(@app, { :path_info => Rack::Mount::Utils.normalize_path('/baz') },
|
45
|
+
# { :controller => 'baz', :action => 'index' })
|
46
|
+
add_a_route(:path => '/hillo/:name',
|
47
|
+
:method => 'get',
|
48
|
+
:controller => 'spscontroller_a',
|
49
|
+
:action => 'spsaction_a' )
|
50
|
+
add_a_route( :path => '/ho/:nime/blah',
|
51
|
+
:controller => 'spscontroller_b',
|
52
|
+
:action => 'spsaction_b' )
|
53
|
+
add_a_route(:path => %r{^/hey/(?:<hi>.*)$}, :cont => 'cont_c', :act => 'action_c' )
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
run basic_set
|
58
|
+
|
59
|
+
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: synfeld
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steven Swerling
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-11 00:00:00 -04:00
|
13
|
+
default_executable:
|
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"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rack-router
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: bones
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.5.1
|
44
|
+
version:
|
45
|
+
description: |-
|
46
|
+
Synfeld is a web application framework that does practically nothing.
|
47
|
+
|
48
|
+
Synfeld is little more than a small wrapper for Rack::Mount (see http://github.com/josh/rack-mount). If you want a web framework that is mostly just going to serve up json blobs, and occasionally serve up some simple content (eg. help files) and media, Synfeld makes that easy.
|
49
|
+
|
50
|
+
The sample app below shows pretty much everything there is to know about synfeld, in particular:
|
51
|
+
|
52
|
+
* How to define routes.
|
53
|
+
* Simple rendering of erb, haml, html, json, and static files.
|
54
|
+
* In the case of erb and haml, passing variables into the template is demonstrated.
|
55
|
+
* A dynamic action where the status code, headers, and body are created 'manually' (/my/special/route below)
|
56
|
+
* A simple way of creating format sensitive routes (/alphabet.html vs. /alphabet.json)
|
57
|
+
* The erb demo link also demos the rendering of a partial (not visible in the code below, you have to look at the template file examples/public/erb_files/erb_test.erb).
|
58
|
+
email: sswerling@yahoo.com
|
59
|
+
executables: []
|
60
|
+
|
61
|
+
extensions: []
|
62
|
+
|
63
|
+
extra_rdoc_files:
|
64
|
+
- History.txt
|
65
|
+
- README.rdoc
|
66
|
+
- README.txt
|
67
|
+
files:
|
68
|
+
- .gitignore
|
69
|
+
- History.txt
|
70
|
+
- README.rdoc
|
71
|
+
- README.txt
|
72
|
+
- Rakefile
|
73
|
+
- TODO
|
74
|
+
- example/public/erb_files/erb_test.erb
|
75
|
+
- example/public/haml_files/haml_test.haml
|
76
|
+
- example/public/haml_files/home.haml
|
77
|
+
- example/public/html_files/html_test.html
|
78
|
+
- example/public/images/beef_interstellar_thm.jpg
|
79
|
+
- example/public/images/rails.png
|
80
|
+
- example/try_me.rb
|
81
|
+
- example/try_me.ru
|
82
|
+
- lib/synfeld.rb
|
83
|
+
- lib/synfeld/base.rb
|
84
|
+
- lib/synfeld_info.rb
|
85
|
+
- spec/spec_helper.rb
|
86
|
+
- spec/synfeld_spec.rb
|
87
|
+
- synfeld.gemspec
|
88
|
+
- tasks/ann.rake
|
89
|
+
- tasks/bones.rake
|
90
|
+
- tasks/gem.rake
|
91
|
+
- tasks/git.rake
|
92
|
+
- tasks/notes.rake
|
93
|
+
- tasks/post_load.rake
|
94
|
+
- tasks/rdoc.rake
|
95
|
+
- tasks/rubyforge.rake
|
96
|
+
- tasks/setup.rb
|
97
|
+
- tasks/spec.rake
|
98
|
+
- tasks/svn.rake
|
99
|
+
- tasks/test.rake
|
100
|
+
- tasks/zentest.rake
|
101
|
+
- test/test_synfeld.rb
|
102
|
+
- work/rackmount-test.ru
|
103
|
+
has_rdoc: true
|
104
|
+
homepage: http://tab-a.slot-z.net
|
105
|
+
licenses: []
|
106
|
+
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options:
|
109
|
+
- --inline-source
|
110
|
+
- --main
|
111
|
+
- README.txt
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: "0"
|
119
|
+
version:
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: "0"
|
125
|
+
version:
|
126
|
+
requirements: []
|
127
|
+
|
128
|
+
rubyforge_project: synfeld
|
129
|
+
rubygems_version: 1.3.2
|
130
|
+
signing_key:
|
131
|
+
specification_version: 3
|
132
|
+
summary: Synfeld is a web application framework that does practically nothing
|
133
|
+
test_files:
|
134
|
+
- test/test_synfeld.rb
|