module SitemapMaker::Utils
Constants
- DEFAULT_LEVEL
Public Class Methods
option_parser(args)
click to toggle source
# File lib/SitemapMaker/utils.rb, line 6 def option_parser args args << '-h' if args.empty? options = {} optparse = OptionParser.new do |opts| opts.banner = get_banner.gsub(/^\s*/, '') opts.on('-h','--help','HELP') do puts opts exit end opts.on('-l', '--deep_level VAL', 'deep_level') do |l| options[:level] = l options[:level] ||= SitemapMaker::Utils::DEFAULT_LEVEL end opts.on('-f VAL', '--filepath VAL', 'output path') do |l| options[:path] = l end opts.on('-t VAL', '--target VAL', 'target url') do |l| options[:target] = l end opts.on('-v', '--version', 'Version') do puts SitemapMaker::VERSION exit end end optparse.parse! args options[:files] = args.to_a { level: options[:level], path: options[:path], target: options[:target], } end
run(cmd, path, uncomplete="")
click to toggle source
# File lib/SitemapMaker/utils.rb, line 59 def run cmd, path, uncomplete="" case cmd when "locale" puts SitemapMaker::LocaleComplete.complete path, uncomplete end end