Sha256: 2e09a237f13b74e30ad8fc2abc513e0c51f88a24f84bee612a0e7e768d04c249
Contents?: true
Size: 1.79 KB
Versions: 2
Compression:
Stored size: 1.79 KB
Contents
require 'optparse' class InstallTheme class CLI def self.execute(stdout, arguments=[]) options = {} options[:template_root] = arguments.shift options[:rails_root] = arguments.shift options[:content_id] = arguments.shift parser = OptionParser.new do |opts| opts.banner = <<-BANNER.gsub(/^ /,'') Use any HTML template as a theme generator for your Rails app. Usage: #{File.basename($0)} path/to/template path/to/rails_app content_id [options] Options are: BANNER opts.separator "" opts.on("--erb", "Generate ERb templates.", "Default: auto-detect") { |arg| options[:template_type] = 'erb' } opts.on("--haml", "Generate HAML templates.", "Default: auto-detect") { |arg| options[:template_type] = 'haml' } opts.on("--index_path index.html", String, "HTML page to use for application layout.", "Default: index.html") { |arg| options[:index_path] = arg } opts.on("--inside_yield KEY_AND_CSS_PATH", String, "Replace the inner HTML of an element with <%= yield :key %>", "Example: --inside_yield header:#header", "Default: nil") do |arg| options[:inside_yields] ||= {} key, css_path = arg.split(/\s*:\s*/)[0..1] options[:inside_yields][key.strip.to_sym] = css_path.strip end opts.on("-h", "--help", "Show this help message.") { stdout.puts opts; exit } opts.parse!(arguments) end unless options[:template_root] && options[:rails_root] stdout.puts parser; exit end InstallTheme.new(options).apply_to_target end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
install_theme-0.5.2 | lib/install_theme/cli.rb |
install_theme-0.5.1 | lib/install_theme/cli.rb |