Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
apeiros committed Apr 28, 2012
0 parents commit d601f08
Show file tree
Hide file tree
Showing 60 changed files with 10,229 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
/tmp/
9 changes: 9 additions & 0 deletions .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
Binary file added .yardoc/objects/root.dat
Binary file not shown.
Binary file added .yardoc/proxy_types
Binary file not shown.
52 changes: 52 additions & 0 deletions README.markdown
@@ -0,0 +1,52 @@
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.
10 changes: 10 additions & 0 deletions Rakefile
@@ -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
Empty file added development/.gitkeep
Empty file.
12 changes: 12 additions & 0 deletions 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
38 changes: 38 additions & 0 deletions 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

0 comments on commit d601f08

Please sign in to comment.