Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
249 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,49 @@ | ||
PATH | ||
remote: /home/guten/dev/one/optimism | ||
specs: | ||
optimism (3.1.2) | ||
hike (~> 1.2.0) | ||
|
||
GEM | ||
remote: http://rubygems.org/ | ||
remote: http://ruby.taobao.org/ | ||
specs: | ||
activesupport (3.1.3) | ||
activesupport (3.1.4) | ||
multi_json (~> 1.0) | ||
awesome_print (1.0.2) | ||
diff-lcs (1.1.3) | ||
hike (1.2.1) | ||
multi_json (1.0.4) | ||
optimism (3.1.0) | ||
hike (~> 1.2.0) | ||
pa (1.2.1) | ||
rspec (2.8.0) | ||
rspec-core (~> 2.8.0) | ||
rspec-expectations (~> 2.8.0) | ||
rspec-mocks (~> 2.8.0) | ||
rspec-core (2.8.0) | ||
rspec-expectations (2.8.0) | ||
diff-lcs (~> 1.1.2) | ||
rspec-mocks (2.8.0) | ||
tagen (1.1.4) | ||
i18n (0.6.0) | ||
multi_json (1.2.0) | ||
pa (1.2.3) | ||
pd (1.0.5) | ||
awesome_print | ||
rspec (2.9.0) | ||
rspec-core (~> 2.9.0) | ||
rspec-expectations (~> 2.9.0) | ||
rspec-mocks (~> 2.9.0) | ||
rspec-core (2.9.0) | ||
rspec-expectations (2.9.1) | ||
diff-lcs (~> 1.1.3) | ||
rspec-mocks (2.9.0) | ||
tagen (1.1.7) | ||
activesupport (~> 3.1.0) | ||
i18n | ||
pd | ||
thor (0.14.6) | ||
tilt (1.3.3) | ||
watchr (0.7) | ||
yard (0.7.5) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
optimism (~> 3.1.0) | ||
optimism! | ||
pa (~> 1.2.0) | ||
pd | ||
rspec | ||
tagen (~> 1.1.0) | ||
thor | ||
tilt | ||
watchr | ||
yard |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
class Thor | ||
module Actions | ||
def directory2(source, *args, &block) | ||
config = args.last.is_a?(Hash) ? args.pop : {} | ||
destination = args.first || source | ||
action Directory2.new(self, source, destination || source, config, &block) | ||
end | ||
|
||
# use tilt | ||
# :scope => nil | ||
# :locals => {} | ||
# &block is for yield. | ||
def template2(source, *args, &block) | ||
config = args.last.is_a?(Hash) ? args.pop : {} | ||
destination = args.first || source.sub(/\.tt$/, '') | ||
template_options = {source_root: self.class.source_root} | ||
|
||
source = File.expand_path(find_in_source_paths(source.to_s)) | ||
|
||
create_file destination, nil, config do | ||
Rag::Template.render(source, template_options, &block) | ||
end | ||
end | ||
|
||
class Directory2 < Directory #:nodoc: | ||
protected | ||
def execute! | ||
lookup = config[:recursive] ? File.join(source, '**') : source | ||
lookup = File.join(lookup, '{*,.[a-z]*}') | ||
|
||
Dir[lookup].sort.each do |file_source| | ||
next if File.directory?(file_source) | ||
file_destination = File.join(given_destination, file_source.gsub(source, '.')) | ||
file_destination.gsub!('/./', '/') | ||
|
||
case file_source | ||
when /\.empty_directory$/ | ||
dirname = File.dirname(file_destination).gsub(/\/\.$/, '') | ||
next if dirname == given_destination | ||
base.empty_directory(dirname, config) | ||
when /\.tt$/ | ||
destination = base.template2(file_source, file_destination[0..-4], config, &@block) | ||
else | ||
destination = base.copy_file(file_source, file_destination, config, &@block) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class Rag | ||
chainable = Module.new do | ||
def initialize(*) | ||
super | ||
|
||
# generate Rc.o | ||
o = Rc.o = Optimism.new | ||
if gemspec_file=Dir["*.gemspec"][0] | ||
gemspec = Gem::Specification.load(gemspec_file) | ||
o.project = gemspec.name | ||
o.version = gemspec.version | ||
end | ||
end | ||
end | ||
|
||
include chainable | ||
end | ||
|
||
require "rag/ruby/gem" | ||
require "rag/ruby/test" | ||
require "rag/ruby/doc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
directory2 "template", "hello" | ||
|
||
# vim: ft=ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%=project%> |
Oops, something went wrong.