Class: Appjam::Generators::Help
- Includes:
- Actions, CLIColorize, Thor::Actions
- Defined in:
- lib/appjam/generators/help.rb
Constant Summary collapse
- RENDER_OPTIONS =
{ :fields => [:category,:command,:description] }
Class Method Summary collapse
- .banner ⇒ Object
-
.source_root ⇒ Object
Define the source root.
Instance Method Summary collapse
Methods included from Actions
#apply_component_for, #ask, #check_app_existence, #destination_root, #execute_component_setup, #fetch_app_name, #fetch_component_choice, #in_app_root?, included, #invalid_fields, #resolve_valid_choice, #retrieve_component_config, #store_component_choice, #store_component_config, #valid_choice?, #valid_constant?, #which
Methods inherited from Jam
attr_rw, #create_jam, #in_app_root?, init_generator, parseTemplate
Class Method Details
.banner ⇒ Object
21 |
# File 'lib/appjam/generators/help.rb', line 21 def self.; "appjam help"; end |
.source_root ⇒ Object
Define the source root
20 |
# File 'lib/appjam/generators/help.rb', line 20 def self.source_root; File.(File.dirname(__FILE__)); end |
Instance Method Details
#create_help ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/appjam/generators/help.rb', line 30 def create_help @developer = "eiffel" @created_on = Date.today.to_s puts colorize( "Appjam Version: #{Appjam::Version::STRING}", { :foreground => :red, :background => :white, :config => :underline } ) puts puts "Appjam is an iOS code repository, including framework, snippet, generators, etc." puts require 'yaml' gistfile = File.("~") + '/.appjam/gist.yml' Gist::update_gist unless File.exist?(gistfile) begin g = YAML.load_file(gistfile) rescue ArgumentError => e g = YAML.load_file(File.(File.dirname(__FILE__) + '/gist.yml')) end puts "notice: a new version '#{g['info']}' released" if g['info'] and g['info'].strip != "#{Appjam::Version::STRING}" puts puts colorize("Generator Options") opt = [ { :category => "generator", :command => "appjam start demo", :description => "generate a starter ARC iOS project with most popular frameworks included"}, { :category => "puremvc", :command => "appjam mvc_project todo", :description => "generate puremvc iOS project"}, { :category => "puremvc", :command => "appjam mvc_model user", :description => "generate puremvc model"} ] View.render(opt, RENDER_OPTIONS) puts g.each_pair {|key,value| gitopt = [] gname = key.downcase.gsub('_',' ') puts if gname == 'lib' puts colorize("Framework Lib") else puts colorize("Gist Category [#{gname}]") unless gname == 'info' end unless gname == 'info' g[key].each { |k| k.each_pair { |k1,v1| if gname == 'lib' gitopt << {:category => "#{key.gsub('_',' ')}", :command => "appjam lib #{k1}", :description => "#{k[k1][2]['description']}" } else gitopt << {:category => "#{key.gsub('_',' ')}", :command => "appjam gist #{k1}", :description => "#{k[k1][2]['description']}" } end } } end View.render(gitopt, RENDER_OPTIONS) unless gname == 'info' } puts end |