Sha256: fc28da22bd92d66fa4ea5465b03e6cddded12ae1bffff61cd8da5081bca66a50
Contents?: true
Size: 1.75 KB
Versions: 4
Compression:
Stored size: 1.75 KB
Contents
require 'optparse' module Jqp class CLI def self.execute(stdout, arguments=[]) # NOTE: the option -p/--path= is given as an example, and should be replaced in your application. options = { :project => '~jq-plugin', :version => '0.0.1' } mandatory_options = %w( ) parser = OptionParser.new do |opts| opts.banner = <<-BANNER.gsub(/^ /,'') jQuery plugin generator to help you kick start your plugin development with the following structure: plugin /src /css /images query.plugin.js /test spec_plugin.js /dist Makefile Rakefile History.txt README.txt Usage: #{File.basename($0)} [options] Options are: BANNER opts.separator "" opts.on("-p", "--project=Name", String, "The project name should be simple eg 'widget'", "And it will be transformed to jquery.widget.js - there is currently no override feature on this naming convention", "Default: ~jq-plugin") { |arg| options[:project] = arg } opts.on("-v", "--version=x.x.x", String, "Default: 0.0.1") { |arg| options[:version] = arg } opts.on("-h", "--help", "Show this help message.") { stdout.puts opts; exit } opts.parse!(arguments) if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? } stdout.puts opts; exit end end JqueryPluginGen::Generator.execute(options) stdout.puts "To update this executable, look in lib/jqp/cli.rb" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
jqueryplugingen-0.1.1 | lib/jqp/cli.rb |
jqueryplugingen-0.1.2 | lib/jqp/cli.rb |
jqueryplugingen-0.1.3 | lib/jqp/cli.rb |
jqueryplugingen-0.1.4 | lib/jqp/cli.rb |