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
# directory structure of /ruby | |
$ tree -L 1 /ruby | |
/ruby | |
|-- default -> ree-1.8.7 | |
|-- ree-1.8.7 | |
`-- ruby-1.9.1-p376 | |
3 directories, 0 files |
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
require 'mustache' | |
require 'yaml' | |
class Sep < Mustache | |
def last? | |
self[:to_s] == self[:names].last.to_s | |
end | |
end | |
template = <<template |
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
#!/usr/bin/env ruby | |
# Usage: rip-readme package | |
# | |
# Prints the contents of the installed package's README. | |
require 'rip/script' | |
target = ARGV[0] | |
rip(:installed).each do |package_path| | |
package_path = package_path.chomp |
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
$ rip-env -c resque | |
$ rip-install resque | |
installed redis (1.0.7) | |
installed redis-namespace (0.4.2) | |
installed sinatra (0.9.2) | |
installed vegas (0.1.2) | |
installed resque (1.8.2) | |
$ rake | |
-bash: rake: command not found | |
$ rip-list |
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
#!/bin/sh -e | |
# Usage: rip-rg | |
# Drops a rubygems.rb into the current ripenv | |
touch "$RIPDIR/$(rip-env)/lib/rubygems.rb" |
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
#!/usr/bin/env ruby | |
# Usage: rip-gemfile Gemfile | |
# | |
# Given a Gemfile, prints content that can be used as a deps.rip | |
# to standard out. | |
# | |
# If you want to work with Gemfile.lock check out josh's rip-bundle: | |
# http://github.com/josh/rip-bundle | |
module Gemfile |
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
#!/usr/bin/env ruby | |
# Usage: rip-dependency-tree deps.rip | |
require 'rip' | |
packages = Rip::Parser.parse(ARGF.read, ARGF.path) | |
puts ARGF.filename | |
def print_package(package, last=false, prefix='') | |
print prefix |
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
diff --git a/lib/mustache/generator.rb b/lib/mustache/generator.rb | |
index 5e8c067..8943903 100644 | |
--- a/lib/mustache/generator.rb | |
+++ b/lib/mustache/generator.rb | |
@@ -128,6 +128,17 @@ class Mustache | |
compiled | |
end | |
+ def on_question_section(name, content) | |
+ code = compile(content) |
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
require 'mustache' | |
module ExistentialMethodMissing | |
def method_missing(method, *args) | |
return super unless method.to_s =~ /\?$/ | |
val = send(method.to_s.chomp('?')) | |
val.respond_to?(:empty?) ? !val.empty? : !!val | |
end | |
def respond_to?(method) |
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
class MyView < Mustache | |
def markdown(str = nil) | |
if str | |
Markdown.new(str.to_s).to_html | |
else | |
lambda { |text| markdown(render(text)) } | |
end | |
end | |
end |