From d601f0844576fabfb547c4180532b78f251a243c Mon Sep 17 00:00:00 2001 From: Stefan Rusterholz Date: Sat, 28 Apr 2012 23:47:31 +0200 Subject: [PATCH] Initial commit. --- .gitignore | 1 + .yardoc/checksums | 9 + .yardoc/objects/root.dat | Bin 0 -> 61411 bytes .yardoc/proxy_types | Bin 0 -> 45 bytes README.markdown | 52 + Rakefile | 10 + development/.gitkeep | 0 development/TODO.markdown | 12 + directory_template.gemspec | 38 + doc/DirectoryTemplate.html | 2198 +++++++++++++++++ doc/DirectoryTemplate/BlankSlate.html | 399 +++ doc/DirectoryTemplate/ErbTemplate.html | 827 +++++++ .../ErbTemplate/Variables.html | 724 ++++++ doc/DirectoryTemplate/ProcessData.html | 1220 +++++++++ doc/DirectoryTemplate/Processor.html | 870 +++++++ doc/Kernel.html | 246 ++ doc/Module.html | 267 ++ doc/Object.html | 315 +++ doc/_index.html | 215 ++ doc/class_list.html | 47 + doc/css/common.css | 1 + doc/css/full_list.css | 55 + doc/css/style.css | 322 +++ doc/file.README.html | 116 + doc/file_list.html | 49 + doc/frames.html | 13 + doc/index.html | 116 + doc/js/app.js | 205 ++ doc/js/full_list.js | 173 ++ doc/js/jquery.js | 16 + doc/method_list.html | 582 +++++ doc/top-level-namespace.html | 107 + documentation/.gitkeep | 0 .../%{gem_name}/%{gem_name}.gemspec.stop.erb | 33 + .../%{gem_name}/README.markdown.stop.erb | 21 + .../%{gem_name}/README_DIRECTORIES.stop | 9 + .../%{gem_name}/Rakefile.stop | 10 + .../dir_gem_template/%{gem_name}/bin/.gitkeep | 0 .../%{gem_name}/development/.gitkeep | 0 .../%{gem_name}/documentation/.gitkeep | 0 .../%{gem_name}/lib/%{require_name}.stop.erb | 12 + .../lib/%{require_name}/version.rb.stop.erb | 11 + .../dir_gem_template/%{gem_name}/lib/.gitkeep | 0 .../%{gem_name}/rake/lib/.gitkeep | 0 .../%{gem_name}/rake/tasks/.gitkeep | 0 .../%{gem_name}/test/.gitkeep | 0 examples/yaml_gem_template.yaml | 110 + lib/.gitkeep | 0 lib/directory_template.rb | 278 +++ lib/directory_template/blank_slate.rb | 134 + lib/directory_template/erb_template.rb | 202 ++ lib/directory_template/process_data.rb | 94 + lib/directory_template/processor.rb | 68 + lib/directory_template/processor/erb.rb | 18 + lib/directory_template/register/erb.rb | 3 + lib/directory_template/register_all.rb | 8 + lib/directory_template/version.rb | 13 + rake/lib/.gitkeep | 0 rake/tasks/.gitkeep | 0 test/.gitkeep | 0 60 files changed, 10229 insertions(+) create mode 100644 .gitignore create mode 100644 .yardoc/checksums create mode 100644 .yardoc/objects/root.dat create mode 100644 .yardoc/proxy_types create mode 100644 README.markdown create mode 100644 Rakefile create mode 100644 development/.gitkeep create mode 100644 development/TODO.markdown create mode 100644 directory_template.gemspec create mode 100644 doc/DirectoryTemplate.html create mode 100644 doc/DirectoryTemplate/BlankSlate.html create mode 100644 doc/DirectoryTemplate/ErbTemplate.html create mode 100644 doc/DirectoryTemplate/ErbTemplate/Variables.html create mode 100644 doc/DirectoryTemplate/ProcessData.html create mode 100644 doc/DirectoryTemplate/Processor.html create mode 100644 doc/Kernel.html create mode 100644 doc/Module.html create mode 100644 doc/Object.html create mode 100644 doc/_index.html create mode 100644 doc/class_list.html create mode 100644 doc/css/common.css create mode 100644 doc/css/full_list.css create mode 100644 doc/css/style.css create mode 100644 doc/file.README.html create mode 100644 doc/file_list.html create mode 100644 doc/frames.html create mode 100644 doc/index.html create mode 100644 doc/js/app.js create mode 100644 doc/js/full_list.js create mode 100644 doc/js/jquery.js create mode 100644 doc/method_list.html create mode 100644 doc/top-level-namespace.html create mode 100644 documentation/.gitkeep create mode 100644 examples/dir_gem_template/%{gem_name}/%{gem_name}.gemspec.stop.erb create mode 100644 examples/dir_gem_template/%{gem_name}/README.markdown.stop.erb create mode 100644 examples/dir_gem_template/%{gem_name}/README_DIRECTORIES.stop create mode 100644 examples/dir_gem_template/%{gem_name}/Rakefile.stop create mode 100644 examples/dir_gem_template/%{gem_name}/bin/.gitkeep create mode 100644 examples/dir_gem_template/%{gem_name}/development/.gitkeep create mode 100644 examples/dir_gem_template/%{gem_name}/documentation/.gitkeep create mode 100644 examples/dir_gem_template/%{gem_name}/lib/%{require_name}.stop.erb create mode 100644 examples/dir_gem_template/%{gem_name}/lib/%{require_name}/version.rb.stop.erb create mode 100644 examples/dir_gem_template/%{gem_name}/lib/.gitkeep create mode 100644 examples/dir_gem_template/%{gem_name}/rake/lib/.gitkeep create mode 100644 examples/dir_gem_template/%{gem_name}/rake/tasks/.gitkeep create mode 100644 examples/dir_gem_template/%{gem_name}/test/.gitkeep create mode 100644 examples/yaml_gem_template.yaml create mode 100644 lib/.gitkeep create mode 100644 lib/directory_template.rb create mode 100644 lib/directory_template/blank_slate.rb create mode 100644 lib/directory_template/erb_template.rb create mode 100644 lib/directory_template/process_data.rb create mode 100644 lib/directory_template/processor.rb create mode 100644 lib/directory_template/processor/erb.rb create mode 100644 lib/directory_template/register/erb.rb create mode 100644 lib/directory_template/register_all.rb create mode 100644 lib/directory_template/version.rb create mode 100644 rake/lib/.gitkeep create mode 100644 rake/tasks/.gitkeep create mode 100644 test/.gitkeep diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8986f9d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/tmp/ \ No newline at end of file diff --git a/.yardoc/checksums b/.yardoc/checksums new file mode 100644 index 0000000..7f37e23 --- /dev/null +++ b/.yardoc/checksums @@ -0,0 +1,9 @@ +lib/directory_template.rb a000e825d25d7ebcfb70e8e380a953a5ab5d6c76 +lib/directory_template/version.rb af43574b42af7007deb8e568a3ad9bd5bd58936f +lib/directory_template/processor.rb c21c5e0b876721dcd0961f60b961a94e655bdcb0 +lib/directory_template/blank_slate.rb 61aef13b5f6f639598c25ff88c2446b2c7957a2b +lib/directory_template/process_data.rb 7ae2170b073b512cefd959a825810552d183fac0 +lib/directory_template/register/erb.rb c84c860ea6428f82fbbd466c54f7690b8f4d348e +lib/directory_template/erb_template.rb 1aad02d371680dc0d45a03be4c49027ad2a2e715 +lib/directory_template/register_all.rb a40bcfc088189582cc488174c7fa911f73a2072d +lib/directory_template/processor/erb.rb b3c7376632ace06ea77fad4b4582b4c716484f1a diff --git a/.yardoc/objects/root.dat b/.yardoc/objects/root.dat new file mode 100644 index 0000000000000000000000000000000000000000..93e13d0ccc20d81914fd1f8d4060c258a46461eb GIT binary patch literal 61411 zcmeHweT-b!b)V*uqL#x?QD4;e}D{3@5^LBT{ z*?FsZGbC3_%5fS4wVS$$8>A@$Bu)`DX&R)75wu8wwn**dj|2gd25{Ox5(EX>#z2!a zZBYb45chY^x%a;N?t8NzBqdpijYQme?|!}Wea|`f-0fp)tzc(Ajt6m2dHwXuXM*5` zxE;MT|8~?GBth^p-pG%8gS}yEsnc!uqu$I5!I6T-Y0po0lEK{0I2bQ#)omt;jCo)E zj+qzgV{?b&5##leL9?e8aCfjPT}*Tzl%f&jq`~n86&DgFRs~TwZSWSEn#07P{0}=r$M6 z0p$H?p&_%?@5YQf!)CXOj~_Ym4jOrX*zNS9M!(rxjN+jDGW|Oi?2N9qy61xOJXX}} zJP?dUy*B>2C;f;*8)?u25&k>FXc*Dk(+dE*&y6SjUaZ^1eg8@ah?$T4{;=mad#lTFKRP<$uld*7 z%|Y{;Pyem8mg41=MlxJj=v+Ni_XkV;_=+FU%#9VnBTaU_e393`E4V5g zSn-~)y$Wo0TC;Jze0O~paaFjdbEv*&w!Sxb-~t%0-R!r|1H}gZ_5Jlb>j&z05h>R1 z0qfpdDgEN?QsfhxQfmvw3xG56-4lRt+c%8*1kp@V^JfNr(gDk^`oknj{0q!P*~JI(nn{Q+$F zE08qcyDOc+k{_T`jrgv9UwE*7aH@X)x%vb64EmG@fwzy;cMwz6AByV_kJTSJSAVqg zXx;Dl^+Qwj%2a(k9IHPzQ+c9*D+`gzV;!EU94mYa4kdCo%t6#%KQdE!XH%`g3d~G| zbc~e#eK`HQp^=vOorR*uw3mQrINTIj-%uhhm zpIZ+K7gN}R+egB>%+RtF>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| zateZX`-TfJWQFFZHy)VC2>^d}d$6T?#-Vp%O7U{7HdZCg5Vbc8nWngT zpbCVA-j8pso1DZ6QDrjNeEGN_Fcp?U?^m`5o3AMm1esz8AoOngEm z^nUX8LaAcUZ;Q2G+IYF*zzV(JxINfH)?(=W;fAYDQT=DPuWwU=W&87?_gmio2Vf{Q A`v3p{ literal 0 HcmV?d00001 diff --git a/.yardoc/proxy_types b/.yardoc/proxy_types new file mode 100644 index 0000000000000000000000000000000000000000..681ce4c4d523ab5a1a44eadd1768cd3a67b35856 GIT binary patch literal 45 vcmZSKsAl(6;`UF e + warn "Failed to load task file #{task_file}" + warn " #{e.class} #{e.message}" + warn " #{e.backtrace.first}" + end +end diff --git a/development/.gitkeep b/development/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/development/TODO.markdown b/development/TODO.markdown new file mode 100644 index 0000000..5790012 --- /dev/null +++ b/development/TODO.markdown @@ -0,0 +1,12 @@ +* Add tests +* Add documentation +* Integrate with travis +* Make directory\_template/register\_all be aware of plugin-gems +* Come up with a better scaling way to determine processors for a file, potentially + exploiting the fact that most probably match the last or last-two suffixes of the + filename. +* Ponder whether a processor can be ran more than once on a file. +* Figure how to detect an infinite processing loop +* Add a .html.markdown processor +* Add a .pdf.html processor +* Add a .{png,svg,pdf}.dot processor diff --git a/directory_template.gemspec b/directory_template.gemspec new file mode 100644 index 0000000..026915d --- /dev/null +++ b/directory_template.gemspec @@ -0,0 +1,38 @@ +# encoding: utf-8 + +Gem::Specification.new do |s| + s.name = "directory_template" + s.version = "0.0.1" + s.authors = "Stefan Rusterholz" + s.description = <<-DESCRIPTION.gsub(/^ /, '').chomp + Create directories from templates. + Existing directory structures, yaml files and ruby datastructures can all serve as + sources of a template. + Can preprocess pathnames and content. + Path- and ContentProcessors are exchangeable. + DESCRIPTION + s.summary = <<-SUMMARY.gsub(/^ /, '').chomp + Create directories from templates, optionally preprocessing paths and contents. + SUMMARY + s.email = "stefan.rusterholz@gmail.com" + + s.files = + Dir['bin/**/*'] + + Dir['lib/**/*'] + + Dir['rake/**/*'] + + Dir['test/**/*'] + + Dir['*.gemspec'] + + %w[ + Rakefile + README.markdown + ] + + if File.directory?('bin') then + executables = Dir.chdir('bin') { Dir.glob('**/*').select { |f| File.executable?(f) } } + s.executables = executables unless executables.empty? + end + + s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") + s.rubygems_version = "1.3.1" + s.specification_version = 3 +end diff --git a/doc/DirectoryTemplate.html b/doc/DirectoryTemplate.html new file mode 100644 index 0000000..f99e9ad --- /dev/null +++ b/doc/DirectoryTemplate.html @@ -0,0 +1,2198 @@ + + + + + + Class: DirectoryTemplate + + — Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

Class: DirectoryTemplate + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/directory_template.rb,
+ lib/directory_template/version.rb,
lib/directory_template/processor.rb,
lib/directory_template/blank_slate.rb,
lib/directory_template/process_data.rb,
lib/directory_template/erb_template.rb,
lib/directory_template/processor/erb.rb
+
+ +
+
+ +

Overview

+
+

+@version: 1.0.0 +

+

+DirectoryTemplate Create directory structures from template directory +structures or template data. +

+

+Preregistered processors +

+
    +
  • +’*.stop’: Stops the preprocessing chain, it’s advised to +add that to all files for +

    +
    
    +          future-proofness.
    +
  • +
+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: BlankSlate, ErbTemplate, ProcessData, Processor + + +

+ +

Constant Summary

+ +
+ +
Processors = +
+
+

+All registered processors +

+ + +
+
+
+ + +
+
+
[
+  Processor.new('*.stop', 'Terminate processing queue', 'After .stop, no processor will be run anymore') { |data| data.chomp_suffix!; throw :stop_processing }
+]
+ +
StandardPathProcessor = +
+
+

+The standard processor for file- and directory-paths. It simply uses +String#% style keyword replacement. I.e., “%{key}” is replaced +by the variable value passed with :key. +

+ + +
+
+
+ + +
+
+
proc { |data|
+  data.path = data.path % data.path_variables if data.path_variables
+}
+ +
DefaultOptions = +
+
+

+The default options used by DirectoryTemplate +

+ + +
+
+
+ + +
+
+
{
+  :verbose        => false,
+  :silent         => false,
+  :out            => $stdout,
+  :processors     => Processors,
+  :path_processor => StandardPathProcessor,
+  :meta           => {},
+}
+ +
Version = +
+
+

+The version of DirectoryTemplate +

+ + +
+
+
+ + +
+
+
Gem::Version.new("0.0.1")
+ +
+ + + + + +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (DirectoryTemplate) initialize(data, options = nil) + + + +

+
+

+Create a new DirectoryTemplate +

+ + +
+
+
+

Parameters:

+
    + +
  • + + data + + + (Hash) + + + + — +

    +A hash with the two keys :directories and :files, where :directories +contains an Array of all directory names, and :files contains a Hash of all +file names and their unprocessed content. +

    +
    + +
  • + +
  • + + options + + + (Hash, nil) + + + (defaults to: nil) + + + — +

    +An options hash, @see DirectoryTemplate::DefaultOptions for a list of all +available options. +

    +
    + +
  • + +
+ +

Raises:

+
    + +
  • + + + (ArgumentError) + + + +
  • + +
+ +

See Also:

+
    + +
  • To create a DirectoryTemplate from an existing directory structure.
  • + +
  • To create a DirectoryTemplate from a description in a YAML file.
  • + +
+ +
+ + + + +
+
+
+
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+
+
# File 'lib/directory_template.rb', line 144
+
+def initialize(data, options=nil)
+  options               = options ? DefaultOptions.merge(options) : DefaultOptions.dup
+  @directories          = data[:directories] || []
+  @files                = data[:files] || []
+  @meta                 = options.delete(:meta)
+  @verbose              = options.delete(:verbose)
+  @silent               = options.delete(:silent)
+  @out                  = options.delete(:out)
+  @processors           = options.delete(:processors)
+  @path_processor       = options.delete(:path_processor)
+  @dry_run              = false
+  raise ArgumentError, "Unknown options: #{options.keys.join(', ')}" unless options.empty?
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Array) directories (readonly) + + + +

+
+

+All directories of the template +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + + — +

    +All directories of the template +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+105
+106
+107
+
+
# File 'lib/directory_template.rb', line 105
+
+def directories
+  @directories
+end
+
+
+ + + + +
+

+ + - (Object) dry_run(in_path = '.', env = {}, &on_collision) (readonly) + + + +

+
+

+Same as #materialize, but doesn’t actually do anything, except print +the debug and info messages. It additionally prints an info message, +containing the file content of files that would be created. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+121
+122
+123
+124
+125
+126
+
+
# File 'lib/directory_template.rb', line 121
+
+def dry_run(in_path='.', env={}, &on_collision)
+  @dry_run = true
+  materialize(in_path, env, &on_collision)
+ensure
+  @dry_run = false
+end
+
+
+ + + + +
+

+ + - (Hash<String,String>) files (readonly) + + + +

+
+

+All files of the template and their content. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash<String,String>) + + + + — +

    +All files of the template and their content. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+108
+109
+110
+
+
# File 'lib/directory_template.rb', line 108
+
+def files
+  @files
+end
+
+
+ + + + +
+

+ + - (Object) meta (readonly) + + + +

+
+

+Meta information can be used by processors. There’s no requirements +on them, except that the toplevel container is a hash. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+102
+103
+104
+
+
# File 'lib/directory_template.rb', line 102
+
+def meta
+  @meta
+end
+
+
+ + + + +
+

+ + - (IO, #puts) out (readonly) + + + +

+
+

+The object on which info and debug messages are printed +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (IO, #puts) + + + + — +

    +The object on which info and debug messages are printed +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+117
+118
+119
+
+
# File 'lib/directory_template.rb', line 117
+
+def out
+  @out
+end
+
+
+ + + + +
+

+ + - (#call) path_processor (readonly) + + + +

+
+

+The path processor used by this template. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (#call) + + + + — +

    +The path processor used by this template. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+114
+115
+116
+
+
# File 'lib/directory_template.rb', line 114
+
+def path_processor
+  @path_processor
+end
+
+
+ + + + +
+

+ + - (Array<DirectoryTemplate::Processor>) processors (readonly) + + + +

+
+

+The content processors used by this template. +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+111
+112
+113
+
+
# File 'lib/directory_template.rb', line 111
+
+def processors
+  @processors
+end
+
+
+ + + + +
+

+ + - (Object) silent + + + +

+
+

+When true, will not even output info messages +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+124
+125
+126
+
+
# File 'lib/directory_template.rb', line 124
+
+def silent
+  @silent
+end
+
+
+ + + + +
+

+ + - (Object) verbose + + + +

+
+

+When true, will additionally output debug messages +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+127
+128
+129
+
+
# File 'lib/directory_template.rb', line 127
+
+def verbose
+  @verbose
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + + (Object) convert_recursive_structure(current, stack = [], dirs = [], files = {}) + + + +

+
+

+Converts a recursive hash into a suitable data structure for +DirectoryTemplate::new +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+
+
# File 'lib/directory_template.rb', line 70
+
+def self.convert_recursive_structure(current, stack=[], dirs=[], files={})
+  current.each do |segment, content|
+    new_stack = stack+[segment]
+    path      = new_stack.join('/')
+    case content
+      when String,nil
+        files[path] = content || ''
+      when Hash
+        dirs << path
+        convert_recursive_structure(content, new_stack, dirs, files)
+      else
+        raise "Invalid structure"
+    end
+  end
+
+  return dirs, files
+end
+
+
+ +
+

+ + + (Object) directory(template_path, options = {}) + + + +

+
+

+Create a DirectoryTemplate from an existing directory structure. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+
+
# File 'lib/directory_template.rb', line 55
+
+def self.directory(template_path, options={})
+  data    = Dir.chdir(template_path) {
+    paths   =  Dir['**/{*,.*}']
+    paths  -= paths.grep(/(?:^|\/)\.\.?$/)
+    directories, files = paths.sort.partition { |path| File.directory?(path) }
+    filemap = Hash[files.map { |path| [path, File.read(path)] }]
+
+    {:directories => directories, :files => filemap}
+  }
+
+  new(data, options)
+end
+
+
+ +
+

+ + + (Object) register(processor) + + + +

+
+

+You can register custom processors for templates. They’re triggered +based on the pattern. A processor can change the ProcessData struct passed +to it, which will be reflected when creating the file or directory +

+ + +
+
+
+

Parameters:

+ + + +
+ + + + +
+
+
+
+50
+51
+52
+
+
# File 'lib/directory_template.rb', line 50
+
+def self.register(processor)
+  Processors << processor
+end
+
+
+ +
+

+ + + (Object) yaml_file(path, options = nil) + + + +

+
+

+Create a DirectoryTemplate from a YAML file. The yaml should just be a +recursive hash of strings. Use an empty hash to indicate an empty +directory. Leaf-strings are considered to be the content of a file. Use nil +to indicate an empty file. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+92
+93
+94
+95
+96
+97
+98
+
+
# File 'lib/directory_template.rb', line 92
+
+def self.yaml_file(path, options=nil)
+  raw         = YAML.load_file(path)
+  dirs, files = convert_recursive_structure(raw)
+  data        = {:directories => dirs, :files => files}
+
+  new(data, options)
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Object) create_directory(path, mode = 0755, &message) + + + +

+
+ +
+ Note: +

+The mode param is currently unused. +

+
+
+ +

+Create the given directory and emit an info message (unless in dry_run +mode). +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+233
+234
+235
+236
+237
+238
+
+
# File 'lib/directory_template.rb', line 233
+
+def create_directory(path, mode=0755, &message)
+  unless File.exist?(path) then
+    info(&message)
+    FileUtils.mkdir_p(path) unless @dry_run
+  end
+end
+
+
+ +
+

+ + - (Object) create_file(path, content = "", mode = 0644, &message) + + + +

+
+ +
+ Note: +

+The mode param is currently unused. +

+
+
+ +

+Create the given file and emit an info message (unless in dry_run mode). +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+
+
# File 'lib/directory_template.rb', line 244
+
+def create_file(path, content="", mode=0644, &message)
+  info(&message)
+  if @dry_run then
+    info { "  Content:\n#{content.gsub(/^/, '    ')}" }
+  else
+    File.open(path, 'wb:binary') do |fh|
+      fh.write(content)
+    end
+  end
+end
+
+
+ +
+

+ + - (Object) debug + + + +

+
+

+Emit a debug string (the return value of the block). Will only be emitted +if DirectoryTemplate#debug is true +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+275
+276
+277
+
+
# File 'lib/directory_template.rb', line 275
+
+def debug
+  @out.puts yield if @verbose
+end
+
+
+ +
+

+ + - (Object) info + + + +

+
+

+Emit an info string (the return value of the block). Will not be emitted if +DirectoryTemplate#silent is true +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+268
+269
+270
+
+
# File 'lib/directory_template.rb', line 268
+
+def info
+  @out.puts yield unless @silent
+end
+
+
+ +
+

+ + - (Object) materialize(in_path = '.', env = {}, &on_collision) + + + +

+
+

+Creates all the directories and files from the template in the given path. +

+ + +
+
+ + + + + +
+
+
+
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+
+
# File 'lib/directory_template.rb', line 170
+
+def materialize(in_path='.', env={}, &on_collision)
+  in_path = File.expand_path(in_path)
+  create_directory(in_path) { "Creating root '#{in_path}'" }
+
+  Dir.chdir(in_path) do
+    if @directories.empty? then
+      info { "No directories to create" }
+    else
+      info { "Creating directories" }
+      @directories.each do |source_dir_path|
+        target_dir_path = process_path(source_dir_path, env)
+        create_directory(target_dir_path) { "  #{target_dir_path}" }
+      end
+    end
+
+    if @files.empty? then
+      info { "No files to create" }
+    else
+      info { "Creating files" }
+      @files.each do |source_file_path, content|
+        target_file_path  = process_path(source_file_path, env)
+        data              = process_content(target_file_path, content, env)
+        if File.exist?(data.path) then
+          if block_given? && yield(data) then
+            create_file(data.path, data.content) { "  #{data.path} (overwrite)" }
+          else
+            info { "  #{data.path} (exists already)" }
+          end
+        else
+          create_file(data.path, data.content) { "  #{data.path} (new)" }
+        end
+      end
+    end
+  end
+
+  self
+end
+
+
+ +
+

+ + - (Object) process_content(path, content, env) + + + +

+
+

+Preprocesses the given content +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+
+
# File 'lib/directory_template.rb', line 216
+
+def process_content(path, content, env)
+  data = ProcessData.new(self, path, content, env)
+  catch(:stop_processing) {
+    #p :process_content => path, :available => @processors.size, :processors => processors_for(data).tap { |x| x && x.size }
+    while processor = processor_for(data)
+      debug { "  -> Applying #{processor.name}" }
+      processor.call(data)
+    end
+  }
+
+  data
+end
+
+
+ +
+

+ + - (Object) process_path(path, env) + + + +

+
+

+Preprocesses the given path +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+210
+211
+212
+
+
# File 'lib/directory_template.rb', line 210
+
+def process_path(path, env)
+  ProcessData.new(self, path, nil, env).tap(&@path_processor).path
+end
+
+
+ +
+

+ + - (Processor?) processor_for(data) + + + +

+
+

+Returns the processor or nil +

+ + +
+
+
+

Parameters:

+
    + +
  • + + path + + + (String) + + + + — +

    +The path to extract the processor from. +

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Processor, nil) + + + + — +

    +Returns the processor or nil +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+261
+262
+263
+
+
# File 'lib/directory_template.rb', line 261
+
+def processor_for(data)
+  @processors.enum_for(:grep, data).first
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/DirectoryTemplate/BlankSlate.html b/doc/DirectoryTemplate/BlankSlate.html new file mode 100644 index 0000000..fb65b7b --- /dev/null +++ b/doc/DirectoryTemplate/BlankSlate.html @@ -0,0 +1,399 @@ + + + + + + Class: DirectoryTemplate::BlankSlate + + — Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

Class: DirectoryTemplate::BlankSlate + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/directory_template/blank_slate.rb
+ +
+
+ +

Overview

+
+

+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. +

+

+Modified by Stefan Rusterholz (stefan.rusterholz@gmail.com) +

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

ErbTemplate::Variables

+
+ + + + + + + + +

+ Class Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (UnboundMethod) find_hidden_method(name) + + + +

+
+

+The method that was hidden. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (UnboundMethod) + + + + — +

    +The method that was hidden. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+51
+52
+53
+54
+
+
# File 'lib/directory_template/blank_slate.rb', line 51
+
+def self.find_hidden_method(name)
+  @hidden_methods ||= {}
+  @hidden_methods[name] || superclass.find_hidden_method(name)
+end
+
+
+ +
+

+ + + (Object) hide(name) + + + +

+
+

+Hide the method named name in the BlankSlate class. Don’t +hide instance_eval or any method beginning with “__”. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+
+
# File 'lib/directory_template/blank_slate.rb', line 32
+
+def self.hide(name)
+  verbosity = $VERBOSE
+  stderr    = $stderr
+  $VERBOSE  = nil
+  $stderr   = StringIO.new
+
+  methods = instance_methods.map(&:to_sym)
+  if methods.include?(name.to_sym) and
+    name !~ /^(__|instance_eval)/
+    @hidden_methods ||= {}
+    @hidden_methods[name.to_sym] = instance_method(name)
+    undef_method name
+  end
+ensure
+  $VERBOSE = verbosity
+  $stderr  = stderr
+end
+
+
+ +
+

+ + + (Object) reveal(name) + + + +

+
+

+Redefine a previously hidden method so that it may be called on a blank +slate object. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+58
+59
+60
+61
+62
+
+
# File 'lib/directory_template/blank_slate.rb', line 58
+
+def self.reveal(name)
+  hidden_method = find_hidden_method(name)
+  fail "Don't know how to reveal method '#{name}'" unless hidden_method
+  define_method(name, hidden_method)
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/DirectoryTemplate/ErbTemplate.html b/doc/DirectoryTemplate/ErbTemplate.html new file mode 100644 index 0000000..93076ed --- /dev/null +++ b/doc/DirectoryTemplate/ErbTemplate.html @@ -0,0 +1,827 @@ + + + + + + Class: DirectoryTemplate::ErbTemplate + + — Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

Class: DirectoryTemplate::ErbTemplate + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/directory_template/erb_template.rb
+ +
+
+ +

Overview

+
+

Indexing

+

+@author: Stefan Rusterholz +

+

About

+

+A helper class for ERB, allows constructs like the one in the Synopsis to +enable simple use of variables/methods in templates. +

+ + +
+
+
+ +
+

Examples:

+ +

+
tmpl = Templater.new("Hello <%= name %>!")
+tmpl.result(self, :name => 'world') # => 'Hello World!'
+ +
+ + +

Defined Under Namespace

+

+ + + + + Classes: Variables + + +

+ +

Constant Summary

+ +
+ +
Opt = +
+
+

+Option defaults +

+ + +
+
+
+ + +
+
+
{
+  :safe_level => nil,
+  :trim_mode  => '%<>',
+  :eoutvar    => '_erbout'
+}
+ +
InstanceEvaler = +
+
+

+The instance_eval method +

+ + +
+
+
+ + +
+
+
Object.instance_method(:instance_eval)
+ +
Raiser = +
+
+

+A proc for &on_error in SilverPlatter::Variables::new or +SilverPlatter::Templater#result. Raises the error further on. +

+ + +
+
+
+ + +
+
+
proc { |e|
+  raise
+}
+ +
Teller = +
+
+

+A proc for &on_error in SilverPlatter::Variables.new or +SilverPlatter::Templater#result. Inserts <> in +the place where the error occurred. +

+ + +
+
+
+ + +
+
+
proc { |e|
+  "<<#{e.class}: #{e}>>"
+}
+ +
+ + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) string + + + + + + + readonly + + + + + + + + +

    +The template string. +

    +
    + +
  • + + +
+ + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (ErbTemplate) initialize(string, opt = {}) + + + +

+
+

Arguments

+
    +
  • +string: The template string, it becomes frozen +

    +
  • +
  • +opt: Option hash, keys: +

    +
      +
    • +:filename: The filename used for the evaluation (useful for error +messages) +

      +
    • +
    +
      +
    • +:safe_level: see ERB.new +

      +
    • +
    +
      +
    • +:trim_mode: see ERB.new +

      +
    • +
    +
      +
    • +:eoutvar: see ERB.new +

      +
    • +
    +
  • +
+ + +
+
+
+ + +
+ + + + +
+
+
+
+159
+160
+161
+162
+163
+164
+165
+166
+
+
# File 'lib/directory_template/erb_template.rb', line 159
+
+def initialize(string, opt={})
+  opt, string   = string, nil if string.kind_of?(Hash)
+  opt           = Opt.merge(opt)
+  file          = opt.delete(:filename)
+  @string       = string.freeze
+  @erb          = ERB.new(@string, *opt.values_at(:safe_level, :trim_mode, :eoutvar))
+  @erb.filename = file if file
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) string (readonly) + + + +

+
+

+The template string +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+138
+139
+140
+
+
# File 'lib/directory_template/erb_template.rb', line 138
+
+def string
+  @string
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + + (Object) file(path, opt = nil) + + + +

+
+

+Like Templater.new, but instead of a template string, the path to the file +containing the template. Sets :filename. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+142
+143
+144
+
+
# File 'lib/directory_template/erb_template.rb', line 142
+
+def self.file(path, opt=nil)
+  new(File.read(path), (opt || {}).merge(:filename => path))
+end
+
+
+ +
+

+ + + (Object) replace(template, variables, &on_error) + + + +

+
+

+A convenience method, which evaluates the templates with the given +variables and returns the result. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+148
+149
+150
+
+
# File 'lib/directory_template/erb_template.rb', line 148
+
+def self.replace(template, variables, &on_error)
+  new(template).result(nil, variables, &on_error)
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Object) inspect + + + +

+
+

+:nodoc: +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+195
+196
+197
+198
+199
+200
+
+
# File 'lib/directory_template/erb_template.rb', line 195
+
+def inspect # :nodoc:
+  sprintf "#<%s:0x%x string=%s>",
+    self.class,
+    object_id << 1,
+    @string.inspect
+end
+
+
+ +
+

+ + - (Object) result(delegate = nil, variables = {}, on_error_name = nil, &on_error) + + + +

+
+

+See Templater::Variables.new Returns the evaluated template. Default +&on_error is the Templater::Raiser proc. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+171
+172
+173
+174
+175
+176
+177
+178
+
+
# File 'lib/directory_template/erb_template.rb', line 171
+
+def result(delegate=nil, variables={}, on_error_name=nil, &on_error)
+  variables ||= {}
+  on_error  ||= Raiser
+  variables = Variables.new(delegate, variables, on_error_name, &on_error)
+  @erb.result(variables.__binding__)
+rescue NameError => e
+  raise NameError, e.message+" for #{self.inspect} with #{variables.inspect}", e.backtrace
+end
+
+
+ +
+

+ + - (Object) result_with(opt, &block) + + + +

+
+

+See Templater::Variables.new Returns the evaluated template. Default +&on_error is the Templater::Raiser proc. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+
+
# File 'lib/directory_template/erb_template.rb', line 183
+
+def result_with(opt, &block)
+  opt           = opt.dup
+  variables     = opt.delete(:variables) || {}
+  delegate      = opt.delete(:delegate)
+  on_error      = opt.delete(:on_error) || Raiser
+  on_error_name = opt.delete(:on_error_name) || Raiser
+  variables = Variables.new(delegate, variables, on_error_name, block, &on_error)
+  @erb.result(variables.__binding__)
+rescue NameError => e
+  raise NameError, e.message+" for #{self.inspect} with #{variables.inspect}", e.backtrace
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/DirectoryTemplate/ErbTemplate/Variables.html b/doc/DirectoryTemplate/ErbTemplate/Variables.html new file mode 100644 index 0000000..c5430d0 --- /dev/null +++ b/doc/DirectoryTemplate/ErbTemplate/Variables.html @@ -0,0 +1,724 @@ + + + + + + Class: DirectoryTemplate::ErbTemplate::Variables + + — Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

Class: DirectoryTemplate::ErbTemplate::Variables + + + +

+ +
+ +
Inherits:
+
+ BlankSlate + + + show all + +
+ + + + + + + + + +
Defined in:
+
lib/directory_template/erb_template.rb
+ +
+
+ +

Overview

+
+

Indexing

+

+Author: Stefan Rusterholz Contact: contact@apeiros.me Version: 0.1.0 +

+

About

+

+Similar to OpenStruct, but slightly optimized for create once, use once and +giving diagnostics on exceptions/missing keys. +

+

Synopsis

+

+  tmpl = Variables.new(delegator, :variable => "content") { |exception|
+    do_something_with(exception)
+  }
+ + +
+
+
+ + +
+

Constant Summary

+ +
+ +
Raiser = +
+
+

+A proc for &on_error in SilverPlatter::Variables::new or +SilverPlatter::Templater#result. Raises the error further on. +

+ + +
+
+
+ + +
+
+
proc { |e|
+  raise(e)
+}
+ +
Teller = +
+
+

+A proc for &on_error in SilverPlatter::Variables.new or +SilverPlatter::Templater#result. Inserts <> in +the place where the error occurred. +

+ + +
+
+
+ + +
+
+
proc { |e|
+  "<<#{e.class}: #{e}>>"
+}
+ +
EmptyHash = +
+
+

+An empty Hash +

+ + +
+
+
+ + +
+
+
{}.freeze
+ +
SetterPattern = +
+
+

+Regex to match setter method names +

+ + +
+
+
+ + +
+
+
/=\z/.freeze
+ +
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BlankSlate

+

find_hidden_method, hide, reveal

+
+

Constructor Details

+ +
+

+ + - (Variables) initialize(delegate = nil, variables = {}, on_error_name = nil, &on_error) + + + +

+
+

Arguments

+
    +
  • +delegate: All method calls and undefined variables are delegated to +this object as method call. +

    +
  • +
  • +variables: A hash with variables in it, keys must be Symbols. +

    +
  • +
  • +on_error_name: Instead of a block you can pass the name of an existing +handler, e.g. :Raiser or :Teller. +

    +
  • +
  • +&on_error: The block is yielded in case of an exception with the +exception as argument +

    +
  • +
+ + +
+
+
+ + +
+ + + + +
+
+
+
+65
+66
+67
+68
+69
+70
+71
+72
+73
+
+
# File 'lib/directory_template/erb_template.rb', line 65
+
+def initialize(delegate=nil, variables={}, on_error_name=nil, &on_error)
+  @delegate = delegate
+  @table    = (@delegate ? Hash.new { |h,k| @delegate.send(k) } : EmptyHash).merge(variables)
+  if !on_error && on_error_name then
+    @on_error = self.class.const_get(on_error_name)
+  else
+    @on_error = on_error || Raiser
+  end
+end
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + +

+ +
+

+ + - (Object) method_missing(m, *args) + + + +

+
+

+:nodoc: +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+
+
# File 'lib/directory_template/erb_template.rb', line 91
+
+def method_missing(m, *args) # :nodoc:
+  argn = args.length
+  if argn.zero? && @table.has_key?(m) then
+    @table[m]
+  elsif argn == 1 && m.to_s =~ SetterPattern
+    @table[m] = args.first
+  elsif @delegate
+    @delegate.send(m, *args)
+  end
+rescue => e
+  @on_error.call(e)
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) __binding__ + + + +

+
+

+Make the binding publicly available +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+82
+83
+84
+
+
# File 'lib/directory_template/erb_template.rb', line 82
+
+def __binding__
+  binding
+end
+
+
+ +
+

+ + - (Object) __keys__(include_delegate = true) + + + +

+
+

+All keys this Variables instance provides, if the include_delegate argument +is true and the object to delegate to responds to keys, then it +will add the keys of the delegate. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+77
+78
+79
+
+
# File 'lib/directory_template/erb_template.rb', line 77
+
+def __keys__(include_delegate=true)
+  @table.keys + ((include_delegate && @delegate.respond_to?(:__keys__)) ? @delegate.__keys__ : [])
+end
+
+
+ +
+

+ + - (Object) inspect + + + +

+
+

+:nodoc: +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+104
+105
+106
+107
+108
+109
+110
+
+
# File 'lib/directory_template/erb_template.rb', line 104
+
+def inspect # :nodoc:
+  sprintf "#<%s:0x%08x @delegate=%s %s>",
+    self.class,
+    __id__,
+    @table.map { |k,v| "#{k}=#{v.inspect}" }.join(', '),
+    @delegate ? "#<%s:0x%08x ...>" %  [@delegate.class, @delegate.object_id << 1] : "nil"
+end
+
+
+ +
+

+ + - (Boolean) respond_to?(key) + + + +

+
+

+See Object#respond_to? +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+87
+88
+89
+
+
# File 'lib/directory_template/erb_template.rb', line 87
+
+def respond_to?(key)
+  @table.respond_to?(key) || (@delegate && @delegate.respond_to?(key)) || super
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/DirectoryTemplate/ProcessData.html b/doc/DirectoryTemplate/ProcessData.html new file mode 100644 index 0000000..555d365 --- /dev/null +++ b/doc/DirectoryTemplate/ProcessData.html @@ -0,0 +1,1220 @@ + + + + + + Class: DirectoryTemplate::ProcessData + + — Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

Class: DirectoryTemplate::ProcessData + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/directory_template/process_data.rb
+ +
+
+ +

Overview

+
+

+ProcessData is the value that gets passed to processors. The processor must +mutate it. +

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) content + + + + + + + + + + + + + + + +

    +The file-content, as it is in the current stage of processing (nil for +directories). +

    +
    + +
  • + + +
  • + + + - (Object) content_variables + + + + + + + readonly + + + + + + + + +

    +Variables to be used for filecontent preprocessing. +

    +
    + +
  • + + +
  • + + + - (Object) directory + + + + + + + readonly + + + + + + + + +

    +The directory, as it is in the current stage of processing. +

    +
    + +
  • + + +
  • + + + - (Object) directory_template + + + + + + + readonly + + + + + + + + +

    +A reference to the DirectoryTemplate of which this file/directory is part +of. +

    +
    + +
  • + + +
  • + + + - (Object) filename + + + + + + + readonly + + + + + + + + +

    +The filename, as it is in the current stage of processing. +

    +
    + +
  • + + +
  • + + + - (Object) path + + + + + + + + + + + + + + + +

    +The path as it is in the current stage of processing. +

    +
    + +
  • + + +
  • + + + - (Object) path_variables + + + + + + + readonly + + + + + + + + +

    +Variables to be used for path preprocessing. +

    +
    + +
  • + + +
  • + + + - (Object) suffix + + + + + + + readonly + + + + + + + + +

    +The suffix, as it is in the current stage of processing. +

    +
    + +
  • + + +
  • + + + - (Object) variables + + + + + + + readonly + + + + + + + + +

    +Variables to be used for both, path- and filecontent preprocessing. +

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (ProcessData) initialize(directory_template, path, content, env) + + + +

+
+

+A content of nil means this is a directory +

+ + +
+
+
+

Parameters:

+
    + +
  • + + env + + + (Hash) + + + + — +

    +A hash with additional information, used to parametrize and preprocess the +template. @options env [Hash] :variables +

    +
    
    +  Variables used for both, path- and filecontent processing.
    +
    +

    +@options env [Hash] :path_variables +

    +
    
    +  Variables only used for path-processing.
    +
    +

    +@options env [Hash] :content_variables +

    +
    
    +  Variables only used for filecontent processing.
    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+44
+45
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/directory_template/process_data.rb', line 44
+
+def initialize(directory_template, path, content, env)
+  @directory_template = directory_template
+  @content            = content
+  @variables          = env[:variables]
+  @path_variables     = @variables.merge(env[:path_variables] || {})
+  @content_variables  = @variables.merge(env[:content_variables] || {})
+  self.path           = path
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) content + + + +

+
+

+The file-content, as it is in the current stage of processing (nil for +directories). +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/directory_template/process_data.rb', line 23
+
+def content
+  @content
+end
+
+
+ + + + +
+

+ + - (Object) content_variables (readonly) + + + +

+
+

+Variables to be used for filecontent preprocessing +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/directory_template/process_data.rb', line 29
+
+def content_variables
+  @content_variables
+end
+
+
+ + + + +
+

+ + - (Object) directory (readonly) + + + +

+
+

+The directory, as it is in the current stage of processing. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+17
+18
+19
+
+
# File 'lib/directory_template/process_data.rb', line 17
+
+def directory
+  @directory
+end
+
+
+ + + + +
+

+ + - (Object) directory_template (readonly) + + + +

+
+

+A reference to the DirectoryTemplate of which this file/directory is part +of +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/directory_template/process_data.rb', line 8
+
+def directory_template
+  @directory_template
+end
+
+
+ + + + +
+

+ + - (Object) filename (readonly) + + + +

+
+

+The filename, as it is in the current stage of processing. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+14
+15
+16
+
+
# File 'lib/directory_template/process_data.rb', line 14
+
+def filename
+  @filename
+end
+
+
+ + + + +
+

+ + - (Object) path + + + +

+
+

+The path as it is in the current stage of processing. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/directory_template/process_data.rb', line 11
+
+def path
+  @path
+end
+
+
+ + + + +
+

+ + - (Object) path_variables (readonly) + + + +

+
+

+Variables to be used for path preprocessing +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+26
+27
+28
+
+
# File 'lib/directory_template/process_data.rb', line 26
+
+def path_variables
+  @path_variables
+end
+
+
+ + + + +
+

+ + - (Object) suffix (readonly) + + + +

+
+

+The suffix, as it is in the current stage of processing. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+20
+21
+22
+
+
# File 'lib/directory_template/process_data.rb', line 20
+
+def suffix
+  @suffix
+end
+
+
+ + + + +
+

+ + - (Object) variables (readonly) + + + +

+
+

+Variables to be used for both, path- and filecontent preprocessing +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+32
+33
+34
+
+
# File 'lib/directory_template/process_data.rb', line 32
+
+def variables
+  @variables
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) ===(processor) + + + +

+
+

+Whether the processor is suitable for the given ProcessData. Simply +delegates the job to the Processor. +

+ + +
+
+
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+57
+58
+59
+
+
# File 'lib/directory_template/process_data.rb', line 57
+
+def ===(processor)
+  processor === self
+end
+
+
+ +
+

+ + - (Object) chomp_suffix! + + + +

+
+

+Removes the current suffix. E.g. “foo/bar.baz.quuz” would be +“foo/bar.baz” after the operation. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+90
+91
+92
+
+
# File 'lib/directory_template/process_data.rb', line 90
+
+def chomp_suffix!
+  self.path   = @path.chomp(@suffix)
+end
+
+
+ +
+

+ + - (Boolean) directory? + + + +

+
+

+Whether the item is a directory. The alternative is, that it is a file. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +Whether the item is a directory. The alternative is, that it is a file. +

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+73
+74
+75
+
+
# File 'lib/directory_template/process_data.rb', line 73
+
+def directory?
+  !@content
+end
+
+
+ +
+

+ + - (Boolean) file? + + + +

+
+

+Whether the item is a file. The alternative is, that it is a directory. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +

    +Whether the item is a file. The alternative is, that it is a directory. +

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+65
+66
+67
+
+
# File 'lib/directory_template/process_data.rb', line 65
+
+def file?
+  !!@content
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/DirectoryTemplate/Processor.html b/doc/DirectoryTemplate/Processor.html new file mode 100644 index 0000000..f88baeb --- /dev/null +++ b/doc/DirectoryTemplate/Processor.html @@ -0,0 +1,870 @@ + + + + + + Class: DirectoryTemplate::Processor + + — Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

Class: DirectoryTemplate::Processor + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/directory_template/processor.rb,
+ lib/directory_template/processor/erb.rb
+
+ +
+
+ +

Overview

+
+

+The definition of a processor +

+ + +
+
+
+ + +
+

Constant Summary

+ +
+ +
Erb = +
+
+

+The ERB Processor treats the file-content as ERB template. +

+ + +
+
+
+ + +
+
+
Processor.new('*.erb', 'ERB Template Processor') do |data|
+  data.content = ErbTemplate.replace(data.content, data.content_variables)
+  data.chomp_suffix!
+end
+ +
+ + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) description + + + + + + + readonly + + + + + + + + +

    +A human understandable description of the processor. +

    +
    + +
  • + + +
  • + + + - (Object) execute + + + + + + + readonly + + + + + + + + +

    +The implementation of the processor. +

    +
    + +
  • + + +
  • + + + - (Object) name + + + + + + + readonly + + + + + + + + +

    +A human identifiable name. +

    +
    + +
  • + + +
  • + + + - (Object) pattern + + + + + + + readonly + + + + + + + + +

    +The pattern matching proc used to figure whether the processor applies to a +ProcessData or not. +

    +
    + +
  • + + +
  • + + + - (Object) pattern_source + + + + + + + readonly + + + + + + + + +

    +The source used to create the pattern proc. +

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Processor) initialize(pattern, name, description = nil, &execute) + + + +

+
+

+A new instance of Processor +

+ + +
+
+
+

Parameters:

+
    + +
  • + + pattern + + + (String) + + + + — +

    +A glob-like-pattern, e.g. ’*.html.haml’ +

    +
    + +
  • + +
  • + + name + + + (String) + + + + — +

    +The name of the processor +

    +
    + +
  • + +
  • + + description + + + (String) + + + (defaults to: nil) + + + — +

    +A description, what the processor does +

    +
    + +
  • + +
  • + + execute + + + (#call) + + + + — +

    +The implementation of the processor. +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+
+
# File 'lib/directory_template/processor.rb', line 36
+
+def initialize(pattern, name, description=nil, &execute)
+  @pattern_source = pattern
+  @pattern        = case pattern
+    when String then proc { |data| File.fnmatch?(pattern, data.path) }
+    when Regexp then proc { |data| pattern =~ data.path }
+    when Proc   then pattern
+    else
+      raise ArgumentError, "Expected a String, Regexp or Proc as pattern, but got #{pattern.class}"
+  end
+  @name         = name
+  @description  = description
+  @execute      = execute
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) description (readonly) + + + +

+
+

+A human understandable description of the processor +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+20
+21
+22
+
+
# File 'lib/directory_template/processor.rb', line 20
+
+def description
+  @description
+end
+
+
+ + + + +
+

+ + - (Object) execute (readonly) + + + +

+
+

+The implementation of the processor. I.e., the block passed to ::new. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/directory_template/processor.rb', line 23
+
+def execute
+  @execute
+end
+
+
+ + + + +
+

+ + - (Object) name (readonly) + + + +

+
+

+A human identifiable name +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+17
+18
+19
+
+
# File 'lib/directory_template/processor.rb', line 17
+
+def name
+  @name
+end
+
+
+ + + + +
+

+ + - (Object) pattern (readonly) + + + +

+
+

+The pattern matching proc used to figure whether the processor applies to a +ProcessData or not. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+10
+11
+12
+
+
# File 'lib/directory_template/processor.rb', line 10
+
+def pattern
+  @pattern
+end
+
+
+ + + + +
+

+ + - (Object) pattern_source (readonly) + + + +

+
+

+The source used to create the pattern proc. I.e., the value passed to ::new +as the pattern parameter. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+14
+15
+16
+
+
# File 'lib/directory_template/processor.rb', line 14
+
+def pattern_source
+  @pattern_source
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) ===(process_data) + + + +

+
+

+Whether the processor is suitable for the given ProcessData +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+51
+52
+53
+
+
# File 'lib/directory_template/processor.rb', line 51
+
+def ===(process_data)
+  @pattern.call(process_data)
+end
+
+
+ +
+

+ + - (DirectoryTemplate::ProcessData) call(process_data) + + + +

+
+

+Apply the processor on a ProcessData instance. +

+ + +
+
+
+

Parameters:

+ + +

Returns:

+ + +
+ + + + +
+
+
+
+62
+63
+64
+65
+66
+
+
# File 'lib/directory_template/processor.rb', line 62
+
+def call(process_data)
+  @execute.call(process_data)
+
+  process_data
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Kernel.html b/doc/Kernel.html new file mode 100644 index 0000000..87178c5 --- /dev/null +++ b/doc/Kernel.html @@ -0,0 +1,246 @@ + + + + + + Module: Kernel + + — Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

Module: Kernel + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/directory_template/blank_slate.rb
+ +
+
+ +

Overview

+
+

+Since Ruby is very dynamic, methods added to the ancestors of BlankSlate +after BlankSlate is defined 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. +

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Object) method_added(name) + + + +

+
+

+Detect method additions to Kernel and remove them in the BlankSlate class. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+83
+84
+85
+86
+87
+88
+
+
# File 'lib/directory_template/blank_slate.rb', line 83
+
+def self.method_added(name)
+  result = template_directory_blank_slate_method_added(name)
+  return result if self != ::Kernel
+  DirectoryTemplate::BlankSlate.hide(name)
+  result
+end
+
+
+ +
+

+ + + (Object) template_directory_blank_slate_method_added + + + +

+ + + + +
+
+
+
+78
+
+
# File 'lib/directory_template/blank_slate.rb', line 78
+
+alias template_directory_blank_slate_method_added method_added
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Module.html b/doc/Module.html new file mode 100644 index 0000000..7a4ee22 --- /dev/null +++ b/doc/Module.html @@ -0,0 +1,267 @@ + + + + + + Class: Module + + — Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

Class: Module + + + +

+ +
+ +
Inherits:
+
+ Object + + + show all + +
+ + + + + + + + + +
Defined in:
+
lib/directory_template/blank_slate.rb
+ +
+
+ +

Overview

+
+

+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. +

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) append_features(mod) + + + +

+
+

+Monkey patch to the append_features callback of Module, used to update the +BlankSlate. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+126
+127
+128
+129
+130
+131
+132
+133
+
+
# File 'lib/directory_template/blank_slate.rb', line 126
+
+def append_features(mod)
+  result = template_directory_blank_slate_method_added(mod)
+  return result if mod != Object
+  instance_methods.each do |name|
+    DirectoryTemplate::BlankSlate.hide(name)
+  end
+  result
+end
+
+
+ +
+

+ + - (Object) template_directory_blank_slate_method_added + + + +

+ + + + +
+
+
+
+122
+
+
# File 'lib/directory_template/blank_slate.rb', line 122
+
+alias template_directory_blank_slate_method_added append_features
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Object.html b/doc/Object.html new file mode 100644 index 0000000..ff795c3 --- /dev/null +++ b/doc/Object.html @@ -0,0 +1,315 @@ + + + + + + Class: Object + + — Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

Class: Object + + + +

+ +
+ +
Inherits:
+
+ BasicObject + +
+ + + + + + + + + +
Defined in:
+
lib/directory_template/blank_slate.rb
+ +
+
+ +

Overview

+
+

+Same as above, except in Object. +

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Object) find_hidden_method(name) + + + +

+
+

+See DirectoryTemplate::BlankSlate::find_hidden_method This just serves as a +stopper/terminator of the lookup chain. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+110
+111
+112
+
+
# File 'lib/directory_template/blank_slate.rb', line 110
+
+def self.find_hidden_method(name)
+  nil
+end
+
+
+ +
+

+ + + (Object) method_added(name) + + + +

+
+

+Detect method additions to Object and remove them in the BlankSlate class. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+100
+101
+102
+103
+104
+105
+
+
# File 'lib/directory_template/blank_slate.rb', line 100
+
+def self.method_added(name)
+  result = template_directory_blank_slate_method_added(name)
+  return result if self != Object
+  DirectoryTemplate::BlankSlate.hide(name)
+  result
+end
+
+
+ +
+

+ + + (Object) template_directory_blank_slate_method_added + + + +

+ + + + +
+
+
+
+95
+
+
# File 'lib/directory_template/blank_slate.rb', line 95
+
+alias template_directory_blank_slate_method_added method_added
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/_index.html b/doc/_index.html new file mode 100644 index 0000000..ff6424b --- /dev/null +++ b/doc/_index.html @@ -0,0 +1,215 @@ + + + + + + Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

Documentation by YARD 0.7.5

+
+

Alphabetic Index

+ +

File Listing

+ + +
+

Namespace Listing A-Z

+ + + + + + + + +
+ + +
    +
  • B
  • +
      + +
    • + BlankSlate + + (DirectoryTemplate) + +
    • + +
    +
+ + + + + +
    +
  • E
  • + +
+ + +
    +
  • K
  • + +
+ + +
    +
  • M
  • + +
+ + +
    +
  • O
  • + +
+ + +
    +
  • P
  • + +
+ + +
+ + +
    +
  • V
  • +
      + +
    • + Variables + + (DirectoryTemplate::ErbTemplate) + +
    • + +
    +
+ +
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/class_list.html b/doc/class_list.html new file mode 100644 index 0000000..4e0fdcb --- /dev/null +++ b/doc/class_list.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + +
+

Class List

+ + + + +
+ + diff --git a/doc/css/common.css b/doc/css/common.css new file mode 100644 index 0000000..cf25c45 --- /dev/null +++ b/doc/css/common.css @@ -0,0 +1 @@ +/* Override this file with custom rules */ \ No newline at end of file diff --git a/doc/css/full_list.css b/doc/css/full_list.css new file mode 100644 index 0000000..3c03296 --- /dev/null +++ b/doc/css/full_list.css @@ -0,0 +1,55 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0N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1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; } +#full_list ul { padding: 0; } +#full_list li { padding: 5px; padding-left: 12px; margin: 0; font-size: 1.1em; list-style: none; } +#noresults { padding: 7px 12px; } +#content.insearch #noresults { margin-left: 7px; } +ul.collapsed ul, ul.collapsed li { display: none; } +ul.collapsed.search_uncollapsed { display: block; } +ul.collapsed.search_uncollapsed li { display: list-item; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } +li { color: #888; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.r1 { background: #f0f0f0; } +li.r2 { background: #fafafa; } +li:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a:link, a:visited { text-decoration: none; color: #05a; } +li.clicked { background: #05a; color: #ccc; } +li.clicked a:link, li.clicked a:visited { color: #eee; } +li.clicked a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; -moz-border-radius: 3px; -webkit-border-radius: 3px; } +#nav { margin-left: 10px; font-size: 0.9em; display: none; color: #aaa; } +#nav a:link, #nav a:visited { color: #358; } +#nav a:hover { background: transparent; color: #5af; } + +.frames #content h1 { margin-top: 0; } +.frames li { white-space: nowrap; cursor: normal; } +.frames li small { display: block; font-size: 0.8em; } +.frames li small:before { content: ""; } +.frames li small:after { content: ""; } +.frames li small.search_info { display: none; } +.frames #search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +.frames #content.insearch #search { background-position: center right; } +.frames #search input { width: 110px; } +.frames #nav { display: block; } + +#full_list.insearch li { display: none; } +#full_list.insearch li.found { display: list-item; padding-left: 10px; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/doc/css/style.css b/doc/css/style.css new file mode 100644 index 0000000..c8ff2bf --- /dev/null +++ b/doc/css/style.css @@ -0,0 +1,322 @@ +body { + padding: 0 20px; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; +} +body.frames { padding: 0 5px; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; +} +h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right; } +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.summary_desc .object_link, .docstring .object_link { font-family: monospace; } +.rdoc-term { padding-right: 25px; font-weight: bold; } +.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } + +/* style for
    */ +#filecontents li > p, .docstring li > p { margin: 0px; } +#filecontents ul, .docstring ul { padding-left: 20px; } +/* style for
    */ +#filecontents dl, .docstring dl { border: 1px solid #ccc; } +#filecontents dt, .docstring dt { background: #ddd; font-weight: bold; padding: 3px 5px; } +#filecontents dd, .docstring dd { padding: 5px 0px; margin-left: 18px; } +#filecontents dd > p, .docstring dd > p { margin: 0px; } + +.note { + color: #222; + -moz-border-radius: 3px; -webkit-border-radius: 3px; + background: #e3e4e3; border: 1px solid #d5d5d5; padding: 7px 10px; + display: block; +} +.note.todo { background: #ffffc5; border-color: #ececaa; } +.note.returns_void { background: #efefef; } +.note.deprecated { background: #ffe5e5; border-color: #e9dada; } +.note.private { background: #ffffc5; border-color: #ececaa; } +.note.title { text-transform: lowercase; padding: 1px 5px; font-size: 0.9em; font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; display: inline; } +.summary_signature + .note.title { margin-left: 7px; } +h1 .note.title { font-size: 0.5em; font-weight: normal; padding: 3px 5px; position: relative; top: -3px; text-transform: capitalize; } +.note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; } +.note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; } +.note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; } +.note.title.private { background: #d5d5d5; border-color: #c5c5c5; } +.discussion .note { margin-top: 6px; } +.discussion .note:first-child { margin-top: 0; } + +h3.inherited { + font-style: italic; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-weight: normal; + padding: 0; + margin: 0; + margin-top: 12px; + margin-bottom: 3px; + font-size: 13px; +} +p.inherited { + padding: 0; + margin: 0; + margin-left: 25px; +} + +#filecontents dl.box, dl.box { + border: 0; + width: 520px; + font-size: 1em; +} +#filecontents dl.box dt, dl.box dt { + float: left; + display: block; + width: 100px; + margin: 0; + text-align: right; + font-weight: bold; + background: transparent; + border: 1px solid #aaa; + border-width: 1px 0px 0px 1px; + padding: 6px 0; + padding-right: 10px; +} +#filecontents dl.box dd, dl.box dd { + float: left; + display: block; + width: 380px; + margin: 0; + padding: 6px 0; + padding-right: 20px; + border: 1px solid #aaa; + border-width: 1px 1px 0 0; +} +#filecontents dl.box .last, dl.box .last { + border-bottom: 1px solid #aaa; +} +#filecontents dl.box .r1, dl.box .r1 { background: #eee; } + +ul.toplevel { list-style: none; padding-left: 0; font-size: 1.1em; } +#files { padding-left: 15px; font-size: 1.1em; } + +#files { padding: 0; } +#files li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; } + +dl.constants { margin-left: 40px; } +dl.constants dt { font-weight: bold; font-size: 1.1em; margin-bottom: 5px; } +dl.constants dd { width: 75%; white-space: pre; font-family: monospace; margin-bottom: 18px; } + +.summary_desc { margin-left: 32px; display: block; font-family: sans-serif; } +.summary_desc tt { font-size: 0.9em; } +dl.constants .note { padding: 2px 6px; padding-right: 12px; margin-top: 6px; } +dl.constants .docstring { margin-left: 32px; font-size: 0.9em; font-weight: normal; } +dl.constants .tags { padding-left: 32px; font-size: 0.9em; line-height: 0.8em; } +dl.constants .discussion *:first-child { margin-top: 0; } +dl.constants .discussion *:last-child { margin-bottom: 0; } + +.method_details { border-top: 1px dotted #aaa; margin-top: 15px; padding-top: 0; } +.method_details.first { border: 0; } +p.signature { + font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace; + padding: 6px 10px; margin-top: 18px; + background: #e5e8ff; border: 1px solid #d8d8e5; -moz-border-radius: 3px; -webkit-border-radius: 3px; +} +p.signature tt { font-family: Monaco, Consolas, Courier, monospace; } +p.signature .overload { display: block; } +p.signature .extras { font-weight: normal; font-family: sans-serif; color: #444; font-size: 1em; } +p.signature .aliases { display: block; font-weight: normal; font-size: 0.9em; font-family: sans-serif; margin-top: 0px; color: #555; } +p.signature .aliases .names { font-family: Monaco, Consolas, Courier, monospace; font-weight: bold; color: #000; font-size: 1.2em; } + +.tags h3 { font-size: 1em; margin-bottom: 0; } +.tags ul { margin-top: 5px; padding-left: 30px; list-style: square; } +.tags ul li { margin-bottom: 3px; } +.tags ul .name { font-family: monospace; font-weight: bold; } +.tags ul .note { padding: 3px 6px; } +.tags { margin-bottom: 12px; } + +.tags .examples h3 { margin-bottom: 10px; } +.tags .examples h4 { padding: 0; margin: 0; margin-left: 15px; font-weight: bold; font-size: 0.9em; } + +.tags .overload .overload_item { list-style: none; margin-bottom: 25px; } +.tags .overload .overload_item .signature { + padding: 2px 8px; + background: #e5e8ff; border: 1px solid #d8d8e5; -moz-border-radius: 3px; -webkit-border-radius: 3px; +} +.tags .overload .signature { margin-left: -15px; font-family: monospace; display: block; font-size: 1.1em; } +.tags .overload .docstring { margin-top: 15px; } + +.defines { display: none; } + +#method_missing_details .notice.this { position: relative; top: -8px; color: #888; padding: 0; margin: 0; } + +.showSource { font-size: 0.9em; } +.showSource a:link, .showSource a:visited { text-decoration: none; color: #666; } + +#content a:link, #content a:visited { text-decoration: none; color: #05a; } +#content a:hover { background: #ffffa5; } +div.docstring, p.docstring { margin-right: 6em; } + +ul.summary { + list-style: none; + font-family: monospace; + font-size: 1em; + line-height: 1.5em; +} +ul.summary a:link, ul.summary a:visited { + text-decoration: none; font-size: 1.1em; +} +ul.summary li { margin-bottom: 5px; } +.summary .summary_signature { + padding: 1px 10px; + background: #eaeaff; border: 1px solid #dfdfe5; + -moz-border-radius: 3px; -webkit-border-radius: 3px; +} +.summary_signature:hover { background: #eeeeff; cursor: pointer; } +ul.summary.compact li { display: inline-block; margin: 0px 5px 0px 0px; line-height: 2.6em;} +ul.summary.compact .summary_signature { padding: 5px 7px; padding-right: 4px; } +#content .summary_signature:hover a:link, +#content .summary_signature:hover a:visited { + background: transparent; + color: #48f; +} + +p.inherited a { font-family: monospace; font-size: 0.9em; } +p.inherited { word-spacing: 5px; font-size: 1.2em; } + +p.children { font-size: 1.2em; } +p.children a { font-size: 0.9em; } +p.children strong { font-size: 0.8em; } +p.children strong.modules { padding-left: 5px; } + +ul.fullTree { display: none; padding-left: 0; list-style: none; margin-left: 0; margin-bottom: 10px; } +ul.fullTree ul { margin-left: 0; padding-left: 0; list-style: none; } +ul.fullTree li { text-align: center; padding-top: 18px; padding-bottom: 12px; background: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVU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Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAHtJREFUeNqMzrEJAkEURdGzuhgZbSoYWcAWoBVsB4JgZAGmphsZCZYzTQgWNCYrDN9RvMmHx+X916SUBFbo8CzD1idXrLErw1mQttgXtyrOcQ/Ny5p4Qh+2XqLYYazsPWNTiuMkRxa4vcV+evuNAUOLIx5+c2hyzv7hNQC67Q+/HHmlEwAAAABJRU5ErkJggg==) no-repeat top center; } +ul.fullTree li:first-child { padding-top: 0; background: transparent; } +ul.fullTree li:last-child { padding-bottom: 0; } +.showAll ul.fullTree { display: block; } +.showAll .inheritName { display: none; } + +#search { position: absolute; right: 14px; top: 0px; } +#search a:link, #search a:visited { + display: block; float: left; margin-right: 4px; + padding: 8px 10px; text-decoration: none; color: #05a; + border: 1px solid #d8d8e5; + -moz-border-radius-bottomleft: 3px; -moz-border-radius-bottomright: 3px; + -webkit-border-bottom-left-radius: 3px; -webkit-border-bottom-right-radius: 3px; + background: #eaf0ff; + -webkit-box-shadow: -1px 1px 3px #ddd; +} +#search a:hover { background: #f5faff; color: #06b; } +#search a.active { + background: #568; padding-bottom: 20px; color: #fff; border: 1px solid #457; + -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; + -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; +} +#search a.inactive { color: #999; } +.frames #search { display: none; } +.inheritanceTree, .toggleDefines { float: right; } + +#menu { font-size: 1.3em; color: #bbb; top: -5px; position: relative; } +#menu .title, #menu a { font-size: 0.7em; } +#menu .title a { font-size: 1em; } +#menu .title { color: #555; } +#menu a:link, #menu a:visited { color: #333; text-decoration: none; border-bottom: 1px dotted #bbd; } +#menu a:hover { color: #05a; } +#menu .noframes { display: none; } +.frames #menu .noframes { display: inline; float: right; } + +#footer { margin-top: 15px; border-top: 1px solid #ccc; text-align: center; padding: 7px 0; color: #999; } +#footer a:link, #footer a:visited { color: #444; text-decoration: none; border-bottom: 1px dotted #bbd; } +#footer a:hover { color: #05a; } + +#listing ul.alpha { font-size: 1.1em; } +#listing ul.alpha { margin: 0; padding: 0; padding-bottom: 10px; list-style: none; } +#listing ul.alpha li.letter { font-size: 1.4em; padding-bottom: 10px; } +#listing ul.alpha ul { margin: 0; padding-left: 15px; } +#listing ul small { color: #666; font-size: 0.7em; } + +li.r1 { background: #f0f0f0; } +li.r2 { background: #fafafa; } + +#search_frame { + z-index: 9999; + background: #fff; + display: none; + position: absolute; + top: 36px; + right: 18px; + width: 500px; + height: 80%; + overflow-y: scroll; + border: 1px solid #999; + border-collapse: collapse; + -webkit-box-shadow: -7px 5px 25px #aaa; + -moz-box-shadow: -7px 5px 25px #aaa; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +#content ul.summary li.deprecated .summary_signature a:link, +#content ul.summary li.deprecated .summary_signature a:visited { text-decoration: line-through; font-style: italic; } + +#toc { + padding: 20px; padding-right: 30px; border: 1px solid #ddd; float: right; background: #fff; margin-left: 20px; margin-bottom: 20px; + max-width: 300px; + -webkit-box-shadow: -2px 2px 6px #bbb; + -moz-box-shadow: -2px 2px 6px #bbb; + z-index: 5000; + position: relative; +} +#toc.nofloat { float: none; max-width: none; border: none; padding: 0; margin: 20px 0; -webkit-box-shadow: none; -moz-box-shadow: none; } +#toc.nofloat.hidden { padding: 0; background: 0; margin-bottom: 5px; } +#toc .title { margin: 0; } +#toc ol { padding-left: 1.8em; } +#toc li { font-size: 1.1em; line-height: 1.7em; } +#toc > ol > li { font-size: 1.1em; font-weight: bold; } +#toc ol > ol { font-size: 0.9em; } +#toc ol ol > ol { padding-left: 2.3em; } +#toc ol + li { margin-top: 0.3em; } +#toc.hidden { padding: 10px; background: #f6f6f6; -webkit-box-shadow: none; -moz-box-shadow: none; } +#filecontents h1 + #toc.nofloat { margin-top: 0; } + +/* syntax highlighting */ +.source_code { display: none; padding: 3px 8px; border-left: 8px solid #ddd; margin-top: 5px; } +#filecontents pre.code, .docstring pre.code, .source_code pre { font-family: monospace; } +#filecontents pre.code, .docstring pre.code { display: block; } +.source_code .lines { padding-right: 12px; color: #555; text-align: right; } +#filecontents pre.code, .docstring pre.code, +.tags pre.example { padding: 5px 12px; margin-top: 4px; border: 1px solid #eef; background: #f5f5ff; } +pre.code { color: #000; } +pre.code .info.file { color: #555; } +pre.code .val { color: #036A07; } +pre.code .tstring_content, +pre.code .heredoc_beg, pre.code .heredoc_end, +pre.code .qwords_beg, pre.code .qwords_end, +pre.code .tstring, pre.code .dstring { color: #036A07; } +pre.code .fid, pre.code .rubyid_new, pre.code .rubyid_to_s, +pre.code .rubyid_to_sym, pre.code .rubyid_to_f, +pre.code .dot + pre.code .id, +pre.code .rubyid_to_i pre.code .rubyid_each { color: #0085FF; } +pre.code .comment { color: #0066FF; } +pre.code .const, pre.code .constant { color: #585CF6; } +pre.code .symbol { color: #C5060B; } +pre.code .kw, +pre.code .label, +pre.code .rubyid_require, +pre.code .rubyid_extend, +pre.code .rubyid_include { color: #0000FF; } +pre.code .ivar { color: #318495; } +pre.code .gvar, +pre.code .rubyid_backref, +pre.code .rubyid_nth_ref { color: #6D79DE; } +pre.code .regexp, .dregexp { color: #036A07; } +pre.code a { border-bottom: 1px dotted #bbf; } diff --git a/doc/file.README.html b/doc/file.README.html new file mode 100644 index 0000000..0828661 --- /dev/null +++ b/doc/file.README.html @@ -0,0 +1,116 @@ + + + + + + File: README + + — Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

    README

    + +

    Summary

    + +

    Create directories from templates, optionally preprocessing paths and contents.

    + +

    Installation

    + +

    gem install directory_template

    + +

    Usage

    + +

    Create a template from an existing structure and materialize it (create directories & +files).

    + +
    require 'directory_template/register_all' # load all processors
    +variables = {
    +  namespace:    'Namespace',
    +  version:      '1.2.3',
    +  gem_name:     'gem-name',
    +  require_name: 'require_name',
    +  description:  "The description",
    +  summary:      "The summary"
    +}
    +template = DirectoryTemplate.directory('examples/dir_gem_template')
    +template.materialize('new_project', variables: variables)
    +
    + +

    Create a template from a YAML file:

    + +
    require 'directory_template/register_all' # load all processors
    +variables = {
    +  namespace:    'Namespace',
    +  version:      '1.2.3',
    +  gem_name:     'gem-name',
    +  require_name: 'require_name',
    +  description:  "The description",
    +  summary:      "The summary"
    +}
    +template = DirectoryTemplate.directory('examples/yaml_gem_template.yaml')
    +template.materialize('new_project', variables: variables)
    +
    + +

    Description

    + +

    Create directories from templates. +Existing directory structures, yaml files and ruby datastructures can all serve as +sources of a template. +Can preprocess pathnames and content. +Path- and ContentProcessors are exchangeable.

    +
    + + + + + \ No newline at end of file diff --git a/doc/file_list.html b/doc/file_list.html new file mode 100644 index 0000000..2ea5474 --- /dev/null +++ b/doc/file_list.html @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + +
    +

    File List

    + + + + +
    + + diff --git a/doc/frames.html b/doc/frames.html new file mode 100644 index 0000000..ff4a68c --- /dev/null +++ b/doc/frames.html @@ -0,0 +1,13 @@ + + + + + + Documentation by YARD 0.7.5 + + + + + + diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..0828661 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,116 @@ + + + + + + File: README + + — Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

    README

    + +

    Summary

    + +

    Create directories from templates, optionally preprocessing paths and contents.

    + +

    Installation

    + +

    gem install directory_template

    + +

    Usage

    + +

    Create a template from an existing structure and materialize it (create directories & +files).

    + +
    require 'directory_template/register_all' # load all processors
    +variables = {
    +  namespace:    'Namespace',
    +  version:      '1.2.3',
    +  gem_name:     'gem-name',
    +  require_name: 'require_name',
    +  description:  "The description",
    +  summary:      "The summary"
    +}
    +template = DirectoryTemplate.directory('examples/dir_gem_template')
    +template.materialize('new_project', variables: variables)
    +
    + +

    Create a template from a YAML file:

    + +
    require 'directory_template/register_all' # load all processors
    +variables = {
    +  namespace:    'Namespace',
    +  version:      '1.2.3',
    +  gem_name:     'gem-name',
    +  require_name: 'require_name',
    +  description:  "The description",
    +  summary:      "The summary"
    +}
    +template = DirectoryTemplate.directory('examples/yaml_gem_template.yaml')
    +template.materialize('new_project', variables: variables)
    +
    + +

    Description

    + +

    Create directories from templates. +Existing directory structures, yaml files and ruby datastructures can all serve as +sources of a template. +Can preprocess pathnames and content. +Path- and ContentProcessors are exchangeable.

    +
    + + + + + \ No newline at end of file diff --git a/doc/js/app.js b/doc/js/app.js new file mode 100644 index 0000000..1b4e04b --- /dev/null +++ b/doc/js/app.js @@ -0,0 +1,205 @@ +function createSourceLinks() { + $('.method_details_list .source_code'). + before("[View source]"); + $('.toggleSource').toggle(function() { + $(this).parent().nextAll('.source_code').slideDown(100); + $(this).text("Hide source"); + }, + function() { + $(this).parent().nextAll('.source_code').slideUp(100); + $(this).text("View source"); + }); +} + +function createDefineLinks() { + var tHeight = 0; + $('.defines').after(" more..."); + $('.toggleDefines').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).prev().show(); + $(this).parent().prev().height($(this).parent().height()); + $(this).text("(less)"); + }, + function() { + $(this).prev().hide(); + $(this).parent().prev().height(tHeight); + $(this).text("more..."); + }); +} + +function createFullTreeLinks() { + var tHeight = 0; + $('.inheritanceTree').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).parent().toggleClass('showAll'); + $(this).text("(hide)"); + $(this).parent().prev().height($(this).parent().height()); + }, + function() { + $(this).parent().toggleClass('showAll'); + $(this).parent().prev().height(tHeight); + $(this).text("show all"); + }); +} + +function fixBoxInfoHeights() { + $('dl.box dd.r1, dl.box dd.r2').each(function() { + $(this).prev().height($(this).height()); + }); +} + +function searchFrameLinks() { + $('#method_list_link').click(function() { + toggleSearchFrame(this, relpath + 'method_list.html'); + }); + + $('#class_list_link').click(function() { + toggleSearchFrame(this, relpath + 'class_list.html'); + }); + + $('#file_list_link').click(function() { + toggleSearchFrame(this, relpath + 'file_list.html'); + }); +} + +function toggleSearchFrame(id, link) { + var frame = $('#search_frame'); + $('#search a').removeClass('active').addClass('inactive'); + if (frame.attr('src') == link && frame.css('display') != "none") { + frame.slideUp(100); + $('#search a').removeClass('active inactive'); + } + else { + $(id).addClass('active').removeClass('inactive'); + frame.attr('src', link).slideDown(100); + } +} + +function linkSummaries() { + $('.summary_signature').click(function() { + document.location = $(this).find('a').attr('href'); + }); +} + +function framesInit() { + if (window.top.frames.main) { + document.body.className = 'frames'; + $('#menu .noframes a').attr('href', document.location); + $('html head title', window.parent.document).text($('html head title').text()); + } +} + +function keyboardShortcuts() { + if (window.top.frames.main) return; + $(document).keypress(function(evt) { + if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return; + if (typeof evt.target !== "undefined" && + (evt.target.nodeName == "INPUT" || + evt.target.nodeName == "TEXTAREA")) return; + switch (evt.charCode) { + case 67: case 99: $('#class_list_link').click(); break; // 'c' + case 77: case 109: $('#method_list_link').click(); break; // 'm' + case 70: case 102: $('#file_list_link').click(); break; // 'f' + default: break; + } + }); +} + +function summaryToggle() { + $('.summary_toggle').click(function() { + localStorage.summaryCollapsed = $(this).text(); + $(this).text($(this).text() == "collapse" ? "expand" : "collapse"); + var next = $(this).parent().parent().nextAll('ul.summary').first(); + if (next.hasClass('compact')) { + next.toggle(); + next.nextAll('ul.summary').first().toggle(); + } + else if (next.hasClass('summary')) { + var list = $('
      '); + list.html(next.html()); + list.find('.summary_desc, .note').remove(); + list.find('a').each(function() { + $(this).html($(this).find('strong').html()); + $(this).parent().html($(this)[0].outerHTML); + }); + next.before(list); + next.toggle(); + } + return false; + }); + if (localStorage) { + if (localStorage.summaryCollapsed == "collapse") $('.summary_toggle').click(); + else localStorage.summaryCollapsed = "expand"; + } +} + +function fixOutsideWorldLinks() { + $('a').each(function() { + if (window.location.host != this.host) this.target = '_parent'; + }); +} + +function generateTOC() { + if ($('#filecontents').length === 0) return; + var _toc = $('
        '); + var show = false; + var toc = _toc; + var counter = 0; + var tags = ['h2', 'h3', 'h4', 'h5', 'h6']; + var i; + if ($('#filecontents h1').length > 1) tags.unshift('h1'); + for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; } + var lastTag = parseInt(tags[0][1], 10); + $(tags.join(', ')).each(function() { + if (this.id == "filecontents") return; + show = true; + var thisTag = parseInt(this.tagName[1], 10); + if (this.id.length === 0) { + var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_'); + if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; } + this.id = proposedId; + } + if (thisTag > lastTag) { + for (i = 0; i < thisTag - lastTag; i++) { + var tmp = $('
          '); toc.append(tmp); toc = tmp; + } + } + if (thisTag < lastTag) { + for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent(); + } + toc.append('
        1. ' + $(this).text() + '
        2. '); + lastTag = thisTag; + }); + if (!show) return; + html = ''; + $('#content').prepend(html); + $('#toc').append(_toc); + $('#toc .hide_toc').toggle(function() { + $('#toc .top').slideUp('fast'); + $('#toc').toggleClass('hidden'); + $('#toc .title small').toggle(); + }, function() { + $('#toc .top').slideDown('fast'); + $('#toc').toggleClass('hidden'); + $('#toc .title small').toggle(); + }); + $('#toc .float_toc').toggle(function() { + $(this).text('float'); + $('#toc').toggleClass('nofloat'); + }, function() { + $(this).text('left'); + $('#toc').toggleClass('nofloat'); + }); +} + +$(framesInit); +$(createSourceLinks); +$(createDefineLinks); +$(createFullTreeLinks); +$(fixBoxInfoHeights); +$(searchFrameLinks); +$(linkSummaries); +$(keyboardShortcuts); +$(summaryToggle); +$(fixOutsideWorldLinks); +$(generateTOC); \ No newline at end of file diff --git a/doc/js/full_list.js b/doc/js/full_list.js new file mode 100644 index 0000000..9ffaa6d --- /dev/null +++ b/doc/js/full_list.js @@ -0,0 +1,173 @@ +var inSearch = null; +var searchIndex = 0; +var searchCache = []; +var searchString = ''; +var regexSearchString = ''; +var caseSensitiveMatch = false; +var ignoreKeyCodeMin = 8; +var ignoreKeyCodeMax = 46; +var commandKey = 91; + +RegExp.escape = function(text) { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); +} + +function fullListSearch() { + // generate cache + searchCache = []; + $('#full_list li').each(function() { + var link = $(this).find('.object_link a'); + var fullName = link.attr('title').split(' ')[0]; + searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link}); + }); + + $('#search input').keyup(function() { + if ((event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) + || event.keyCode == commandKey) + return; + searchString = this.value; + caseSensitiveMatch = searchString.match(/[A-Z]/) != null; + regexSearchString = RegExp.escape(searchString); + if (caseSensitiveMatch) { + regexSearchString += "|" + + $.map(searchString.split(''), function(e) { return RegExp.escape(e); }). + join('.+?'); + } + if (searchString === "") { + clearTimeout(inSearch); + inSearch = null; + $('ul .search_uncollapsed').removeClass('search_uncollapsed'); + $('#full_list, #content').removeClass('insearch'); + $('#full_list li').removeClass('found').each(function() { + + var link = $(this).find('.object_link a'); + link.text(link.text()); + }); + if (clicked) { + clicked.parents('ul').each(function() { + $(this).removeClass('collapsed').prev().removeClass('collapsed'); + }); + } + highlight(); + } + else { + if (inSearch) clearTimeout(inSearch); + searchIndex = 0; + lastRowClass = ''; + $('#full_list, #content').addClass('insearch'); + $('#noresults').text(''); + searchItem(); + } + }); + + $('#search input').focus(); + $('#full_list').after("
          "); +} + +var lastRowClass = ''; +function searchItem() { + for (var i = 0; i < searchCache.length / 50; i++) { + var item = searchCache[searchIndex]; + var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name); + var matchString = regexSearchString; + var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i"); + if (searchName.match(matchRegexp) == null) { + item.node.removeClass('found'); + } + else { + item.node.css('padding-left', '10px').addClass('found'); + item.node.parents().addClass('search_uncollapsed'); + item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1'); + lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2'; + item.link.html(item.name.replace(matchRegexp, "$&")); + } + + if (searchCache.length === searchIndex + 1) { + searchDone(); + return; + } + else { + searchIndex++; + } + } + inSearch = setTimeout('searchItem()', 0); +} + +function searchDone() { + highlight(true); + if ($('#full_list li:visible').size() === 0) { + $('#noresults').text('No results were found.').hide().fadeIn(); + } + else { + $('#noresults').text(''); + } + $('#content').removeClass('insearch'); + clearTimeout(inSearch); + inSearch = null; +} + +clicked = null; +function linkList() { + $('#full_list li, #full_list li a:last').click(function(evt) { + if ($(this).hasClass('toggle')) return true; + if (this.tagName.toLowerCase() == "li") { + var toggle = $(this).children('a.toggle'); + if (toggle.size() > 0 && evt.pageX < toggle.offset().left) { + toggle.click(); + return false; + } + } + if (clicked) clicked.removeClass('clicked'); + var win = window.top.frames.main ? window.top.frames.main : window.parent; + if (this.tagName.toLowerCase() == "a") { + clicked = $(this).parent('li').addClass('clicked'); + win.location = this.href; + } + else { + clicked = $(this).addClass('clicked'); + win.location = $(this).find('a:last').attr('href'); + } + return false; + }); +} + +function collapse() { + if (!$('#full_list').hasClass('class')) return; + $('#full_list.class a.toggle').click(function() { + $(this).parent().toggleClass('collapsed').next().toggleClass('collapsed'); + highlight(); + return false; + }); + $('#full_list.class ul').each(function() { + $(this).addClass('collapsed').prev().addClass('collapsed'); + }); + $('#full_list.class').children().removeClass('collapsed'); + highlight(); +} + +function highlight(no_padding) { + var n = 1; + $('#full_list li:visible').each(function() { + var next = n == 1 ? 2 : 1; + $(this).removeClass("r" + next).addClass("r" + n); + if (!no_padding && $('#full_list').hasClass('class')) { + $(this).css('padding-left', (10 + $(this).parents('ul').size() * 15) + 'px'); + } + n = next; + }); +} + +function escapeShortcut() { + $(document).keydown(function(evt) { + if (evt.which == 27) { + $('#search_frame', window.top.document).slideUp(100); + $('#search a', window.top.document).removeClass('active inactive'); + $(window.top).focus(); + } + }); +} + +$(escapeShortcut); +$(fullListSearch); +$(linkList); +$(collapse); diff --git a/doc/js/jquery.js b/doc/js/jquery.js new file mode 100644 index 0000000..f78f96a --- /dev/null +++ b/doc/js/jquery.js @@ -0,0 +1,16 @@ +/*! + * jQuery JavaScript Library v1.5.2 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu Mar 31 15:28:23 2011 -0400 + */ +(function(a,b){function ci(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cf(a){if(!b_[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";b_[a]=c}return b_[a]}function ce(a,b){var c={};d.each(cd.concat.apply([],cd.slice(0,b)),function(){c[this]=a});return c}function b$(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bZ(){try{return new a.XMLHttpRequest}catch(b){}}function bY(){d(a).unload(function(){for(var a in bW)bW[a](0,1)})}function bS(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g=0===c})}function P(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function H(a,b){return(a&&a!=="*"?a+".":"")+b.replace(t,"`").replace(u,"&")}function G(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,p=[],q=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;ic)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function E(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function y(){return!0}function x(){return!1}function i(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function h(a,c,e){if(e===b&&a.nodeType===1){e=a.getAttribute("data-"+c);if(typeof e==="string"){try{e=e==="true"?!0:e==="false"?!1:e==="null"?null:d.isNaN(e)?g.test(e)?d.parseJSON(e):e:parseFloat(e)}catch(f){}d.data(a,c,e)}else e=b}return e}var c=a.document,d=function(){function G(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(G,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x,y,z=Object.prototype.toString,A=Object.prototype.hasOwnProperty,B=Array.prototype.push,C=Array.prototype.slice,D=String.prototype.trim,E=Array.prototype.indexOf,F={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.2",length:0,size:function(){return this.length},toArray:function(){return C.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?B.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),x.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(C.apply(this,arguments),"slice",C.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:B,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;x.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=d._Deferred();if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",y,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",y),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&G()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):F[z.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!A.call(a,"constructor")&&!A.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||A.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g1?f.call(arguments,0):c,--g||h.resolveWith(h,f.call(b,0))}}var b=arguments,c=0,e=b.length,g=e,h=e<=1&&a&&d.isFunction(a.promise)?a:d.Deferred();if(e>1){for(;c
          a";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0,reliableMarginRight:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e)}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
          ",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
          t
          ";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(a.style.width="1px",a.style.marginRight="0",d.support.reliableMarginRight=(parseInt(c.defaultView.getComputedStyle(a,null).marginRight,10)||0)===0),b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function");return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}}();var g=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!i(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,g=b.nodeType,h=g?d.cache:b,j=g?b[d.expando]:d.expando;if(!h[j])return;if(c){var k=e?h[j][f]:h[j];if(k){delete k[c];if(!i(k))return}}if(e){delete h[j][f];if(!i(h[j]))return}var l=h[j][f];d.support.deleteExpando||h!=a?delete h[j]:h[j]=null,l?(h[j]={},g||(h[j].toJSON=d.noop),h[j][f]=l):g&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var f=this[0].attributes,g;for(var i=0,j=f.length;i-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var j=i?f:0,k=i?f+1:h.length;j=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=m.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&n.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var k=a.getAttributeNode("tabIndex");return k&&k.specified?k.value:o.test(a.nodeName)||p.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var l=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return l===null?b:l}h&&(a[c]=e);return a[c]}});var r=/\.(.*)$/,s=/^(?:textarea|input|select)$/i,t=/\./g,u=/ /g,v=/[^\w\s.|`]/g,w=function(a){return a.replace(v,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=x;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(a){return typeof d!=="undefined"&&d.event.triggered!==a.type?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=x);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),w).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(r,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=a.type,l[m]())}catch(p){}k&&(l["on"+m]=k),d.event.triggered=b}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},D=function D(a){var c=a.target,e,f;if(s.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=C(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:D,beforedeactivate:D,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&D.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&D.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",C(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in B)d.event.add(this,c+".specialChange",B[c]);return s.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return s.test(this.nodeName)}},B=d.event.special.change.filters,B.focus=B.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function f(a){var c=d.event.fix(a);c.type=b,c.originalEvent={},d.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var e=0;d.event.special[b]={setup:function(){e++===0&&c.addEventListener(a,f,!0)},teardown:function(){--e===0&&c.removeEventListener(a,f,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return"text"===c&&(b===c||b===null)},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

          ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
          ";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(var g=c;g0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=N.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(P(c[0])||P(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=M.call(arguments);I.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!O[a]?d.unique(f):f,(this.length>1||K.test(e))&&J.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var R=/ jQuery\d+="(?:\d+|null)"/g,S=/^\s+/,T=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,U=/<([\w:]+)/,V=/",""],legend:[1,"
          ","
          "],thead:[1,"","
          "],tr:[2,"","
          "],td:[3,"","
          "],col:[2,"","
          "],area:[1,"",""],_default:[0,"",""]};Z.optgroup=Z.option,Z.tbody=Z.tfoot=Z.colgroup=Z.caption=Z.thead,Z.th=Z.td,d.support.htmlSerialize||(Z._default=[1,"div
          ","
          "]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(R,""):null;if(typeof a!=="string"||X.test(a)||!d.support.leadingWhitespace&&S.test(a)||Z[(U.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(T,"<$1>");try{for(var c=0,e=this.length;c1&&l0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){ba(a,e),f=bb(a),g=bb(e);for(h=0;f[h];++h)ba(f[h],g[h])}if(b){_(a,e);if(c){f=bb(a),g=bb(e);for(h=0;f[h];++h)_(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||W.test(i)){if(typeof i==="string"){i=i.replace(T,"<$1>");var j=(U.exec(i)||["",""])[1].toLowerCase(),k=Z[j]||Z._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=V.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]===""&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&S.test(i)&&m.insertBefore(b.createTextNode(S.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bd=/alpha\([^)]*\)/i,be=/opacity=([^)]*)/,bf=/-([a-z])/ig,bg=/([A-Z]|^ms)/g,bh=/^-?\d+(?:px)?$/i,bi=/^-?\d/,bj={position:"absolute",visibility:"hidden",display:"block"},bk=["Left","Right"],bl=["Top","Bottom"],bm,bn,bo,bp=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bm(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bm)return bm(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bf,bp)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bq(a,b,e):d.swap(a,bj,function(){f=bq(a,b,e)});if(f<=0){f=bm(a,b,b),f==="0px"&&bo&&(f=bo(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bh.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return be.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bd.test(f)?f.replace(bd,e):c.filter+" "+e}}),d(function(){d.support.reliableMarginRight||(d.cssHooks.marginRight={get:function(a,b){var c;d.swap(a,{display:"inline-block"},function(){b?c=bm(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bn=function(a,c,e){var f,g,h;e=e.replace(bg,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bo=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bh.test(d)&&bi.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bm=bn||bo,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var br=/%20/g,bs=/\[\]$/,bt=/\r?\n/g,bu=/#.*$/,bv=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bw=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bx=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,by=/^(?:GET|HEAD)$/,bz=/^\/\//,bA=/\?/,bB=/)<[^<]*)*<\/script>/gi,bC=/^(?:select|textarea)/i,bD=/\s+/,bE=/([?&])_=[^&]*/,bF=/(^|\-)([a-z])/g,bG=function(a,b,c){return b+c.toUpperCase()},bH=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bI=d.fn.load,bJ={},bK={},bL,bM;try{bL=c.location.href}catch(bN){bL=c.createElement("a"),bL.href="",bL=bL.href}bM=bH.exec(bL.toLowerCase())||[],d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bI)return bI.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("
          ").append(c.replace(bB,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bC.test(this.nodeName)||bw.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(bt,"\r\n")}}):{name:b.name,value:c.replace(bt,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bL,isLocal:bx.test(bM[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bO(bJ),ajaxTransport:bO(bK),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bR(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bS(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bF,bG)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bv.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bu,"").replace(bz,bM[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bD),e.crossDomain==null&&(q=bH.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bM[1]||q[2]!=bM[2]||(q[3]||(q[1]==="http:"?80:443))!=(bM[3]||(bM[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bP(bJ,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!by.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(bA.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bE,"$1_="+w);e.url=x+(x===e.url?(bA.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bP(bK,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bQ(g,a[g],c,f);return e.join("&").replace(br,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bT=d.now(),bU=/(\=)\?(&|$)|\?\?/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bT++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bU.test(b.url)||f&&bU.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bU,l),b.url===j&&(f&&(k=k.replace(bU,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bV=d.now(),bW,bX;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bZ()||b$()}:bZ,bX=d.ajaxSettings.xhr(),d.support.ajax=!!bX,d.support.cors=bX&&"withCredentials"in bX,bX=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),!a.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bW[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bW||(bW={},bY()),h=bV++,g.onreadystatechange=bW[h]=c):c()},abort:function(){c&&c(0,1)}}}});var b_={},ca=/^(?:toggle|show|hide)$/,cb=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cc,cd=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(ce("show",3),a,b,c);for(var g=0,h=this.length;g=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:ce("show",1),slideUp:ce("hide",1),slideToggle:ce("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!cc&&(cc=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b
          ";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=(e==="absolute"||e==="fixed")&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=ch.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!ch.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=ci(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=ci(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window); \ No newline at end of file diff --git a/doc/method_list.html b/doc/method_list.html new file mode 100644 index 0000000..2dd2866 --- /dev/null +++ b/doc/method_list.html @@ -0,0 +1,582 @@ + + + + + + + + + + + + + + + + + + + + +
          +

          Method List

          + + + + +
          + + diff --git a/doc/top-level-namespace.html b/doc/top-level-namespace.html new file mode 100644 index 0000000..ec790d9 --- /dev/null +++ b/doc/top-level-namespace.html @@ -0,0 +1,107 @@ + + + + + + Top Level Namespace + + — Documentation by YARD 0.7.5 + + + + + + + + + + + + + + + + + + + + + + +

          Top Level Namespace + + + +

          + +
          + + + + + + + + +
          +
          + +

          Defined Under Namespace

          +

          + + + Modules: Kernel + + + + Classes: DirectoryTemplate, Module, Object + + +

          + + + + + + + + + +
          + + + + + \ No newline at end of file diff --git a/documentation/.gitkeep b/documentation/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/examples/dir_gem_template/%{gem_name}/%{gem_name}.gemspec.stop.erb b/examples/dir_gem_template/%{gem_name}/%{gem_name}.gemspec.stop.erb new file mode 100644 index 0000000..8733423 --- /dev/null +++ b/examples/dir_gem_template/%{gem_name}/%{gem_name}.gemspec.stop.erb @@ -0,0 +1,33 @@ +# encoding: utf-8 + +Gem::Specification.new do |s| + s.name = <%= gem_name.inspect %> + s.version = <%= version.to_s.inspect %> + s.authors = <%= author.inspect %> + s.description = <<-DESCRIPTION.gsub(/^ /, '').chomp +<%= description && description.gsub(/^/,' ') %> + DESCRIPTION + s.summary = <<-SUMMARY.gsub(/^ /, '').chomp +<%= summary && summary.gsub(/^/,' ') %> + SUMMARY + s.email = <%= email.inspect %> + + s.files = + Dir['bin/**/*'] + + Dir['lib/**/*'] + + Dir['rake/**/*'] + + Dir['test/**/*'] + + Dir['*.gemspec'] + + %w[ + Rakefile + README.markdown + ] + if File.directory?('bin') then + executables = Dir.chdir('bin') { Dir.glob('**/*').select { |f| File.executable?(f) } } + s.executables = executables unless executables.empty? + end + + s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") + s.rubygems_version = "1.3.1" + s.specification_version = 3 +end diff --git a/examples/dir_gem_template/%{gem_name}/README.markdown.stop.erb b/examples/dir_gem_template/%{gem_name}/README.markdown.stop.erb new file mode 100644 index 0000000..d71e72b --- /dev/null +++ b/examples/dir_gem_template/%{gem_name}/README.markdown.stop.erb @@ -0,0 +1,21 @@ +README +====== + + +Summary +------- +<%= summary %> + + +Installation +------------ +`gem install <%= gem_name %>` + + +Usage +----- + + +Description +----------- +<%= description %> diff --git a/examples/dir_gem_template/%{gem_name}/README_DIRECTORIES.stop b/examples/dir_gem_template/%{gem_name}/README_DIRECTORIES.stop new file mode 100644 index 0000000..0baea48 --- /dev/null +++ b/examples/dir_gem_template/%{gem_name}/README_DIRECTORIES.stop @@ -0,0 +1,9 @@ +This readme informs you about the purpose of the directories + +PROJECT/bin: Executable files +PROJECT/documentation: Prosa documentation of your project +PROJECT/development: Ideas and other things relevant for developing +PROJECT/lib: Your ruby library files +PROJECT/rake/lib: Libraries that are not part of your library, but used by your rake tasks +PROJECT/rake/tasks: Your rake tasks, using either .rb, .task or .rake as suffix +PROJECT/test: The tests for your library diff --git a/examples/dir_gem_template/%{gem_name}/Rakefile.stop b/examples/dir_gem_template/%{gem_name}/Rakefile.stop new file mode 100644 index 0000000..80ec5a7 --- /dev/null +++ b/examples/dir_gem_template/%{gem_name}/Rakefile.stop @@ -0,0 +1,10 @@ +$LOAD_PATH.unshift(File.expand_path('../rake/lib', __FILE__)) +Dir.glob(File.expand_path('../rake/tasks/**/*.{rake,task,rb}', __FILE__)) do |task_file| + begin + import task_file + rescue LoadError => e + warn "Failed to load task file #{task_file}" + warn " #{e.class} #{e.message}" + warn " #{e.backtrace.first}" + end +end diff --git a/examples/dir_gem_template/%{gem_name}/bin/.gitkeep b/examples/dir_gem_template/%{gem_name}/bin/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/examples/dir_gem_template/%{gem_name}/development/.gitkeep b/examples/dir_gem_template/%{gem_name}/development/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/examples/dir_gem_template/%{gem_name}/documentation/.gitkeep b/examples/dir_gem_template/%{gem_name}/documentation/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/examples/dir_gem_template/%{gem_name}/lib/%{require_name}.stop.erb b/examples/dir_gem_template/%{gem_name}/lib/%{require_name}.stop.erb new file mode 100644 index 0000000..86c71dd --- /dev/null +++ b/examples/dir_gem_template/%{gem_name}/lib/%{require_name}.stop.erb @@ -0,0 +1,12 @@ +# encoding: utf-8 + + + +require '<%= require_name %>/version' + + + +# <%= namespace.chomp %> +<%= description.gsub(/\n*\z/, '').gsub(/^/, '# ')+"\n" %> +module <%= namespace %> +end diff --git a/examples/dir_gem_template/%{gem_name}/lib/%{require_name}/version.rb.stop.erb b/examples/dir_gem_template/%{gem_name}/lib/%{require_name}/version.rb.stop.erb new file mode 100644 index 0000000..d87cea5 --- /dev/null +++ b/examples/dir_gem_template/%{gem_name}/lib/%{require_name}/version.rb.stop.erb @@ -0,0 +1,11 @@ +# encoding: utf-8 + +begin + require 'rubygems/version' # newer rubygems use this +rescue LoadError + require 'gem/version' # older rubygems use this +end + +module <%= namespace %> + Version = Gem::Version.new(<%= version.to_s.inspect %>) +end diff --git a/examples/dir_gem_template/%{gem_name}/lib/.gitkeep b/examples/dir_gem_template/%{gem_name}/lib/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/examples/dir_gem_template/%{gem_name}/rake/lib/.gitkeep b/examples/dir_gem_template/%{gem_name}/rake/lib/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/examples/dir_gem_template/%{gem_name}/rake/tasks/.gitkeep b/examples/dir_gem_template/%{gem_name}/rake/tasks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/examples/dir_gem_template/%{gem_name}/test/.gitkeep b/examples/dir_gem_template/%{gem_name}/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/examples/yaml_gem_template.yaml b/examples/yaml_gem_template.yaml new file mode 100644 index 0000000..c6790e6 --- /dev/null +++ b/examples/yaml_gem_template.yaml @@ -0,0 +1,110 @@ +'%{gem_name}': + 'bin': + '%{gem_name}.stop': ~ + 'development': {} + 'documentation': {} + 'lib': + '%{require_name}': + 'version.rb.stop.erb': | + # encoding: utf-8 + + begin + require 'rubygems/version' # newer rubygems use this + rescue LoadError + require 'gem/version' # older rubygems use this + end + + module <%= namespace %> + Version = Gem::Version.new(<%= version.to_s.inspect %>) + end + '%{require_name}.rb.stop.erb': | + # encoding: utf-8 + + + + require '<%= require_name %>/version' + + + + # <%= namespace.chomp %> + <%= description.gsub(/\n*\z/, '').gsub(/^/, '# ')+"\n" %> + module <%= namespace %> + end + '%{gem_name}.gemspec.stop.erb': | + # encoding: utf-8 + + Gem::Specification.new do |s| + s.name = <%= gem_name.inspect %> + s.version = <%= version.to_s.inspect %> + s.authors = <%= author.inspect %> + s.description = <<-DESCRIPTION.gsub(/^ /, '').chomp + <%= description && description.gsub(/^/,' ') %> + DESCRIPTION + s.summary = <<-SUMMARY.gsub(/^ /, '').chomp + <%= summary && summary.gsub(/^/,' ') %> + SUMMARY + s.email = <%= email.inspect %> + + s.files = + Dir['bin/**/*'] + + Dir['lib/**/*'] + + Dir['rake/**/*'] + + Dir['test/**/*'] + + Dir['*.gemspec'] + + %w[ + Rakefile + README.markdown + ] + if File.directory?('bin') then + executables = Dir.chdir('bin') { Dir.glob('**/*').select { |f| File.executable?(f) } } + s.executables = executables unless executables.empty? + end + + s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") + s.rubygems_version = "1.3.1" + s.specification_version = 3 + end + 'Rakefile.stop': | + $LOAD_PATH.unshift(File.expand_path('../rake/lib', __FILE__)) + Dir.glob(File.expand_path('../rake/tasks/**/*.{rake,task,rb}', __FILE__)) do |task_file| + begin + import task_file + rescue LoadError => e + warn "Failed to load task file #{task_file}" + warn " #{e.class} #{e.message}" + warn " #{e.backtrace.first}" + end + end + 'README_DIRECTORIES.stop': | + This readme informs you about the purpose of the directories + + PROJECT/bin: Executable files + PROJECT/documentation: Prosa documentation of your project + PROJECT/development: Ideas and other things relevant for developing + PROJECT/lib: Your ruby library files + PROJECT/rake/lib: Libraries that are not part of your library, but used by your rake tasks + PROJECT/rake/tasks: Your rake tasks, using either .rb, .task or .rake as suffix + PROJECT/test: The tests for your library + 'README.markdown.stop.erb': | + README + ====== + + + Summary + ------- + <%= summary %> + + + Installation + ------------ + `gem install <%= gem_name %>` + + + Usage + ----- + + + Description + ----------- + <%= description %> + 'test': {} diff --git a/lib/.gitkeep b/lib/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/directory_template.rb b/lib/directory_template.rb new file mode 100644 index 0000000..ad29d0b --- /dev/null +++ b/lib/directory_template.rb @@ -0,0 +1,278 @@ +# encoding: utf-8 + + + +require 'fileutils' +require 'directory_template/process_data' +require 'directory_template/processor' +require 'directory_template/version' + + + +# @version: 1.0.0 +# +# DirectoryTemplate +# Create directory structures from template directory structures or template data. +# +# Preregistered processors +# * '*.stop': Stops the preprocessing chain, it's advised to add that to all files for +# future-proofness. +class DirectoryTemplate + # All registered processors + Processors = [ + Processor.new('*.stop', 'Terminate processing queue', 'After .stop, no processor will be run anymore') { |data| data.chomp_suffix!; throw :stop_processing } + ] + + # The standard processor for file- and directory-paths. It simply uses String#% style + # keyword replacement. I.e., "%\{key}" is replaced by the variable value passed with :key. + StandardPathProcessor = proc { |data| + data.path = data.path % data.path_variables if data.path_variables + } + + # The default options used by DirectoryTemplate + DefaultOptions = { + :verbose => false, + :silent => false, + :out => $stdout, + :processors => Processors, + :path_processor => StandardPathProcessor, + :meta => {}, + } + + # You can register custom processors for templates. They're triggered based on the + # pattern. + # A processor can change the ProcessData struct passed to it, which will be reflected + # when creating the file or directory + # + # @param [DirectoryTemplate::Processor] processor + # The processor to register + # + def self.register(processor) + Processors << processor + end + + # Create a DirectoryTemplate from an existing directory structure. + def self.directory(template_path, options={}) + data = Dir.chdir(template_path) { + paths = Dir['**/{*,.*}'] + paths -= paths.grep(/(?:^|\/)\.\.?$/) + directories, files = paths.sort.partition { |path| File.directory?(path) } + filemap = Hash[files.map { |path| [path, File.read(path)] }] + + {:directories => directories, :files => filemap} + } + + new(data, options) + end + + # @private + # Converts a recursive hash into a suitable data structure for DirectoryTemplate::new + def self.convert_recursive_structure(current, stack=[], dirs=[], files={}) + current.each do |segment, content| + new_stack = stack+[segment] + path = new_stack.join('/') + case content + when String,nil + files[path] = content || '' + when Hash + dirs << path + convert_recursive_structure(content, new_stack, dirs, files) + else + raise "Invalid structure" + end + end + + return dirs, files + end + + # Create a DirectoryTemplate from a YAML file. + # The yaml should just be a recursive hash of strings. Use an empty hash to indicate + # an empty directory. Leaf-strings are considered to be the content of a file. Use nil + # to indicate an empty file. + def self.yaml_file(path, options=nil) + raw = YAML.load_file(path) + dirs, files = convert_recursive_structure(raw) + data = {:directories => dirs, :files => files} + + new(data, options) + end + + # Meta information can be used by processors. There's no requirements on them, except + # that the toplevel container is a hash. + attr_reader :meta + + # @return [Array] All directories of the template + attr_reader :directories + + # @return [Hash] All files of the template and their content. + attr_reader :files + + # @return [Array] The content processors used by this template. + attr_reader :processors + + # @return [#call] The path processor used by this template. + attr_reader :path_processor + + # @return [IO, #puts] The object on which info and debug messages are printed + attr_reader :out + + # @private + # @return [Boolean] Whether the current run is a dry-run or not. + attr_reader :dry_run + + # When true, will not even output info messages + attr_accessor :silent + + # When true, will additionally output debug messages + attr_accessor :verbose + + # Create a new DirectoryTemplate + # + # @param [Hash] data + # A hash with the two keys :directories and :files, where :directories contains an + # Array of all directory names, and :files contains a Hash of all file names and their + # unprocessed content. + # + # @param [Hash, nil] options + # An options hash, @see DirectoryTemplate::DefaultOptions for a list of all available + # options. + # + # @see DirectoryTemplate::directory + # To create a DirectoryTemplate from an existing directory structure. + # @see DirectoryTemplate::from_yaml + # To create a DirectoryTemplate from a description in a YAML file. + def initialize(data, options=nil) + options = options ? DefaultOptions.merge(options) : DefaultOptions.dup + @directories = data[:directories] || [] + @files = data[:files] || [] + @meta = options.delete(:meta) + @verbose = options.delete(:verbose) + @silent = options.delete(:silent) + @out = options.delete(:out) + @processors = options.delete(:processors) + @path_processor = options.delete(:path_processor) + @dry_run = false + raise ArgumentError, "Unknown options: #{options.keys.join(', ')}" unless options.empty? + end + + # Same as #materialize, but doesn't actually do anything, except print the debug and + # info messages. It additionally prints an info message, containing the file content + # of files that would be created. + def dry_run(in_path='.', env={}, &on_collision) + @dry_run = true + materialize(in_path, env, &on_collision) + ensure + @dry_run = false + end + + # Creates all the directories and files from the template in the given path. + # @see #dry_run For a way to see what would happen with materialize + def materialize(in_path='.', env={}, &on_collision) + in_path = File.expand_path(in_path) + create_directory(in_path) { "Creating root '#{in_path}'" } + + Dir.chdir(in_path) do + if @directories.empty? then + info { "No directories to create" } + else + info { "Creating directories" } + @directories.each do |source_dir_path| + target_dir_path = process_path(source_dir_path, env) + create_directory(target_dir_path) { " #{target_dir_path}" } + end + end + + if @files.empty? then + info { "No files to create" } + else + info { "Creating files" } + @files.each do |source_file_path, content| + target_file_path = process_path(source_file_path, env) + data = process_content(target_file_path, content, env) + if File.exist?(data.path) then + if block_given? && yield(data) then + create_file(data.path, data.content) { " #{data.path} (overwrite)" } + else + info { " #{data.path} (exists already)" } + end + else + create_file(data.path, data.content) { " #{data.path} (new)" } + end + end + end + end + + self + end + + # @private + # Preprocesses the given path + def process_path(path, env) + ProcessData.new(self, path, nil, env).tap(&@path_processor).path + end + + # @private + # Preprocesses the given content + def process_content(path, content, env) + data = ProcessData.new(self, path, content, env) + catch(:stop_processing) { + #p :process_content => path, :available => @processors.size, :processors => processors_for(data).tap { |x| x && x.size } + while processor = processor_for(data) + debug { " -> Applying #{processor.name}" } + processor.call(data) + end + } + + data + end + + # @private + # Create the given directory and emit an info message (unless in dry_run mode). + # + # @note The mode param is currently unused. + def create_directory(path, mode=0755, &message) + unless File.exist?(path) then + info(&message) + FileUtils.mkdir_p(path) unless @dry_run + end + end + + # @private + # Create the given file and emit an info message (unless in dry_run mode). + # + # @note The mode param is currently unused. + def create_file(path, content="", mode=0644, &message) + info(&message) + if @dry_run then + info { " Content:\n#{content.gsub(/^/, ' ')}" } + else + File.open(path, 'wb:binary') do |fh| + fh.write(content) + end + end + end + + # @private + # @param [String] path + # The path to extract the processor from. + # + # @return [Processor, nil] + # Returns the processor or nil + def processor_for(data) + @processors.enum_for(:grep, data).first + end + + # @private + # Emit an info string (the return value of the block). Will not be emitted if + # DirectoryTemplate#silent is true + def info + @out.puts yield unless @silent + end + + # @private + # Emit a debug string (the return value of the block). Will only be emitted if + # DirectoryTemplate#debug is true + def debug + @out.puts yield if @verbose + end +end diff --git a/lib/directory_template/blank_slate.rb b/lib/directory_template/blank_slate.rb new file mode 100644 index 0000000..bd21052 --- /dev/null +++ b/lib/directory_template/blank_slate.rb @@ -0,0 +1,134 @@ +# encoding: utf-8 + + + +require 'stringio' + + + +class DirectoryTemplate + + # Description + # =========== + # BlankSlate provides an abstract base class with no predefined + # methods (except for \_\_send__ and \_\_id__). + # BlankSlate is useful as a base class when writing classes that + # depend upon method_missing (e.g. dynamic proxies). + # + # Copyright + # ========= + # 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. + # + # Modified by Stefan Rusterholz (stefan.rusterholz@gmail.com) + class BlankSlate + + # Hide the method named +name+ in the BlankSlate class. Don't + # hide +instance_eval+ or any method beginning with "__". + def self.hide(name) + verbosity = $VERBOSE + stderr = $stderr + $VERBOSE = nil + $stderr = StringIO.new + + methods = instance_methods.map(&:to_sym) + if methods.include?(name.to_sym) and + name !~ /^(__|instance_eval)/ + @hidden_methods ||= {} + @hidden_methods[name.to_sym] = instance_method(name) + undef_method name + end + ensure + $VERBOSE = verbosity + $stderr = stderr + end + + # @return [UnboundMethod] The method that was hidden. + def self.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 self.reveal(name) + hidden_method = find_hidden_method(name) + fail "Don't know how to reveal method '#{name}'" unless hidden_method + define_method(name, hidden_method) + end + + instance_methods.each { |m| hide(m) } + end +end + + + +# Since Ruby is very dynamic, methods added to the ancestors of +# BlankSlate after BlankSlate is defined 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 template_directory_blank_slate_method_added method_added + end + + # Detect method additions to Kernel and remove them in the + # BlankSlate class. + def self.method_added(name) + result = template_directory_blank_slate_method_added(name) + return result if self != ::Kernel + DirectoryTemplate::BlankSlate.hide(name) + result + end +end + +# Same as above, except in Object. +# +class Object + class << self + alias template_directory_blank_slate_method_added method_added + end + + # Detect method additions to Object and remove them in the + # BlankSlate class. + def self.method_added(name) + result = template_directory_blank_slate_method_added(name) + return result if self != Object + DirectoryTemplate::BlankSlate.hide(name) + result + end + + # @private + # See DirectoryTemplate::BlankSlate::find_hidden_method + # This just serves as a stopper/terminator of the lookup chain. + def self.find_hidden_method(name) + nil + 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 template_directory_blank_slate_method_added append_features + + # @private + # Monkey patch to the append_features callback of Module, used to update the BlankSlate. + def append_features(mod) + result = template_directory_blank_slate_method_added(mod) + return result if mod != Object + instance_methods.each do |name| + DirectoryTemplate::BlankSlate.hide(name) + end + result + end +end diff --git a/lib/directory_template/erb_template.rb b/lib/directory_template/erb_template.rb new file mode 100644 index 0000000..40a90b7 --- /dev/null +++ b/lib/directory_template/erb_template.rb @@ -0,0 +1,202 @@ +# encoding: utf-8 + + + +require 'erb' +require 'directory_template/blank_slate' + + + +class DirectoryTemplate + + # = Indexing + # @author: Stefan Rusterholz + # + # = About + # A helper class for ERB, allows constructs like the one in the Synopsis to + # enable simple use of variables/methods in templates. + # + # @example + # tmpl = Templater.new("Hello <%= name %>!") + # tmpl.result(self, :name => 'world') # => 'Hello World!' + # + class ErbTemplate + + # = Indexing + # Author: Stefan Rusterholz + # Contact: contact@apeiros.me + # Version: 0.1.0 + # + # = About + # Similar to OpenStruct, but slightly optimized for create once, use once and + # giving diagnostics on exceptions/missing keys. + # + # = Synopsis + # tmpl = Variables.new(delegator, :variable => "content") { |exception| + # do_something_with(exception) + # } + # + class Variables < BlankSlate + # A proc for &on_error in SilverPlatter::Variables::new or SilverPlatter::Templater#result. + # Raises the error further on. + Raiser = proc { |e| + raise(e) + } + + # A proc for &on_error in SilverPlatter::Variables.new or SilverPlatter::Templater#result. + # Inserts <> in the place where the error + # occurred. + Teller = proc { |e| + "<<#{e.class}: #{e}>>" + } + + # An empty Hash + EmptyHash = {}.freeze + + # Regex to match setter method names + SetterPattern = /=\z/.freeze + + # === Arguments + # * delegate: All method calls and undefined variables are delegated to this object as method call. + # * variables: A hash with variables in it, keys must be Symbols. + # * on_error_name: Instead of a block you can pass the name of an existing handler, e.g. :Raiser or :Teller. + # * &on_error: The block is yielded in case of an exception with the exception as argument + # + def initialize(delegate=nil, variables={}, on_error_name=nil, &on_error) + @delegate = delegate + @table = (@delegate ? Hash.new { |h,k| @delegate.send(k) } : EmptyHash).merge(variables) + if !on_error && on_error_name then + @on_error = self.class.const_get(on_error_name) + else + @on_error = on_error || Raiser + end + end + + # All keys this Variables instance provides, if the include_delegate argument is true and + # the object to delegate to responds to __keys__, then it will add the keys of the delegate. + def __keys__(include_delegate=true) + @table.keys + ((include_delegate && @delegate.respond_to?(:__keys__)) ? @delegate.__keys__ : []) + end + + # Make the binding publicly available + def __binding__ + binding + end + + # See Object#respond_to? + def respond_to?(key) + @table.respond_to?(key) || (@delegate && @delegate.respond_to?(key)) || super + end + + def method_missing(m, *args) # :nodoc: + argn = args.length + if argn.zero? && @table.has_key?(m) then + @table[m] + elsif argn == 1 && m.to_s =~ SetterPattern + @table[m] = args.first + elsif @delegate + @delegate.send(m, *args) + end + rescue => e + @on_error.call(e) + end + + def inspect # :nodoc: + sprintf "#<%s:0x%08x @delegate=%s %s>", + self.class, + __id__, + @table.map { |k,v| "#{k}=#{v.inspect}" }.join(', '), + @delegate ? "#<%s:0x%08x ...>" % [@delegate.class, @delegate.object_id << 1] : "nil" + end + end + + # Option defaults + Opt = { + :safe_level => nil, + :trim_mode => '%<>', + :eoutvar => '_erbout' + } + + # The instance_eval method + InstanceEvaler = Object.instance_method(:instance_eval) + + + # A proc for &on_error in SilverPlatter::Variables::new or SilverPlatter::Templater#result. + # Raises the error further on. + Raiser = proc { |e| + raise + } + + # A proc for &on_error in SilverPlatter::Variables.new or SilverPlatter::Templater#result. + # Inserts <> in the place where the error + # occurred. + Teller = proc { |e| + "<<#{e.class}: #{e}>>" + } + + # The template string + attr_reader :string + + # Like Templater.new, but instead of a template string, the path to the file + # containing the template. Sets :filename. + def self.file(path, opt=nil) + new(File.read(path), (opt || {}).merge(:filename => path)) + end + + # A convenience method, which evaluates the templates with the given variables and + # returns the result. + def self.replace(template, variables, &on_error) + new(template).result(nil, variables, &on_error) + end + + # ==== Arguments + # * string: The template string, it becomes frozen + # * opt: Option hash, keys: + # * :filename: The filename used for the evaluation (useful for error messages) + # * :safe_level: see ERB.new + # * :trim_mode: see ERB.new + # * :eoutvar: see ERB.new + def initialize(string, opt={}) + opt, string = string, nil if string.kind_of?(Hash) + opt = Opt.merge(opt) + file = opt.delete(:filename) + @string = string.freeze + @erb = ERB.new(@string, *opt.values_at(:safe_level, :trim_mode, :eoutvar)) + @erb.filename = file if file + end + + # See Templater::Variables.new + # Returns the evaluated template. Default &on_error is the Templater::Raiser + # proc. + def result(delegate=nil, variables={}, on_error_name=nil, &on_error) + variables ||= {} + on_error ||= Raiser + variables = Variables.new(delegate, variables, on_error_name, &on_error) + @erb.result(variables.__binding__) + rescue NameError => e + raise NameError, e.message+" for #{self.inspect} with #{variables.inspect}", e.backtrace + end + + # See Templater::Variables.new + # Returns the evaluated template. Default &on_error is the Templater::Raiser + # proc. + def result_with(opt, &block) + opt = opt.dup + variables = opt.delete(:variables) || {} + delegate = opt.delete(:delegate) + on_error = opt.delete(:on_error) || Raiser + on_error_name = opt.delete(:on_error_name) || Raiser + variables = Variables.new(delegate, variables, on_error_name, block, &on_error) + @erb.result(variables.__binding__) + rescue NameError => e + raise NameError, e.message+" for #{self.inspect} with #{variables.inspect}", e.backtrace + end + + def inspect # :nodoc: + sprintf "#<%s:0x%x string=%s>", + self.class, + object_id << 1, + @string.inspect + end + end +end diff --git a/lib/directory_template/process_data.rb b/lib/directory_template/process_data.rb new file mode 100644 index 0000000..8c269e3 --- /dev/null +++ b/lib/directory_template/process_data.rb @@ -0,0 +1,94 @@ +class DirectoryTemplate + + # ProcessData is the value that gets passed to processors. + # The processor must mutate it. + class ProcessData + + # A reference to the DirectoryTemplate of which this file/directory is part of + attr_reader :directory_template + + # The path as it is in the current stage of processing. + attr_reader :path + + # The filename, as it is in the current stage of processing. + attr_reader :filename + + # The directory, as it is in the current stage of processing. + attr_reader :directory + + # The suffix, as it is in the current stage of processing. + attr_reader :suffix + + # The file-content, as it is in the current stage of processing (nil for directories). + attr_accessor :content + + # Variables to be used for path preprocessing + attr_reader :path_variables + + # Variables to be used for filecontent preprocessing + attr_reader :content_variables + + # Variables to be used for both, path- and filecontent preprocessing + attr_reader :variables + + + # A content of nil means this is a directory + # @param [Hash] env + # A hash with additional information, used to parametrize and preprocess the template. + # @options env [Hash] :variables + # Variables used for both, path- and filecontent processing. + # @options env [Hash] :path_variables + # Variables only used for path-processing. + # @options env [Hash] :content_variables + # Variables only used for filecontent processing. + def initialize(directory_template, path, content, env) + @directory_template = directory_template + @content = content + @variables = env[:variables] + @path_variables = @variables.merge(env[:path_variables] || {}) + @content_variables = @variables.merge(env[:content_variables] || {}) + self.path = path + end + + # Whether the processor is suitable for the given ProcessData. + # Simply delegates the job to the Processor. + # + # @see Processor#=== + def ===(processor) + processor === self + end + + # @return [Boolean] + # Whether the item is a file. The alternative is, that it is a directory. + # + # @see #directory? + def file? + !!@content + end + + # @return [Boolean] + # Whether the item is a directory. The alternative is, that it is a file. + # + # @see #file? + def directory? + !@content + end + + # @param [String] value + # The new path + # + # Sets the path, filename, directory and suffix of this item. + def path=(value) + @path = value + @filename = File.basename(value) + @directory = File.dirname(value) + @suffix = File.extname(value) + end + + # Removes the current suffix. E.g. "foo/bar.baz.quuz" would be "foo/bar.baz" after the + # operation. + def chomp_suffix! + self.path = @path.chomp(@suffix) + end + end +end diff --git a/lib/directory_template/processor.rb b/lib/directory_template/processor.rb new file mode 100644 index 0000000..ed71dc1 --- /dev/null +++ b/lib/directory_template/processor.rb @@ -0,0 +1,68 @@ +# encoding: utf-8 + +class DirectoryTemplate + + # The definition of a processor + class Processor + + # The pattern matching proc used to figure whether the processor applies to a + # ProcessData or not. + attr_reader :pattern + + # The source used to create the pattern proc. I.e., the value passed to ::new as the + # pattern parameter. + attr_reader :pattern_source + + # A human identifiable name + attr_reader :name + + # A human understandable description of the processor + attr_reader :description + + # The implementation of the processor. I.e., the block passed to ::new. + attr_reader :execute + + # @param [String] pattern + # A glob-like-pattern, e.g. '*.html.haml' + # + # @param [String] name + # The name of the processor + # + # @param [String] description + # A description, what the processor does + # + # @param [#call] execute + # The implementation of the processor. + def initialize(pattern, name, description=nil, &execute) + @pattern_source = pattern + @pattern = case pattern + when String then proc { |data| File.fnmatch?(pattern, data.path) } + when Regexp then proc { |data| pattern =~ data.path } + when Proc then pattern + else + raise ArgumentError, "Expected a String, Regexp or Proc as pattern, but got #{pattern.class}" + end + @name = name + @description = description + @execute = execute + end + + # Whether the processor is suitable for the given ProcessData + def ===(process_data) + @pattern.call(process_data) + end + + # Apply the processor on a ProcessData instance. + # + # @param [DirectoryTemplate::ProcessData] process_data + # The process data to apply this processor on. + # + # @return [DirectoryTemplate::ProcessData] + # The process_data passed to this method. + def call(process_data) + @execute.call(process_data) + + process_data + end + end +end diff --git a/lib/directory_template/processor/erb.rb b/lib/directory_template/processor/erb.rb new file mode 100644 index 0000000..cbb0f74 --- /dev/null +++ b/lib/directory_template/processor/erb.rb @@ -0,0 +1,18 @@ +# encoding: utf-8 + + + +require 'directory_template/erb_template' + + + +class DirectoryTemplate + class Processor + + # The ERB Processor treats the file-content as ERB template. + Erb = Processor.new('*.erb', 'ERB Template Processor') do |data| + data.content = ErbTemplate.replace(data.content, data.content_variables) + data.chomp_suffix! + end + end +end diff --git a/lib/directory_template/register/erb.rb b/lib/directory_template/register/erb.rb new file mode 100644 index 0000000..eaa5340 --- /dev/null +++ b/lib/directory_template/register/erb.rb @@ -0,0 +1,3 @@ +# This file register the ERB processor globally. +require 'directory_template/processor/erb' +DirectoryTemplate.register DirectoryTemplate::Processor::Erb diff --git a/lib/directory_template/register_all.rb b/lib/directory_template/register_all.rb new file mode 100644 index 0000000..f608fbc --- /dev/null +++ b/lib/directory_template/register_all.rb @@ -0,0 +1,8 @@ +# This file requires all registrators for DirectoryTemplate processors + +require 'directory_template' +$LOAD_PATH.each do |path| + Dir.glob(File.join(path, 'directory_template', 'register', '**', '*.rb')) do |registrator| + require registrator + end +end diff --git a/lib/directory_template/version.rb b/lib/directory_template/version.rb new file mode 100644 index 0000000..2c3ad4d --- /dev/null +++ b/lib/directory_template/version.rb @@ -0,0 +1,13 @@ +# encoding: utf-8 + +begin + require 'rubygems/version' # newer rubygems use this +rescue LoadError + require 'gem/version' # older rubygems use this +end + +class DirectoryTemplate + + # The version of DirectoryTemplate + Version = Gem::Version.new("0.0.1") +end diff --git a/rake/lib/.gitkeep b/rake/lib/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/rake/tasks/.gitkeep b/rake/tasks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/.gitkeep b/test/.gitkeep new file mode 100644 index 0000000..e69de29