Sha256: 13b95d0ca8ca068bf0eb31d37ea589438bd63298933a5942ad56f54ac5842f16
Contents?: true
Size: 1.4 KB
Versions: 4
Compression:
Stored size: 1.4 KB
Contents
require 'find' class HoboRapidGenerator < Hobo::Generator default_options :import_tags => false def manifest if options[:command] == :create import_tags if options[:import_tags] end record do |m| m.file "hobo-rapid.js", "public/javascripts/hobo-rapid.js" m.file "lowpro.js", "public/javascripts/lowpro.js" m.file "reset.css", "public/stylesheets/reset.css" m.file "hobo-rapid.css", "public/stylesheets/hobo-rapid.css" create_all(m, "themes/clean/public", "public/hobothemes/clean") create_all(m, "themes/clean/views", "app/views/taglibs/themes/clean") end end def import_tags path = File.join(RAILS_ROOT, "app/views/taglibs/application.dryml") tag = "<include src=\"rapid\" plugin=\"hobo\"/>\n\n<set-theme name=\"clean\"/>\n" src = File.read(path) return if src.include?(tag) # first try putting it before the first tag done = src.sub!(/<(?!!)/, tag + "\n<") # otherwise append it src << tag unless done File.open(path, 'w') {|f| f.write(src) } end protected def banner "Usage: #{$0} #{spec.name} [--import-tags]" end def add_options!(opt) opt.separator '' opt.separator 'Options:' opt.on("--import-tags", "Modify taglibs/application.dryml to import hobo-rapid and theme tags ") do |v| options[:import_tags] = true end end end
Version data entries
4 entries across 4 versions & 1 rubygems