runcoderun
This commit is contained in:
parent
d916b91d2b
commit
aa5a3d5918
22
.gitignore
vendored
Normal file → Executable file
22
.gitignore
vendored
Normal file → Executable file
|
@ -4,3 +4,25 @@ coverage
|
||||||
rdoc
|
rdoc
|
||||||
pkg
|
pkg
|
||||||
.sass-cache
|
.sass-cache
|
||||||
|
bin/autospec
|
||||||
|
bin/compass
|
||||||
|
bin/css2sass
|
||||||
|
bin/cucumber
|
||||||
|
bin/edit_json.rb
|
||||||
|
bin/haml
|
||||||
|
bin/html2haml
|
||||||
|
bin/htmldiff
|
||||||
|
bin/launchy
|
||||||
|
bin/ldiff
|
||||||
|
bin/prettify_json.rb
|
||||||
|
bin/rackup
|
||||||
|
bin/rake
|
||||||
|
bin/ri
|
||||||
|
bin/sass
|
||||||
|
bin/sdoc
|
||||||
|
bin/sdoc-merge
|
||||||
|
bin/shotgun
|
||||||
|
bin/spec
|
||||||
|
bin/sprocketize
|
||||||
|
bin/thin
|
||||||
|
bin/tt
|
||||||
|
|
17
Gemfile
Executable file
17
Gemfile
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
source "http://gemcutter.org"
|
||||||
|
disable_rubygems
|
||||||
|
|
||||||
|
gem "thin"
|
||||||
|
gem "shotgun"
|
||||||
|
gem "templater"
|
||||||
|
gem "sprockets"
|
||||||
|
gem "sinatra"
|
||||||
|
gem "sinatra-content-for"
|
||||||
|
gem "rack-test"
|
||||||
|
gem "yui-compressor"
|
||||||
|
gem "haml"
|
||||||
|
gem "compass"
|
||||||
|
|
||||||
|
gem "rspec"
|
||||||
|
gem "sdoc"
|
||||||
|
gem "cucumber"
|
0
README.rdoc
Normal file → Executable file
0
README.rdoc
Normal file → Executable file
4
Rakefile
Normal file → Executable file
4
Rakefile
Normal file → Executable file
|
@ -1,4 +1,5 @@
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
|
#require 'lib/middleman'
|
||||||
require 'rake'
|
require 'rake'
|
||||||
require 'cucumber/rake/task'
|
require 'cucumber/rake/task'
|
||||||
|
|
||||||
|
@ -25,6 +26,9 @@ begin
|
||||||
gem.add_development_dependency("rspec")
|
gem.add_development_dependency("rspec")
|
||||||
gem.add_development_dependency("sdoc")
|
gem.add_development_dependency("sdoc")
|
||||||
gem.add_development_dependency("cucumber")
|
gem.add_development_dependency("cucumber")
|
||||||
|
|
||||||
|
# Ignore vendored files
|
||||||
|
#gem.files = gem.files.exclude("vendor/*")
|
||||||
end
|
end
|
||||||
|
|
||||||
Jeweler::GemcutterTasks.new
|
Jeweler::GemcutterTasks.new
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
require 'rubygems'
|
||||||
require 'templater'
|
require 'templater'
|
||||||
|
|
||||||
module Generators
|
module Generators
|
||||||
|
|
2
lib/middleman.rb
Normal file → Executable file
2
lib/middleman.rb
Normal file → Executable file
|
@ -1,4 +1,6 @@
|
||||||
libdir = File.dirname(__FILE__)
|
libdir = File.dirname(__FILE__)
|
||||||
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
||||||
|
|
||||||
|
# Bundler
|
||||||
|
#require File.join(File.dirname(libdir), "vendor", "gems", "environment") if ENV["RUN_CODE_RUN"]
|
||||||
require 'middleman/base'
|
require 'middleman/base'
|
0
lib/middleman/base.rb
Normal file → Executable file
0
lib/middleman/base.rb
Normal file → Executable file
0
lib/middleman/builder.rb
Normal file → Executable file
0
lib/middleman/builder.rb
Normal file → Executable file
0
lib/middleman/config.ru
Normal file → Executable file
0
lib/middleman/config.ru
Normal file → Executable file
0
lib/middleman/fastimage.rb
Normal file → Executable file
0
lib/middleman/fastimage.rb
Normal file → Executable file
0
lib/middleman/features/automatic_image_sizes.rb
Normal file → Executable file
0
lib/middleman/features/automatic_image_sizes.rb
Normal file → Executable file
0
lib/middleman/features/cache_buster.rb
Normal file → Executable file
0
lib/middleman/features/cache_buster.rb
Normal file → Executable file
0
lib/middleman/features/growl.rb
Normal file → Executable file
0
lib/middleman/features/growl.rb
Normal file → Executable file
0
lib/middleman/features/maruku.rb
Normal file → Executable file
0
lib/middleman/features/maruku.rb
Normal file → Executable file
0
lib/middleman/features/minify_css.rb
Normal file → Executable file
0
lib/middleman/features/minify_css.rb
Normal file → Executable file
0
lib/middleman/features/minify_javascript.rb
Normal file → Executable file
0
lib/middleman/features/minify_javascript.rb
Normal file → Executable file
0
lib/middleman/features/relative_assets.rb
Normal file → Executable file
0
lib/middleman/features/relative_assets.rb
Normal file → Executable file
0
lib/middleman/features/slickmap.rb
Normal file → Executable file
0
lib/middleman/features/slickmap.rb
Normal file → Executable file
0
lib/middleman/features/smush_pngs.rb
Normal file → Executable file
0
lib/middleman/features/smush_pngs.rb
Normal file → Executable file
0
lib/middleman/features/sprockets.rb
Normal file → Executable file
0
lib/middleman/features/sprockets.rb
Normal file → Executable file
0
lib/middleman/haml.rb
Normal file → Executable file
0
lib/middleman/haml.rb
Normal file → Executable file
0
lib/middleman/helpers.rb
Normal file → Executable file
0
lib/middleman/helpers.rb
Normal file → Executable file
0
lib/middleman/rack/sprockets+ruby19.rb
Normal file → Executable file
0
lib/middleman/rack/sprockets+ruby19.rb
Normal file → Executable file
0
lib/middleman/rack/sprockets.rb
Normal file → Executable file
0
lib/middleman/rack/sprockets.rb
Normal file → Executable file
0
lib/middleman/rack/static.rb
Normal file → Executable file
0
lib/middleman/rack/static.rb
Normal file → Executable file
0
lib/middleman/sass.rb
Normal file → Executable file
0
lib/middleman/sass.rb
Normal file → Executable file
0
lib/middleman/template/init.rbt
Normal file → Executable file
0
lib/middleman/template/init.rbt
Normal file → Executable file
0
lib/middleman/template/views/index.html.haml
Normal file → Executable file
0
lib/middleman/template/views/index.html.haml
Normal file → Executable file
0
lib/middleman/template/views/layout.haml
Normal file → Executable file
0
lib/middleman/template/views/layout.haml
Normal file → Executable file
0
lib/middleman/template/views/stylesheets/site.css.sass
Normal file → Executable file
0
lib/middleman/template/views/stylesheets/site.css.sass
Normal file → Executable file
0
lib/middleman/templater+dynamic_renderer.rb
Normal file → Executable file
0
lib/middleman/templater+dynamic_renderer.rb
Normal file → Executable file
0
middleman.gemspec
Normal file → Executable file
0
middleman.gemspec
Normal file → Executable file
1
spec/auto_image_sizes.rb
Normal file → Executable file
1
spec/auto_image_sizes.rb
Normal file → Executable file
|
@ -1,4 +1,3 @@
|
||||||
require 'rack/test'
|
|
||||||
require File.join(File.dirname(__FILE__), "spec_helper")
|
require File.join(File.dirname(__FILE__), "spec_helper")
|
||||||
|
|
||||||
base = ::Middleman::Base
|
base = ::Middleman::Base
|
||||||
|
|
0
spec/builder_spec.rb
Normal file → Executable file
0
spec/builder_spec.rb
Normal file → Executable file
1
spec/cache_buster_spec.rb
Normal file → Executable file
1
spec/cache_buster_spec.rb
Normal file → Executable file
|
@ -1,4 +1,3 @@
|
||||||
require 'rack/test'
|
|
||||||
require File.join(File.dirname(__FILE__), "spec_helper")
|
require File.join(File.dirname(__FILE__), "spec_helper")
|
||||||
|
|
||||||
base = ::Middleman::Base
|
base = ::Middleman::Base
|
||||||
|
|
0
spec/fixtures/sample/init.rb
vendored
Normal file → Executable file
0
spec/fixtures/sample/init.rb
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/images/blank.gif
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/images/blank.gif
vendored
Normal file → Executable file
Before Width: | Height: | Size: 43 B After Width: | Height: | Size: 43 B |
0
spec/fixtures/sample/public/javascripts/to-be-included.js
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/javascripts/to-be-included.js
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/static.html
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/static.html
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/stylesheets/auto-css.css
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/stylesheets/auto-css.css
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/stylesheets/static.css
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/stylesheets/static.css
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/stylesheets/sub1/auto-css.css
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/stylesheets/sub1/auto-css.css
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/stylesheets/sub1/sub2/auto-css.css
vendored
Normal file → Executable file
0
spec/fixtures/sample/public/stylesheets/sub1/sub2/auto-css.css
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/_partial.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/_partial.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/auto-css.html.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/auto-css.html.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/auto-image-sizes.html.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/auto-image-sizes.html.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/index.html.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/index.html.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/inline-js.html.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/inline-js.html.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/javascripts/empty-with-include.js
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/javascripts/empty-with-include.js
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/layout.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/layout.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/maruku.html.maruku
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/maruku.html.maruku
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/page-classes.html.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/page-classes.html.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/services/index.html.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/services/index.html.haml
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/stylesheets/relative_assets.css.sass
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/stylesheets/relative_assets.css.sass
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/stylesheets/site.css.sass
vendored
Normal file → Executable file
0
spec/fixtures/sample/views/stylesheets/site.css.sass
vendored
Normal file → Executable file
0
spec/generator_spec.rb
Normal file → Executable file
0
spec/generator_spec.rb
Normal file → Executable file
1
spec/helpers_spec.rb
Normal file → Executable file
1
spec/helpers_spec.rb
Normal file → Executable file
|
@ -1,4 +1,3 @@
|
||||||
require 'rack/test'
|
|
||||||
require File.join(File.dirname(__FILE__), "spec_helper")
|
require File.join(File.dirname(__FILE__), "spec_helper")
|
||||||
|
|
||||||
base = ::Middleman::Base
|
base = ::Middleman::Base
|
||||||
|
|
1
spec/minify_javascript_spec.rb
Normal file → Executable file
1
spec/minify_javascript_spec.rb
Normal file → Executable file
|
@ -1,4 +1,3 @@
|
||||||
require 'rack/test'
|
|
||||||
require File.join(File.dirname(__FILE__), "spec_helper")
|
require File.join(File.dirname(__FILE__), "spec_helper")
|
||||||
|
|
||||||
base = ::Middleman::Base
|
base = ::Middleman::Base
|
||||||
|
|
1
spec/relative_assets_spec.rb
Normal file → Executable file
1
spec/relative_assets_spec.rb
Normal file → Executable file
|
@ -1,4 +1,3 @@
|
||||||
require 'rack/test'
|
|
||||||
require File.join(File.dirname(__FILE__), "spec_helper")
|
require File.join(File.dirname(__FILE__), "spec_helper")
|
||||||
|
|
||||||
base = ::Middleman::Base
|
base = ::Middleman::Base
|
||||||
|
|
5
spec/spec_helper.rb
Normal file → Executable file
5
spec/spec_helper.rb
Normal file → Executable file
|
@ -1,9 +1,8 @@
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'spec'
|
require 'spec'
|
||||||
|
require 'rack/test'
|
||||||
|
|
||||||
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
require File.join(File.dirname(File.dirname(__FILE__)), 'lib', 'middleman')
|
||||||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
||||||
require 'middleman'
|
|
||||||
|
|
||||||
Spec::Runner.configure do |config|
|
Spec::Runner.configure do |config|
|
||||||
|
|
||||||
|
|
BIN
vendor/gems/cache/builder-2.1.2.gem
vendored
Executable file
BIN
vendor/gems/cache/builder-2.1.2.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/compass-0.8.17.gem
vendored
Executable file
BIN
vendor/gems/cache/compass-0.8.17.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/configuration-1.1.0.gem
vendored
Executable file
BIN
vendor/gems/cache/configuration-1.1.0.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/cucumber-0.4.4.gem
vendored
Executable file
BIN
vendor/gems/cache/cucumber-0.4.4.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/daemons-1.0.10.gem
vendored
Executable file
BIN
vendor/gems/cache/daemons-1.0.10.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/diff-lcs-1.1.2.gem
vendored
Executable file
BIN
vendor/gems/cache/diff-lcs-1.1.2.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/eventmachine-0.12.10.gem
vendored
Executable file
BIN
vendor/gems/cache/eventmachine-0.12.10.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/extlib-0.9.13.gem
vendored
Executable file
BIN
vendor/gems/cache/extlib-0.9.13.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/haml-2.2.13.gem
vendored
Executable file
BIN
vendor/gems/cache/haml-2.2.13.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/highline-1.5.1.gem
vendored
Executable file
BIN
vendor/gems/cache/highline-1.5.1.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/json-1.2.0.gem
vendored
Executable file
BIN
vendor/gems/cache/json-1.2.0.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/launchy-0.3.3.gem
vendored
Executable file
BIN
vendor/gems/cache/launchy-0.3.3.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/polyglot-0.2.9.gem
vendored
Executable file
BIN
vendor/gems/cache/polyglot-0.2.9.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/rack-1.0.1.gem
vendored
Executable file
BIN
vendor/gems/cache/rack-1.0.1.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/rack-test-0.5.1.gem
vendored
Executable file
BIN
vendor/gems/cache/rack-test-0.5.1.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/rake-0.8.7.gem
vendored
Executable file
BIN
vendor/gems/cache/rake-0.8.7.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/rdoc-2.4.3.gem
vendored
Executable file
BIN
vendor/gems/cache/rdoc-2.4.3.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/rspec-1.2.9.gem
vendored
Executable file
BIN
vendor/gems/cache/rspec-1.2.9.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/sdoc-0.2.14.1.gem
vendored
Executable file
BIN
vendor/gems/cache/sdoc-0.2.14.1.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/shotgun-0.4.gem
vendored
Executable file
BIN
vendor/gems/cache/shotgun-0.4.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/sinatra-0.9.4.gem
vendored
Executable file
BIN
vendor/gems/cache/sinatra-0.9.4.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/sinatra-content-for-0.2.gem
vendored
Executable file
BIN
vendor/gems/cache/sinatra-content-for-0.2.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/sprockets-1.0.2.gem
vendored
Executable file
BIN
vendor/gems/cache/sprockets-1.0.2.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/templater-1.0.0.gem
vendored
Executable file
BIN
vendor/gems/cache/templater-1.0.0.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/term-ansicolor-1.0.4.gem
vendored
Executable file
BIN
vendor/gems/cache/term-ansicolor-1.0.4.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/thin-1.2.5.gem
vendored
Executable file
BIN
vendor/gems/cache/thin-1.2.5.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/treetop-1.4.2.gem
vendored
Executable file
BIN
vendor/gems/cache/treetop-1.4.2.gem
vendored
Executable file
Binary file not shown.
BIN
vendor/gems/cache/yui-compressor-0.9.1.gem
vendored
Executable file
BIN
vendor/gems/cache/yui-compressor-0.9.1.gem
vendored
Executable file
Binary file not shown.
205
vendor/gems/environment.rb
vendored
Executable file
205
vendor/gems/environment.rb
vendored
Executable file
|
@ -0,0 +1,205 @@
|
||||||
|
# DO NOT MODIFY THIS FILE
|
||||||
|
module Bundler
|
||||||
|
file = File.expand_path(__FILE__)
|
||||||
|
dir = File.dirname(file)
|
||||||
|
|
||||||
|
ENV["PATH"] = "#{dir}/../../bin:#{ENV["PATH"]}"
|
||||||
|
ENV["RUBYOPT"] = "-r#{file} #{ENV["RUBYOPT"]}"
|
||||||
|
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rdoc-2.4.3/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rdoc-2.4.3/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/configuration-1.1.0/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/configuration-1.1.0/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/builder-2.1.2/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/builder-2.1.2/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/daemons-1.0.10/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/daemons-1.0.10/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/extlib-0.9.13/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/extlib-0.9.13/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/json-1.2.0/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/json-1.2.0/ext/json/ext")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/json-1.2.0/ext")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/json-1.2.0/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/eventmachine-0.12.10/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/eventmachine-0.12.10/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-1.0.1/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-1.0.1/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/shotgun-0.4/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/shotgun-0.4/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-test-0.5.1/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rack-test-0.5.1/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sinatra-0.9.4/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sinatra-0.9.4/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/thin-1.2.5/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/thin-1.2.5/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sdoc-0.2.14.1/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sdoc-0.2.14.1/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/yui-compressor-0.9.1/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/yui-compressor-0.9.1/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/polyglot-0.2.9/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/polyglot-0.2.9/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/treetop-1.4.2/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/treetop-1.4.2/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rake-0.8.7/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rake-0.8.7/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/launchy-0.3.3/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/launchy-0.3.3/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sprockets-1.0.2/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sprockets-1.0.2/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/haml-2.2.13/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/haml-2.2.13/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/diff-lcs-1.1.2/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/diff-lcs-1.1.2/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rspec-1.2.9/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/rspec-1.2.9/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/highline-1.5.1/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/highline-1.5.1/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/templater-1.0.0/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/templater-1.0.0/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/term-ansicolor-1.0.4/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/term-ansicolor-1.0.4/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/cucumber-0.4.4/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/cucumber-0.4.4/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sinatra-content-for-0.2/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/sinatra-content-for-0.2/lib")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/compass-0.8.17/bin")
|
||||||
|
$LOAD_PATH.unshift File.expand_path("#{dir}/gems/compass-0.8.17/lib")
|
||||||
|
|
||||||
|
@gemfile = "#{dir}/../../Gemfile"
|
||||||
|
|
||||||
|
require "rubygems"
|
||||||
|
|
||||||
|
@bundled_specs = {}
|
||||||
|
@bundled_specs["rdoc"] = eval(File.read("#{dir}/specifications/rdoc-2.4.3.gemspec"))
|
||||||
|
@bundled_specs["rdoc"].loaded_from = "#{dir}/specifications/rdoc-2.4.3.gemspec"
|
||||||
|
@bundled_specs["configuration"] = eval(File.read("#{dir}/specifications/configuration-1.1.0.gemspec"))
|
||||||
|
@bundled_specs["configuration"].loaded_from = "#{dir}/specifications/configuration-1.1.0.gemspec"
|
||||||
|
@bundled_specs["builder"] = eval(File.read("#{dir}/specifications/builder-2.1.2.gemspec"))
|
||||||
|
@bundled_specs["builder"].loaded_from = "#{dir}/specifications/builder-2.1.2.gemspec"
|
||||||
|
@bundled_specs["daemons"] = eval(File.read("#{dir}/specifications/daemons-1.0.10.gemspec"))
|
||||||
|
@bundled_specs["daemons"].loaded_from = "#{dir}/specifications/daemons-1.0.10.gemspec"
|
||||||
|
@bundled_specs["extlib"] = eval(File.read("#{dir}/specifications/extlib-0.9.13.gemspec"))
|
||||||
|
@bundled_specs["extlib"].loaded_from = "#{dir}/specifications/extlib-0.9.13.gemspec"
|
||||||
|
@bundled_specs["json"] = eval(File.read("#{dir}/specifications/json-1.2.0.gemspec"))
|
||||||
|
@bundled_specs["json"].loaded_from = "#{dir}/specifications/json-1.2.0.gemspec"
|
||||||
|
@bundled_specs["eventmachine"] = eval(File.read("#{dir}/specifications/eventmachine-0.12.10.gemspec"))
|
||||||
|
@bundled_specs["eventmachine"].loaded_from = "#{dir}/specifications/eventmachine-0.12.10.gemspec"
|
||||||
|
@bundled_specs["rack"] = eval(File.read("#{dir}/specifications/rack-1.0.1.gemspec"))
|
||||||
|
@bundled_specs["rack"].loaded_from = "#{dir}/specifications/rack-1.0.1.gemspec"
|
||||||
|
@bundled_specs["shotgun"] = eval(File.read("#{dir}/specifications/shotgun-0.4.gemspec"))
|
||||||
|
@bundled_specs["shotgun"].loaded_from = "#{dir}/specifications/shotgun-0.4.gemspec"
|
||||||
|
@bundled_specs["rack-test"] = eval(File.read("#{dir}/specifications/rack-test-0.5.1.gemspec"))
|
||||||
|
@bundled_specs["rack-test"].loaded_from = "#{dir}/specifications/rack-test-0.5.1.gemspec"
|
||||||
|
@bundled_specs["sinatra"] = eval(File.read("#{dir}/specifications/sinatra-0.9.4.gemspec"))
|
||||||
|
@bundled_specs["sinatra"].loaded_from = "#{dir}/specifications/sinatra-0.9.4.gemspec"
|
||||||
|
@bundled_specs["thin"] = eval(File.read("#{dir}/specifications/thin-1.2.5.gemspec"))
|
||||||
|
@bundled_specs["thin"].loaded_from = "#{dir}/specifications/thin-1.2.5.gemspec"
|
||||||
|
@bundled_specs["sdoc"] = eval(File.read("#{dir}/specifications/sdoc-0.2.14.1.gemspec"))
|
||||||
|
@bundled_specs["sdoc"].loaded_from = "#{dir}/specifications/sdoc-0.2.14.1.gemspec"
|
||||||
|
@bundled_specs["yui-compressor"] = eval(File.read("#{dir}/specifications/yui-compressor-0.9.1.gemspec"))
|
||||||
|
@bundled_specs["yui-compressor"].loaded_from = "#{dir}/specifications/yui-compressor-0.9.1.gemspec"
|
||||||
|
@bundled_specs["polyglot"] = eval(File.read("#{dir}/specifications/polyglot-0.2.9.gemspec"))
|
||||||
|
@bundled_specs["polyglot"].loaded_from = "#{dir}/specifications/polyglot-0.2.9.gemspec"
|
||||||
|
@bundled_specs["treetop"] = eval(File.read("#{dir}/specifications/treetop-1.4.2.gemspec"))
|
||||||
|
@bundled_specs["treetop"].loaded_from = "#{dir}/specifications/treetop-1.4.2.gemspec"
|
||||||
|
@bundled_specs["rake"] = eval(File.read("#{dir}/specifications/rake-0.8.7.gemspec"))
|
||||||
|
@bundled_specs["rake"].loaded_from = "#{dir}/specifications/rake-0.8.7.gemspec"
|
||||||
|
@bundled_specs["launchy"] = eval(File.read("#{dir}/specifications/launchy-0.3.3.gemspec"))
|
||||||
|
@bundled_specs["launchy"].loaded_from = "#{dir}/specifications/launchy-0.3.3.gemspec"
|
||||||
|
@bundled_specs["sprockets"] = eval(File.read("#{dir}/specifications/sprockets-1.0.2.gemspec"))
|
||||||
|
@bundled_specs["sprockets"].loaded_from = "#{dir}/specifications/sprockets-1.0.2.gemspec"
|
||||||
|
@bundled_specs["haml"] = eval(File.read("#{dir}/specifications/haml-2.2.13.gemspec"))
|
||||||
|
@bundled_specs["haml"].loaded_from = "#{dir}/specifications/haml-2.2.13.gemspec"
|
||||||
|
@bundled_specs["diff-lcs"] = eval(File.read("#{dir}/specifications/diff-lcs-1.1.2.gemspec"))
|
||||||
|
@bundled_specs["diff-lcs"].loaded_from = "#{dir}/specifications/diff-lcs-1.1.2.gemspec"
|
||||||
|
@bundled_specs["rspec"] = eval(File.read("#{dir}/specifications/rspec-1.2.9.gemspec"))
|
||||||
|
@bundled_specs["rspec"].loaded_from = "#{dir}/specifications/rspec-1.2.9.gemspec"
|
||||||
|
@bundled_specs["highline"] = eval(File.read("#{dir}/specifications/highline-1.5.1.gemspec"))
|
||||||
|
@bundled_specs["highline"].loaded_from = "#{dir}/specifications/highline-1.5.1.gemspec"
|
||||||
|
@bundled_specs["templater"] = eval(File.read("#{dir}/specifications/templater-1.0.0.gemspec"))
|
||||||
|
@bundled_specs["templater"].loaded_from = "#{dir}/specifications/templater-1.0.0.gemspec"
|
||||||
|
@bundled_specs["term-ansicolor"] = eval(File.read("#{dir}/specifications/term-ansicolor-1.0.4.gemspec"))
|
||||||
|
@bundled_specs["term-ansicolor"].loaded_from = "#{dir}/specifications/term-ansicolor-1.0.4.gemspec"
|
||||||
|
@bundled_specs["cucumber"] = eval(File.read("#{dir}/specifications/cucumber-0.4.4.gemspec"))
|
||||||
|
@bundled_specs["cucumber"].loaded_from = "#{dir}/specifications/cucumber-0.4.4.gemspec"
|
||||||
|
@bundled_specs["sinatra-content-for"] = eval(File.read("#{dir}/specifications/sinatra-content-for-0.2.gemspec"))
|
||||||
|
@bundled_specs["sinatra-content-for"].loaded_from = "#{dir}/specifications/sinatra-content-for-0.2.gemspec"
|
||||||
|
@bundled_specs["compass"] = eval(File.read("#{dir}/specifications/compass-0.8.17.gemspec"))
|
||||||
|
@bundled_specs["compass"].loaded_from = "#{dir}/specifications/compass-0.8.17.gemspec"
|
||||||
|
|
||||||
|
def self.add_specs_to_loaded_specs
|
||||||
|
Gem.loaded_specs.merge! @bundled_specs
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.add_specs_to_index
|
||||||
|
@bundled_specs.each do |name, spec|
|
||||||
|
Gem.source_index.add_spec spec
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
add_specs_to_loaded_specs
|
||||||
|
add_specs_to_index
|
||||||
|
|
||||||
|
def self.require_env(env = nil)
|
||||||
|
context = Class.new do
|
||||||
|
def initialize(env) @env = env && env.to_s ; end
|
||||||
|
def method_missing(*) ; yield if block_given? ; end
|
||||||
|
def only(*env)
|
||||||
|
old, @only = @only, _combine_only(env.flatten)
|
||||||
|
yield
|
||||||
|
@only = old
|
||||||
|
end
|
||||||
|
def except(*env)
|
||||||
|
old, @except = @except, _combine_except(env.flatten)
|
||||||
|
yield
|
||||||
|
@except = old
|
||||||
|
end
|
||||||
|
def gem(name, *args)
|
||||||
|
opt = args.last.is_a?(Hash) ? args.pop : {}
|
||||||
|
only = _combine_only(opt[:only] || opt["only"])
|
||||||
|
except = _combine_except(opt[:except] || opt["except"])
|
||||||
|
files = opt[:require_as] || opt["require_as"] || name
|
||||||
|
files = [files] unless files.respond_to?(:each)
|
||||||
|
|
||||||
|
return unless !only || only.any? {|e| e == @env }
|
||||||
|
return if except && except.any? {|e| e == @env }
|
||||||
|
|
||||||
|
if files = opt[:require_as] || opt["require_as"]
|
||||||
|
files = Array(files)
|
||||||
|
files.each { |f| require f }
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
require name
|
||||||
|
rescue LoadError
|
||||||
|
# Do nothing
|
||||||
|
end
|
||||||
|
end
|
||||||
|
yield if block_given?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
private
|
||||||
|
def _combine_only(only)
|
||||||
|
return @only unless only
|
||||||
|
only = [only].flatten.compact.uniq.map { |o| o.to_s }
|
||||||
|
only &= @only if @only
|
||||||
|
only
|
||||||
|
end
|
||||||
|
def _combine_except(except)
|
||||||
|
return @except unless except
|
||||||
|
except = [except].flatten.compact.uniq.map { |o| o.to_s }
|
||||||
|
except |= @except if @except
|
||||||
|
except
|
||||||
|
end
|
||||||
|
end
|
||||||
|
context.new(env && env.to_s).instance_eval(File.read(@gemfile), @gemfile, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
module Gem
|
||||||
|
@loaded_stacks = Hash.new { |h,k| h[k] = [] }
|
||||||
|
|
||||||
|
def source_index.refresh!
|
||||||
|
super
|
||||||
|
Bundler.add_specs_to_index
|
||||||
|
end
|
||||||
|
end
|
85
vendor/gems/gems/builder-2.1.2/CHANGES
vendored
Executable file
85
vendor/gems/gems/builder-2.1.2/CHANGES
vendored
Executable file
|
@ -0,0 +1,85 @@
|
||||||
|
= Change Log
|
||||||
|
|
||||||
|
== Version 2.1.2
|
||||||
|
|
||||||
|
* Fixed bug where private methods in kernel could leak through using
|
||||||
|
tag!(). Thanks to Hagen Overdick for finding and diagnosing this
|
||||||
|
bug.
|
||||||
|
|
||||||
|
|
||||||
|
== Version 2.1.1
|
||||||
|
|
||||||
|
* Fixed typo in XmlMarkup class docs (ident => indent). (from Martin
|
||||||
|
Fowler).
|
||||||
|
* Removed extra directory indirection from legacy CVS to SVN move.
|
||||||
|
* Removed some extraneous tabs from source.
|
||||||
|
* Fixed test on private methods in blankslate to differentiate between
|
||||||
|
targetted and untargetted private methods.
|
||||||
|
* Removed legacy capture of @self in XmlBase (@self was used back when
|
||||||
|
we used instance eval).
|
||||||
|
* Added additional tests for global functions (both direct and included).
|
||||||
|
|
||||||
|
== Version 2.1.0
|
||||||
|
|
||||||
|
* Fixed bug in BlankSlate where including a module into Object could
|
||||||
|
cause methods to leak into BlankSlate.
|
||||||
|
* Made BlankSlate available as its own gem. Currently the builder gem
|
||||||
|
still directly includes the BlankSlate code.
|
||||||
|
* Added reveal capability to BlankSlate.
|
||||||
|
|
||||||
|
== Version 2.0.0
|
||||||
|
|
||||||
|
* Added doc directory
|
||||||
|
* Added unit tests for XmlEvents.
|
||||||
|
* Added XChar module and used it in the _escape method.
|
||||||
|
* Attributes are now quoted by default when strings. Use Symbol
|
||||||
|
attribute values for unquoted behavior.
|
||||||
|
|
||||||
|
== Version 1.2.4
|
||||||
|
|
||||||
|
* Added a cdata! command to an XML Builder (from Josh Knowles).
|
||||||
|
|
||||||
|
== Version 1.2.3
|
||||||
|
|
||||||
|
The attributes in the <?xml ... ?> instruction will be ordered:
|
||||||
|
version, encoding, standalone.
|
||||||
|
|
||||||
|
== Version 1.2.2
|
||||||
|
|
||||||
|
Another fix for BlankSlate. The Kernal/Object traps added in 1.2.1
|
||||||
|
failed when a method was defined late more than once. Since the
|
||||||
|
method was already marked as removed, another attempt to undefine it
|
||||||
|
raised an error. The fix was to check the list of instance methods
|
||||||
|
before attempting the undef operation. Thanks to Florian Gross and
|
||||||
|
David Heinemeier Hansson for the patch.
|
||||||
|
|
||||||
|
== Version 1.2.1
|
||||||
|
|
||||||
|
BlankSlate now traps method definitions in Kernel and Object to avoid
|
||||||
|
late method definitions inadvertently becoming part of the definition
|
||||||
|
of BlankSlate as well.
|
||||||
|
|
||||||
|
== Version 1.2.0
|
||||||
|
|
||||||
|
Improved support for entity declarations by allowing nested
|
||||||
|
declarations and removal of the attribute processing.
|
||||||
|
|
||||||
|
Added namespace support.
|
||||||
|
|
||||||
|
== Version 1.1.0
|
||||||
|
|
||||||
|
Added support for comments, entity declarations and processing instructions.
|
||||||
|
|
||||||
|
== Version 1.0.0
|
||||||
|
|
||||||
|
Removed use of <tt>instace_eval</tt> making the use of XmlMarkup much
|
||||||
|
less prone to error.
|
||||||
|
|
||||||
|
== Version 0.1.1
|
||||||
|
|
||||||
|
Bug fix.
|
||||||
|
|
||||||
|
== Version 0.1.0
|
||||||
|
|
||||||
|
Initial version release.
|
||||||
|
|
210
vendor/gems/gems/builder-2.1.2/README
vendored
Executable file
210
vendor/gems/gems/builder-2.1.2/README
vendored
Executable file
|
@ -0,0 +1,210 @@
|
||||||
|
= Project: Builder
|
||||||
|
|
||||||
|
== Goal
|
||||||
|
|
||||||
|
Provide a simple way to create XML markup and data structures.
|
||||||
|
|
||||||
|
== Classes
|
||||||
|
|
||||||
|
Builder::XmlMarkup:: Generate XML markup notiation
|
||||||
|
Builder::XmlEvents:: Generate XML events (i.e. SAX-like)
|
||||||
|
|
||||||
|
<b>Notes</b>::
|
||||||
|
|
||||||
|
* An <tt>Builder::XmlTree</tt> class to generate XML tree
|
||||||
|
(i.e. DOM-like) structures is also planned, but not yet implemented.
|
||||||
|
Also, the events builder is currently lagging the markup builder in
|
||||||
|
features.
|
||||||
|
|
||||||
|
== Usage
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require_gem 'builder', '~> 2.0'
|
||||||
|
|
||||||
|
builder = Builder::XmlMarkup.new
|
||||||
|
xml = builder.person { |b| b.name("Jim"); b.phone("555-1234") }
|
||||||
|
xml #=> <person><name>Jim</name><phone>555-1234</phone></person>
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require_gem 'builder'
|
||||||
|
|
||||||
|
builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2)
|
||||||
|
builder.person { |b| b.name("Jim"); b.phone("555-1234") }
|
||||||
|
#
|
||||||
|
# Prints:
|
||||||
|
# <person>
|
||||||
|
# <name>Jim</name>
|
||||||
|
# <phone>555-1234</phone>
|
||||||
|
# </person>
|
||||||
|
|
||||||
|
== Compatibility
|
||||||
|
|
||||||
|
=== Version 2.0.0 Compatibility Changes
|
||||||
|
|
||||||
|
Version 2.0.0 introduces automatically escaped attribute values for
|
||||||
|
the first time. Versions prior to 2.0.0 did not insert escape
|
||||||
|
characters into attribute values in the XML markup. This allowed
|
||||||
|
attribute values to explicitly reference entities, which was
|
||||||
|
occasionally used by a small number of developers. Since strings
|
||||||
|
could always be explicitly escaped by hand, this was not a major
|
||||||
|
restriction in functionality.
|
||||||
|
|
||||||
|
However, it did suprise most users of builder. Since the body text is
|
||||||
|
normally escaped, everybody expected the attribute values to be
|
||||||
|
escaped as well. Escaped attribute values were the number one support
|
||||||
|
request on the 1.x Builder series.
|
||||||
|
|
||||||
|
Starting with Builder version 2.0.0, all attribute values expressed as
|
||||||
|
strings will be processed and the appropriate characters will be
|
||||||
|
escaped (e.g. "&" will be tranlated to "&"). Attribute values
|
||||||
|
that are expressed as Symbol values will not be processed for escaped
|
||||||
|
characters and will be unchanged in output. (Yes, this probably counts
|
||||||
|
as Symbol abuse, but the convention is convenient and flexible).
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
xml = Builder::XmlMarkup.new
|
||||||
|
xml.sample(:escaped=>"This&That", :unescaped=>:"Here&There")
|
||||||
|
xml.target! =>
|
||||||
|
<sample escaped="This&That" unescaped="Here&There"/>
|
||||||
|
|
||||||
|
=== Version 1.0.0 Compatibility Changes
|
||||||
|
|
||||||
|
Version 1.0.0 introduces some changes that are not backwards
|
||||||
|
compatible with earlier releases of builder. The main areas of
|
||||||
|
incompatibility are:
|
||||||
|
|
||||||
|
* Keyword based arguments to +new+ (rather than positional based). It
|
||||||
|
was found that a developer would often like to specify indentation
|
||||||
|
without providing an explicit target, or specify a target without
|
||||||
|
indentation. Keyword based arguments handle this situation nicely.
|
||||||
|
|
||||||
|
* Builder must now be an explicit target for markup tags. Instead of
|
||||||
|
writing
|
||||||
|
|
||||||
|
xml_markup = Builder::XmlMarkup.new
|
||||||
|
xml_markup.div { strong("text") }
|
||||||
|
|
||||||
|
you need to write
|
||||||
|
|
||||||
|
xml_markup = Builder::XmlMarkup.new
|
||||||
|
xml_markup.div { xml_markup.strong("text") }
|
||||||
|
|
||||||
|
* The builder object is passed as a parameter to all nested markup
|
||||||
|
blocks. This allows you to create a short alias for the builder
|
||||||
|
object that can be used within the block. For example, the previous
|
||||||
|
example can be written as:
|
||||||
|
|
||||||
|
xml_markup = Builder::XmlMarkup.new
|
||||||
|
xml_markup.div { |xml| xml.strong("text") }
|
||||||
|
|
||||||
|
* If you have both a pre-1.0 and a post-1.0 gem of builder installed,
|
||||||
|
you can choose which version to use through the RubyGems
|
||||||
|
+require_gem+ facility.
|
||||||
|
|
||||||
|
require_gem 'builder', "~> 0.0" # Gets the old version
|
||||||
|
require_gem 'builder', "~> 1.0" # Gets the new version
|
||||||
|
|
||||||
|
== Features
|
||||||
|
|
||||||
|
* XML Comments are supported ...
|
||||||
|
|
||||||
|
xml_markup.comment! "This is a comment"
|
||||||
|
#=> <!-- This is a comment -->
|
||||||
|
|
||||||
|
* XML processing instructions are supported ...
|
||||||
|
|
||||||
|
xml_markup.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
|
||||||
|
#=> <?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
If the processing instruction is omitted, it defaults to "xml".
|
||||||
|
When the processing instruction is "xml", the defaults attributes
|
||||||
|
are:
|
||||||
|
|
||||||
|
<b>version</b>:: 1.0
|
||||||
|
<b>encoding</b>:: "UTF-8"
|
||||||
|
|
||||||
|
* XML entity declarations are now supported to a small degree.
|
||||||
|
|
||||||
|
xml_markup.declare! :DOCTYPE, :chapter, :SYSTEM, "../dtds/chapter.dtd"
|
||||||
|
#=> <!DOCTYPE chapter SYSTEM "../dtds/chapter.dtd">
|
||||||
|
|
||||||
|
The parameters to a declare! method must be either symbols or
|
||||||
|
strings. Symbols are inserted without quotes, and strings are
|
||||||
|
inserted with double quotes. Attribute-like arguments in hashes are
|
||||||
|
not allowed.
|
||||||
|
|
||||||
|
If you need to have an argument to declare! be inserted without
|
||||||
|
quotes, but the arguement does not conform to the typical Ruby
|
||||||
|
syntax for symbols, then use the :"string" form to specify a symbol.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
xml_markup.declare! :ELEMENT, :chapter, :"(title,para+)"
|
||||||
|
#=> <!ELEMENT chapter (title,para+)>
|
||||||
|
|
||||||
|
Nested entity declarations are allowed. For example:
|
||||||
|
|
||||||
|
@xml_markup.declare! :DOCTYPE, :chapter do |x|
|
||||||
|
x.declare! :ELEMENT, :chapter, :"(title,para+)"
|
||||||
|
x.declare! :ELEMENT, :title, :"(#PCDATA)"
|
||||||
|
x.declare! :ELEMENT, :para, :"(#PCDATA)"
|
||||||
|
end
|
||||||
|
|
||||||
|
#=>
|
||||||
|
|
||||||
|
<!DOCTYPE chapter [
|
||||||
|
<!ELEMENT chapter (title,para+)>
|
||||||
|
<!ELEMENT title (#PCDATA)>
|
||||||
|
<!ELEMENT para (#PCDATA)>
|
||||||
|
]>
|
||||||
|
|
||||||
|
* Some support for XML namespaces is now available. If the first
|
||||||
|
argument to a tag call is a symbol, it will be joined to the tag to
|
||||||
|
produce a namespace:tag combination. It is easier to show this than
|
||||||
|
describe it.
|
||||||
|
|
||||||
|
xml.SOAP :Envelope do ... end
|
||||||
|
|
||||||
|
Just put a space before the colon in a namespace to produce the
|
||||||
|
right form for builder (e.g. "<tt>SOAP:Envelope</tt>" =>
|
||||||
|
"<tt>xml.SOAP :Envelope</tt>")
|
||||||
|
|
||||||
|
* String attribute values are <em>now</em> escaped by default by
|
||||||
|
Builder (<b>NOTE:</b> this is _new_ behavior as of version 2.0).
|
||||||
|
|
||||||
|
However, occasionally you need to use entities in attribute values.
|
||||||
|
Using a symbols (rather than a string) for an attribute value will
|
||||||
|
cause Builder to not run its quoting/escaping algorithm on that
|
||||||
|
particular value.
|
||||||
|
|
||||||
|
(<b>Note:</b> The +escape_attrs+ option for builder is now
|
||||||
|
obsolete).
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
xml = Builder::XmlMarkup.new
|
||||||
|
xml.sample(:escaped=>"This&That", :unescaped=>:"Here&There")
|
||||||
|
xml.target! =>
|
||||||
|
<sample escaped="This&That" unescaped="Here&There"/>
|
||||||
|
|
||||||
|
* UTF-8 Support
|
||||||
|
|
||||||
|
Builder correctly translates UTF-8 characters into valid XML. (New
|
||||||
|
in version 2.0.0). Thanks to Sam Ruby for the translation code.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
xml = Builder::Markup.new
|
||||||
|
xml.sample("Iñtërnâtiônàl")
|
||||||
|
xml.target! =>
|
||||||
|
"<sample>Iñtërnâtiônàl</sample>"
|
||||||
|
|
||||||
|
== Contact
|
||||||
|
|
||||||
|
Author:: Jim Weirich
|
||||||
|
Email:: jim@weirichhouse.org
|
||||||
|
Home Page:: http://onestepback.org
|
||||||
|
License:: MIT Licence (http://www.opensource.org/licenses/mit-license.html)
|
263
vendor/gems/gems/builder-2.1.2/Rakefile
vendored
Executable file
263
vendor/gems/gems/builder-2.1.2/Rakefile
vendored
Executable file
|
@ -0,0 +1,263 @@
|
||||||
|
# Rakefile for rake -*- ruby -*-
|
||||||
|
|
||||||
|
# Copyright 2004, 2005, 2006 by Jim Weirich (jim@weirichhouse.org).
|
||||||
|
# All rights reserved.
|
||||||
|
|
||||||
|
# Permission is granted for use, copying, modification, distribution,
|
||||||
|
# and distribution of modified versions of this work as long as the
|
||||||
|
# above copyright notice is included.
|
||||||
|
|
||||||
|
require 'rake/clean'
|
||||||
|
require 'rake/testtask'
|
||||||
|
require 'rake/rdoctask'
|
||||||
|
begin
|
||||||
|
require 'rubygems'
|
||||||
|
require 'rake/gempackagetask'
|
||||||
|
rescue Exception
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# Determine the current version of the software
|
||||||
|
|
||||||
|
CLOBBER.include('pkg')
|
||||||
|
|
||||||
|
CURRENT_VERSION = '2.1.2'
|
||||||
|
PKG_VERSION = ENV['REL'] ? ENV['REL'] : CURRENT_VERSION
|
||||||
|
|
||||||
|
SRC_RB = FileList['lib/**/*.rb']
|
||||||
|
|
||||||
|
# The default task is run if rake is given no explicit arguments.
|
||||||
|
|
||||||
|
desc "Default Task"
|
||||||
|
task :default => :test_all
|
||||||
|
|
||||||
|
# Test Tasks ---------------------------------------------------------
|
||||||
|
|
||||||
|
desc "Run all tests"
|
||||||
|
task :test_all => [:test_units]
|
||||||
|
task :ta => [:test_all]
|
||||||
|
|
||||||
|
task :tu => [:test_units]
|
||||||
|
|
||||||
|
Rake::TestTask.new("test_units") do |t|
|
||||||
|
t.test_files = FileList['test/test*.rb']
|
||||||
|
t.verbose = false
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create a task to build the RDOC documentation tree.
|
||||||
|
|
||||||
|
rd = Rake::RDocTask.new("rdoc") { |rdoc|
|
||||||
|
rdoc.rdoc_dir = 'html'
|
||||||
|
rdoc.title = "Builder for Markup"
|
||||||
|
rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
|
||||||
|
rdoc.rdoc_files.include('lib/**/*.rb', '[A-Z]*', 'doc/**/*.rdoc')
|
||||||
|
rdoc.template = 'doc/jamis.rb'
|
||||||
|
}
|
||||||
|
|
||||||
|
# ====================================================================
|
||||||
|
# Create a task that will package the Rake software into distributable
|
||||||
|
# gem files.
|
||||||
|
|
||||||
|
PKG_FILES = FileList[
|
||||||
|
'lib/**/*.rb',
|
||||||
|
'test/**/*.rb',
|
||||||
|
'scripts/**/*.rb'
|
||||||
|
]
|
||||||
|
PKG_FILES.exclude('test/testcssbuilder.rb')
|
||||||
|
PKG_FILES.exclude('lib/builder/css.rb')
|
||||||
|
|
||||||
|
BLANKSLATE_FILES = FileList[
|
||||||
|
'lib/blankslate.rb',
|
||||||
|
'test/testblankslate.rb'
|
||||||
|
]
|
||||||
|
|
||||||
|
if ! defined?(Gem)
|
||||||
|
puts "Package Target requires RubyGEMs"
|
||||||
|
else
|
||||||
|
spec = Gem::Specification.new do |s|
|
||||||
|
|
||||||
|
#### Basic information.
|
||||||
|
|
||||||
|
s.name = 'builder'
|
||||||
|
s.version = PKG_VERSION
|
||||||
|
s.summary = "Builders for MarkUp."
|
||||||
|
s.description = %{\
|
||||||
|
Builder provides a number of builder objects that make creating structured data
|
||||||
|
simple to do. Currently the following builder objects are supported:
|
||||||
|
|
||||||
|
* XML Markup
|
||||||
|
* XML Events
|
||||||
|
}
|
||||||
|
|
||||||
|
s.files = PKG_FILES.to_a
|
||||||
|
s.require_path = 'lib'
|
||||||
|
s.autorequire = 'builder'
|
||||||
|
|
||||||
|
s.test_files = PKG_FILES.select { |fn| fn =~ /^test\/test/ }
|
||||||
|
|
||||||
|
s.has_rdoc = true
|
||||||
|
s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
|
||||||
|
s.rdoc_options <<
|
||||||
|
'--title' << 'Builder -- Easy XML Building' <<
|
||||||
|
'--main' << 'README' <<
|
||||||
|
'--line-numbers'
|
||||||
|
|
||||||
|
s.author = "Jim Weirich"
|
||||||
|
s.email = "jim@weirichhouse.org"
|
||||||
|
s.homepage = "http://onestepback.org"
|
||||||
|
end
|
||||||
|
|
||||||
|
blankslate_spec = Gem::Specification.new do |s|
|
||||||
|
|
||||||
|
#### Basic information.
|
||||||
|
|
||||||
|
s.name = 'blankslate'
|
||||||
|
s.version = PKG_VERSION
|
||||||
|
s.summary = "Blank Slate base class."
|
||||||
|
s.description = %{\
|
||||||
|
BlankSlate provides a base class where almost all of the methods from Object and
|
||||||
|
Kernel have been removed. This is useful when providing proxy object and other
|
||||||
|
classes that make heavy use of method_missing.
|
||||||
|
}
|
||||||
|
|
||||||
|
s.files = BLANKSLATE_FILES.to_a
|
||||||
|
s.require_path = 'lib'
|
||||||
|
s.autorequire = 'builder'
|
||||||
|
|
||||||
|
s.test_files = PKG_FILES.select { |fn| fn =~ /^test\/test/ }
|
||||||
|
|
||||||
|
s.has_rdoc = true
|
||||||
|
s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
|
||||||
|
s.rdoc_options <<
|
||||||
|
'--title' << 'BlankSlate -- Base Class for building proxies.' <<
|
||||||
|
'--main' << 'README' <<
|
||||||
|
'--line-numbers'
|
||||||
|
|
||||||
|
s.author = "Jim Weirich"
|
||||||
|
s.email = "jim@weirichhouse.org"
|
||||||
|
s.homepage = "http://onestepback.org"
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace 'builder' do
|
||||||
|
Rake::GemPackageTask.new(spec) do |t|
|
||||||
|
t.need_tar = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace 'blankslate' do
|
||||||
|
Rake::GemPackageTask.new(blankslate_spec) do |t|
|
||||||
|
t.need_tar = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
task :package => ['builder:package', 'blankslate:package']
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Look for Debugging print lines"
|
||||||
|
task :dbg do
|
||||||
|
FileList['**/*.rb'].egrep /\bDBG|\bbreakpoint\b/
|
||||||
|
end
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------
|
||||||
|
# Creating a release
|
||||||
|
|
||||||
|
def announce(msg='')
|
||||||
|
STDERR.puts msg
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Make a new release"
|
||||||
|
task :release => [
|
||||||
|
:prerelease,
|
||||||
|
:clobber,
|
||||||
|
:test_all,
|
||||||
|
:update_version,
|
||||||
|
:package,
|
||||||
|
:tag] do
|
||||||
|
|
||||||
|
announce
|
||||||
|
announce "**************************************************************"
|
||||||
|
announce "* Release #{PKG_VERSION} Complete."
|
||||||
|
announce "* Packages ready to upload."
|
||||||
|
announce "**************************************************************"
|
||||||
|
announce
|
||||||
|
end
|
||||||
|
|
||||||
|
# Validate that everything is ready to go for a release.
|
||||||
|
task :prerelease do
|
||||||
|
announce
|
||||||
|
announce "**************************************************************"
|
||||||
|
announce "* Making RubyGem Release #{PKG_VERSION}"
|
||||||
|
announce "* (current version #{CURRENT_VERSION})"
|
||||||
|
announce "**************************************************************"
|
||||||
|
announce
|
||||||
|
|
||||||
|
# Is a release number supplied?
|
||||||
|
unless ENV['REL']
|
||||||
|
fail "Usage: rake release REL=x.y.z [REUSE=tag_suffix]"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Is the release different than the current release.
|
||||||
|
# (or is REUSE set?)
|
||||||
|
if PKG_VERSION == CURRENT_VERSION && ! ENV['REUSE']
|
||||||
|
fail "Current version is #{PKG_VERSION}, must specify REUSE=tag_suffix to reuse version"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Are all source files checked in?
|
||||||
|
if ENV['RELTEST']
|
||||||
|
announce "Release Task Testing, skipping checked-in file test"
|
||||||
|
else
|
||||||
|
announce "Checking for unchecked-in files..."
|
||||||
|
data = `cvs -q update`
|
||||||
|
unless data =~ /^$/
|
||||||
|
fail "CVS update is not clean ... do you have unchecked-in files?"
|
||||||
|
end
|
||||||
|
announce "No outstanding checkins found ... OK"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
task :update_version => [:prerelease] do
|
||||||
|
if PKG_VERSION == CURRENT_VERSION
|
||||||
|
announce "No version change ... skipping version update"
|
||||||
|
else
|
||||||
|
announce "Updating Builder version to #{PKG_VERSION}"
|
||||||
|
open("Rakefile") do |rakein|
|
||||||
|
open("Rakefile.new", "w") do |rakeout|
|
||||||
|
rakein.each do |line|
|
||||||
|
if line =~ /^CURRENT_VERSION\s*=\s*/
|
||||||
|
rakeout.puts "CURRENT_VERSION = '#{PKG_VERSION}'"
|
||||||
|
else
|
||||||
|
rakeout.puts line
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
mv "Rakefile.new", "Rakefile"
|
||||||
|
if ENV['RELTEST']
|
||||||
|
announce "Release Task Testing, skipping commiting of new version"
|
||||||
|
else
|
||||||
|
sh %{cvs commit -m "Updated to version #{PKG_VERSION}" Rakefile}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Tag all the CVS files with the latest release number (REL=x.y.z)"
|
||||||
|
task :tag => [:prerelease] do
|
||||||
|
reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}"
|
||||||
|
reltag << ENV['REUSE'].gsub(/\./, '_') if ENV['REUSE']
|
||||||
|
announce "Tagging CVS with [#{reltag}]"
|
||||||
|
if ENV['RELTEST']
|
||||||
|
announce "Release Task Testing, skipping CVS tagging"
|
||||||
|
else
|
||||||
|
sh %{cvs tag #{reltag}}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Install the jamis RDoc template"
|
||||||
|
task :install_jamis_template do
|
||||||
|
require 'rbconfig'
|
||||||
|
dest_dir = File.join(Config::CONFIG['rubylibdir'], "rdoc/generators/template/html")
|
||||||
|
fail "Unabled to write to #{dest_dir}" unless File.writable?(dest_dir)
|
||||||
|
install "doc/jamis.rb", dest_dir, :verbose => true
|
||||||
|
end
|
||||||
|
|
||||||
|
require 'scripts/publish'
|
31
vendor/gems/gems/builder-2.1.2/doc/releases/builder-1.2.4.rdoc
vendored
Executable file
31
vendor/gems/gems/builder-2.1.2/doc/releases/builder-1.2.4.rdoc
vendored
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
= Builder 1.2.4 Released.
|
||||||
|
|
||||||
|
Added a "CDATA" method to the XML Markup builder (from Josh Knowles).
|
||||||
|
|
||||||
|
== What is Builder?
|
||||||
|
|
||||||
|
Builder::XmlMarkup allows easy programmatic creation of XML markup.
|
||||||
|
For example:
|
||||||
|
|
||||||
|
builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2)
|
||||||
|
builder.person { |b| b.name("Jim"); b.phone("555-1234") }
|
||||||
|
puts builder.target!
|
||||||
|
|
||||||
|
will generate:
|
||||||
|
|
||||||
|
<person>
|
||||||
|
<name>Jim</name>
|
||||||
|
<phone>555-1234</phone>
|
||||||
|
</person>
|
||||||
|
|
||||||
|
== Availability
|
||||||
|
|
||||||
|
The easiest way to get and install builder is via RubyGems ...
|
||||||
|
|
||||||
|
gem install builder (you may need root/admin privileges)
|
||||||
|
|
||||||
|
== Thanks
|
||||||
|
|
||||||
|
* Josh Knowles for the cdata! patch.
|
||||||
|
|
||||||
|
-- Jim Weirich
|
46
vendor/gems/gems/builder-2.1.2/doc/releases/builder-2.0.0.rdoc
vendored
Executable file
46
vendor/gems/gems/builder-2.1.2/doc/releases/builder-2.0.0.rdoc
vendored
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
= Builder 2.0.0 Released.
|
||||||
|
|
||||||
|
== Changes in 2.0.0
|
||||||
|
|
||||||
|
* UTF-8 characters in data are now correctly translated to their XML
|
||||||
|
equivalents. (Thanks to Sam Ruby)
|
||||||
|
|
||||||
|
* Attribute values are now escaped by default. See the README
|
||||||
|
file for details.
|
||||||
|
|
||||||
|
<b>NOTE:</b> The escaping attribute values by default is different
|
||||||
|
than in previous releases of Builder. This makes version 2.0.0
|
||||||
|
somewhat incompatible with the 1.x series of Builder. If you use "&",
|
||||||
|
"<", or ">" in attributes values, you may have to change your
|
||||||
|
code. (Essentially you remove the manual escaping. The new way is
|
||||||
|
easier, believe me).
|
||||||
|
|
||||||
|
== What is Builder?
|
||||||
|
|
||||||
|
Builder::XmlMarkup is a library that allows easy programmatic creation
|
||||||
|
of XML markup. For example:
|
||||||
|
|
||||||
|
builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2)
|
||||||
|
builder.person { |b| b.name("Jim"); b.phone("555-1234") }
|
||||||
|
|
||||||
|
will generate:
|
||||||
|
|
||||||
|
<person>
|
||||||
|
<name>Jim</name>
|
||||||
|
<phone>555-1234</phone>
|
||||||
|
</person>
|
||||||
|
|
||||||
|
== Availability
|
||||||
|
|
||||||
|
The easiest way to get and install builder is via RubyGems ...
|
||||||
|
|
||||||
|
gem install builder (you may need root/admin privileges)
|
||||||
|
|
||||||
|
== Thanks
|
||||||
|
|
||||||
|
* Sam Ruby for the XChar module and the related UTF-8 translation
|
||||||
|
tools.
|
||||||
|
* Also to Sam Ruby for gently persuading me to start quoting attribute
|
||||||
|
values.
|
||||||
|
|
||||||
|
-- Jim Weirich
|
58
vendor/gems/gems/builder-2.1.2/doc/releases/builder-2.1.1.rdoc
vendored
Executable file
58
vendor/gems/gems/builder-2.1.2/doc/releases/builder-2.1.1.rdoc
vendored
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
= Builder 2.1.1 Released.
|
||||||
|
|
||||||
|
Release 2.1.1 of Builder is mainly a bug fix release.
|
||||||
|
|
||||||
|
== Changes in 2.1.1
|
||||||
|
|
||||||
|
* Added <tt>reveal</tt> capability to BlankSlate.
|
||||||
|
|
||||||
|
* Fixed a bug in BlankSlate where including a module into Object could
|
||||||
|
cause methods to leak into BlankSlate.
|
||||||
|
|
||||||
|
* Fixed typo in XmlMarkup class docs (from Martin Fowler).
|
||||||
|
|
||||||
|
* Fixed test on private methods to differentiate between targetted and
|
||||||
|
untargetted private methods.
|
||||||
|
|
||||||
|
* Removed legacy capture of @self in XmlBase (@self was used back when
|
||||||
|
we used instance eval).
|
||||||
|
|
||||||
|
* Added additional tests for global functions (both direct and
|
||||||
|
included).
|
||||||
|
|
||||||
|
* Several misc internal cleanups, including rearranging the source
|
||||||
|
code tree.
|
||||||
|
|
||||||
|
<b>NOTE:</b> The escaping attribute values by default is different
|
||||||
|
than in previous releases of Builder. This makes version 2.0.x
|
||||||
|
somewhat incompatible with the 1.x series of Builder. If you use "&",
|
||||||
|
"<", or ">" in attributes values, you may have to change your
|
||||||
|
code. (Essentially you remove the manual escaping. The new way is
|
||||||
|
easier, believe me).
|
||||||
|
|
||||||
|
== What is Builder?
|
||||||
|
|
||||||
|
Builder::XmlMarkup is a library that allows easy programmatic creation
|
||||||
|
of XML markup. For example:
|
||||||
|
|
||||||
|
builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2)
|
||||||
|
builder.person { |b| b.name("Jim"); b.phone("555-1234") }
|
||||||
|
|
||||||
|
will generate:
|
||||||
|
|
||||||
|
<person>
|
||||||
|
<name>Jim</name>
|
||||||
|
<phone>555-1234</phone>
|
||||||
|
</person>
|
||||||
|
|
||||||
|
== Availability
|
||||||
|
|
||||||
|
The easiest way to get and install builder is via RubyGems ...
|
||||||
|
|
||||||
|
gem install builder (you may need root/admin privileges)
|
||||||
|
|
||||||
|
== Thanks
|
||||||
|
|
||||||
|
* Martin Fowler for spotting some typos in the documentation.
|
||||||
|
|
||||||
|
-- Jim Weirich
|
113
vendor/gems/gems/builder-2.1.2/lib/blankslate.rb
vendored
Executable file
113
vendor/gems/gems/builder-2.1.2/lib/blankslate.rb
vendored
Executable file
|
@ -0,0 +1,113 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#--
|
||||||
|
# Copyright 2004, 2006 by Jim Weirich (jim@weirichhouse.org).
|
||||||
|
# All rights reserved.
|
||||||
|
|
||||||
|
# Permission is granted for use, copying, modification, distribution,
|
||||||
|
# and distribution of modified versions of this work as long as the
|
||||||
|
# above copyright notice is included.
|
||||||
|
#++
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# BlankSlate provides an abstract base class with no predefined
|
||||||
|
# methods (except for <tt>\_\_send__</tt> and <tt>\_\_id__</tt>).
|
||||||
|
# BlankSlate is useful as a base class when writing classes that
|
||||||
|
# depend upon <tt>method_missing</tt> (e.g. dynamic proxies).
|
||||||
|
#
|
||||||
|
class BlankSlate
|
||||||
|
class << self
|
||||||
|
|
||||||
|
# Hide the method named +name+ in the BlankSlate class. Don't
|
||||||
|
# hide +instance_eval+ or any method beginning with "__".
|
||||||
|
def hide(name)
|
||||||
|
if instance_methods.include?(name.to_s) and
|
||||||
|
name !~ /^(__|instance_eval)/
|
||||||
|
@hidden_methods ||= {}
|
||||||
|
@hidden_methods[name.to_sym] = instance_method(name)
|
||||||
|
undef_method name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_hidden_method(name)
|
||||||
|
@hidden_methods ||= {}
|
||||||
|
@hidden_methods[name] || superclass.find_hidden_method(name)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Redefine a previously hidden method so that it may be called on a blank
|
||||||
|
# slate object.
|
||||||
|
def reveal(name)
|
||||||
|
bound_method = nil
|
||||||
|
unbound_method = find_hidden_method(name)
|
||||||
|
fail "Don't know how to reveal method '#{name}'" unless unbound_method
|
||||||
|
define_method(name) do |*args|
|
||||||
|
bound_method ||= unbound_method.bind(self)
|
||||||
|
bound_method.call(*args)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
instance_methods.each { |m| hide(m) }
|
||||||
|
end
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Since Ruby is very dynamic, methods added to the ancestors of
|
||||||
|
# BlankSlate <em>after BlankSlate is defined</em> will show up in the
|
||||||
|
# list of available BlankSlate methods. We handle this by defining a
|
||||||
|
# hook in the Object and Kernel classes that will hide any method
|
||||||
|
# defined after BlankSlate has been loaded.
|
||||||
|
#
|
||||||
|
module Kernel
|
||||||
|
class << self
|
||||||
|
alias_method :blank_slate_method_added, :method_added
|
||||||
|
|
||||||
|
# Detect method additions to Kernel and remove them in the
|
||||||
|
# BlankSlate class.
|
||||||
|
def method_added(name)
|
||||||
|
result = blank_slate_method_added(name)
|
||||||
|
return result if self != Kernel
|
||||||
|
BlankSlate.hide(name)
|
||||||
|
result
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Same as above, except in Object.
|
||||||
|
#
|
||||||
|
class Object
|
||||||
|
class << self
|
||||||
|
alias_method :blank_slate_method_added, :method_added
|
||||||
|
|
||||||
|
# Detect method additions to Object and remove them in the
|
||||||
|
# BlankSlate class.
|
||||||
|
def method_added(name)
|
||||||
|
result = blank_slate_method_added(name)
|
||||||
|
return result if self != Object
|
||||||
|
BlankSlate.hide(name)
|
||||||
|
result
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_hidden_method(name)
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Also, modules included into Object need to be scanned and have their
|
||||||
|
# instance methods removed from blank slate. In theory, modules
|
||||||
|
# included into Kernel would have to be removed as well, but a
|
||||||
|
# "feature" of Ruby prevents late includes into modules from being
|
||||||
|
# exposed in the first place.
|
||||||
|
#
|
||||||
|
class Module
|
||||||
|
alias blankslate_original_append_features append_features
|
||||||
|
def append_features(mod)
|
||||||
|
result = blankslate_original_append_features(mod)
|
||||||
|
return result if mod != Object
|
||||||
|
instance_methods.each do |name|
|
||||||
|
BlankSlate.hide(name)
|
||||||
|
end
|
||||||
|
result
|
||||||
|
end
|
||||||
|
end
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue