puer 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
 - data/bin/puer +2 -54
 - data/lib/puer.rb +64 -0
 - data/lib/puer/command.rb +27 -0
 - data/lib/puer/config.rb +12 -7
 - data/lib/puer/generators/actions.rb +183 -0
 - data/lib/puer/generators/cli.rb +70 -0
 - data/lib/puer/generators/controller.rb +66 -0
 - data/lib/puer/generators/gist.rb +247 -0
 - data/lib/puer/generators/gist.yml +43 -0
 - data/lib/puer/generators/help.rb +82 -0
 - data/lib/puer/generators/jam.rb +80 -0
 - data/lib/puer/generators/model.rb +65 -0
 - data/lib/puer/generators/search.rb +94 -0
 - data/lib/puer/generators/templates/controller.tt +9 -0
 - data/lib/puer/generators/templates/model.tt +13 -0
 - data/lib/puer/generators/templates/view.tt +12 -0
 - data/lib/puer/generators/xib.rb +69 -0
 - data/lib/puer/session.rb +28 -17
 - data/lib/puer/tasks.rb +22 -0
 - data/lib/puer/tasks/plugin.rb +73 -0
 - data/lib/puer/utility.rb +30 -0
 - data/lib/puer/version.rb +9 -0
 - data/lib/puer/view.rb +48 -0
 - metadata +22 -3
 
| 
         @@ -0,0 +1,66 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'cli-colorize'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'hirb'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../view'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/jam'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            module Puer
         
     | 
| 
      
 8 
     | 
    
         
            +
              module Generators
         
     | 
| 
      
 9 
     | 
    
         
            +
                class Controller < Jam
         
     | 
| 
      
 10 
     | 
    
         
            +
                  include CLIColorize
         
     | 
| 
      
 11 
     | 
    
         
            +
                  
         
     | 
| 
      
 12 
     | 
    
         
            +
                  CLIColorize.default_color = :red
         
     | 
| 
      
 13 
     | 
    
         
            +
                  author 'Eiffel Qiu'
         
     | 
| 
      
 14 
     | 
    
         
            +
                  homepage 'http://www.likenote.com'
         
     | 
| 
      
 15 
     | 
    
         
            +
                  email 'eiffelqiu@gmail.com'
         
     | 
| 
      
 16 
     | 
    
         
            +
                  version Puer::Version::STRING   
         
     | 
| 
      
 17 
     | 
    
         
            +
                  
         
     | 
| 
      
 18 
     | 
    
         
            +
                  # Add this generator to our appjam
         
     | 
| 
      
 19 
     | 
    
         
            +
                  Puer::Generators.add_generator(:controller, self)
         
     | 
| 
      
 20 
     | 
    
         
            +
              
         
     | 
| 
      
 21 
     | 
    
         
            +
                  init_generator      
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  desc "Description:\n\n\tpuer will generates an new Controller for titanium"
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  argument :name, :desc => "The name of your titanium controller"
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
         
     | 
| 
      
 28 
     | 
    
         
            +
                  class_option :destroy, :aliases => '-d', :default => false,   :type    => :boolean
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  def create_controller
         
     | 
| 
      
 31 
     | 
    
         
            +
                    if in_app_root?
         
     | 
| 
      
 32 
     | 
    
         
            +
                      valid_constant?(options[:model] || name)
         
     | 
| 
      
 33 
     | 
    
         
            +
                      @controller_name = (options[:model] || name).gsub(/\W/, "_").downcase
         
     | 
| 
      
 34 
     | 
    
         
            +
                      @class_name = (options[:model] || name).gsub(/\W/, "_").capitalize
         
     | 
| 
      
 35 
     | 
    
         
            +
                      @developer = "#{`whoami`.strip}"
         
     | 
| 
      
 36 
     | 
    
         
            +
                      @created_on = Date.today.to_s
         
     | 
| 
      
 37 
     | 
    
         
            +
                      self.destination_root = options[:root]
         
     | 
| 
      
 38 
     | 
    
         
            +
                      self.behavior = :revoke if options[:destroy]
         
     | 
| 
      
 39 
     | 
    
         
            +
                      
         
     | 
| 
      
 40 
     | 
    
         
            +
                      puts colorize( "Puer Version: #{Puer::Version::STRING}", { :foreground => :red, :background => :white, :config => :underline } )
         
     | 
| 
      
 41 
     | 
    
         
            +
                      puts          
         
     | 
| 
      
 42 
     | 
    
         
            +
                      eval(File.read(__FILE__) =~ /^__END__\n/ && $' || '')
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                      say (<<-TEXT).gsub(/ {10}/,'')
         
     | 
| 
      
 45 
     | 
    
         
            +
                  
         
     | 
| 
      
 46 
     | 
    
         
            +
                  =================================================================
         
     | 
| 
      
 47 
     | 
    
         
            +
                  Your [#{@controller_name.capitalize}] Controller has been generated.
         
     | 
| 
      
 48 
     | 
    
         
            +
                  Build and Run
         
     | 
| 
      
 49 
     | 
    
         
            +
                  =================================================================
         
     | 
| 
      
 50 
     | 
    
         
            +
                  
         
     | 
| 
      
 51 
     | 
    
         
            +
                    TEXT
         
     | 
| 
      
 52 
     | 
    
         
            +
                    else 
         
     | 
| 
      
 53 
     | 
    
         
            +
                      puts
         
     | 
| 
      
 54 
     | 
    
         
            +
                      puts '-'*70
         
     | 
| 
      
 55 
     | 
    
         
            +
                      puts "You are not in a titanium project folder"
         
     | 
| 
      
 56 
     | 
    
         
            +
                      puts '-'*70
         
     | 
| 
      
 57 
     | 
    
         
            +
                      puts
         
     | 
| 
      
 58 
     | 
    
         
            +
                    end
         
     | 
| 
      
 59 
     | 
    
         
            +
                  end
         
     | 
| 
      
 60 
     | 
    
         
            +
                end # Model
         
     | 
| 
      
 61 
     | 
    
         
            +
              end # Generators
         
     | 
| 
      
 62 
     | 
    
         
            +
            end # Puer
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            __END__
         
     | 
| 
      
 65 
     | 
    
         
            +
            template "templates/controller.tt" , "Resources/controllers/#{@controller_name}.js"
         
     | 
| 
      
 66 
     | 
    
         
            +
            template "templates/view.tt" , "Resources/views/#{@controller_name}.js"
         
     | 
| 
         @@ -0,0 +1,247 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'fileutils'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'net/http'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'net/https'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'uri'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require "open-uri"
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'tempfile'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'cli-colorize'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'hirb'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../view'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/jam'
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            class String
         
     | 
| 
      
 14 
     | 
    
         
            +
              def is_numeric?
         
     | 
| 
      
 15 
     | 
    
         
            +
                Float(self)
         
     | 
| 
      
 16 
     | 
    
         
            +
                true 
         
     | 
| 
      
 17 
     | 
    
         
            +
              rescue 
         
     | 
| 
      
 18 
     | 
    
         
            +
                false
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            module Puer
         
     | 
| 
      
 23 
     | 
    
         
            +
              module Generators
         
     | 
| 
      
 24 
     | 
    
         
            +
                class Gist < Jam
         
     | 
| 
      
 25 
     | 
    
         
            +
                  include CLIColorize
         
     | 
| 
      
 26 
     | 
    
         
            +
                  
         
     | 
| 
      
 27 
     | 
    
         
            +
                  CLIColorize.default_color = :red
         
     | 
| 
      
 28 
     | 
    
         
            +
                  class << self
         
     | 
| 
      
 29 
     | 
    
         
            +
                    def self.attr_rw(*attrs)
         
     | 
| 
      
 30 
     | 
    
         
            +
                      attrs.each do |attr|
         
     | 
| 
      
 31 
     | 
    
         
            +
                        class_eval %Q{
         
     | 
| 
      
 32 
     | 
    
         
            +
                          def #{attr}(val=nil)
         
     | 
| 
      
 33 
     | 
    
         
            +
                            val.nil? ? @#{attr} : @#{attr} = val
         
     | 
| 
      
 34 
     | 
    
         
            +
                          end
         
     | 
| 
      
 35 
     | 
    
         
            +
                        }
         
     | 
| 
      
 36 
     | 
    
         
            +
                      end
         
     | 
| 
      
 37 
     | 
    
         
            +
                    end        
         
     | 
| 
      
 38 
     | 
    
         
            +
                    attr_rw :gist_name, :gist_description, :gist_id, :gist_body   
         
     | 
| 
      
 39 
     | 
    
         
            +
                    def preview_gist(gid)
         
     | 
| 
      
 40 
     | 
    
         
            +
                      uri  = URI("https://gist.github.com/#{gid}.txt")
         
     | 
| 
      
 41 
     | 
    
         
            +
                      http = Net::HTTP.new(uri.host, uri.port)
         
     | 
| 
      
 42 
     | 
    
         
            +
                      if uri.scheme == 'https'
         
     | 
| 
      
 43 
     | 
    
         
            +
                        http.use_ssl     = true
         
     | 
| 
      
 44 
     | 
    
         
            +
                        http.verify_mode = OpenSSL::SSL::VERIFY_NONE
         
     | 
| 
      
 45 
     | 
    
         
            +
                      end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                      result   = http.start {|h| h.request(Net::HTTP::Get.new(uri.path))}
         
     | 
| 
      
 48 
     | 
    
         
            +
                      tempfile = Tempfile.new('gist')
         
     | 
| 
      
 49 
     | 
    
         
            +
                      tempfile.puts(result)
         
     | 
| 
      
 50 
     | 
    
         
            +
                      tempfile.close
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                      if system('which qlmanage')
         
     | 
| 
      
 53 
     | 
    
         
            +
                        system("qlmanage -p #{tempfile.path}/* >& /dev/null")
         
     | 
| 
      
 54 
     | 
    
         
            +
                      end          
         
     | 
| 
      
 55 
     | 
    
         
            +
                    end  
         
     | 
| 
      
 56 
     | 
    
         
            +
                    
         
     | 
| 
      
 57 
     | 
    
         
            +
                    def update_gist
         
     | 
| 
      
 58 
     | 
    
         
            +
                      puer_dir = '~/.puer'
         
     | 
| 
      
 59 
     | 
    
         
            +
                      puer_gist = File.expand_path("~") + '/.puer/gist.yml'
         
     | 
| 
      
 60 
     | 
    
         
            +
                      system "mkdir -p #{puer_dir}" unless File.exist?(puer_dir)
         
     | 
| 
      
 61 
     | 
    
         
            +
                      begin
         
     | 
| 
      
 62 
     | 
    
         
            +
                        puts "fetching new gist list from server ... "
         
     | 
| 
      
 63 
     | 
    
         
            +
                        page_source = Net::HTTP.get(URI.parse("http://eiffelqiu.github.com/puer/gist.yml"))
         
     | 
| 
      
 64 
     | 
    
         
            +
                        File.open(puer_gist, 'w') {|f| f.write(page_source) }
         
     | 
| 
      
 65 
     | 
    
         
            +
                      rescue SocketError => e
         
     | 
| 
      
 66 
     | 
    
         
            +
                        puts "can not access github.com, back to local version gist.yml"
         
     | 
| 
      
 67 
     | 
    
         
            +
                        origin_gist = File.expand_path(File.dirname(__FILE__) + '/gist.yml')
         
     | 
| 
      
 68 
     | 
    
         
            +
                        system "cp #{origin_gist} #{puer_gist}"
         
     | 
| 
      
 69 
     | 
    
         
            +
                      end      
         
     | 
| 
      
 70 
     | 
    
         
            +
                    end
         
     | 
| 
      
 71 
     | 
    
         
            +
                    
         
     | 
| 
      
 72 
     | 
    
         
            +
                    def download_gists(username, page=1)
         
     | 
| 
      
 73 
     | 
    
         
            +
                      puts "-- Downloading page #{page} of gists --"
         
     | 
| 
      
 74 
     | 
    
         
            +
                      url = URI.parse("http://gist.github.com")
         
     | 
| 
      
 75 
     | 
    
         
            +
                      res = Net::HTTP.start(url.host, url.port) do |http|
         
     | 
| 
      
 76 
     | 
    
         
            +
                          response = http.get("/#{username}?page=#{page}")
         
     | 
| 
      
 77 
     | 
    
         
            +
                          if response.code == '200'
         
     | 
| 
      
 78 
     | 
    
         
            +
                            links = get_links(response.body)
         
     | 
| 
      
 79 
     | 
    
         
            +
                            links.each do |link, gist_id|
         
     | 
| 
      
 80 
     | 
    
         
            +
                              puts "git://gist.github.com/#{gist_id}.git"
         
     | 
| 
      
 81 
     | 
    
         
            +
                              if File.directory?("Gist/#{gist_id}")
         
     | 
| 
      
 82 
     | 
    
         
            +
                                `cd Gist/#{gist_id} && git pull ; cd ..`
         
     | 
| 
      
 83 
     | 
    
         
            +
                              else
         
     | 
| 
      
 84 
     | 
    
         
            +
                                `git clone git://gist.github.com/#{gist_id}.git Gist/#{gist_id}`
         
     | 
| 
      
 85 
     | 
    
         
            +
                              end
         
     | 
| 
      
 86 
     | 
    
         
            +
                            end
         
     | 
| 
      
 87 
     | 
    
         
            +
                            download_gists(username, page+1) unless links.empty?
         
     | 
| 
      
 88 
     | 
    
         
            +
                          end
         
     | 
| 
      
 89 
     | 
    
         
            +
                      end
         
     | 
| 
      
 90 
     | 
    
         
            +
                    end     
         
     | 
| 
      
 91 
     | 
    
         
            +
                    
         
     | 
| 
      
 92 
     | 
    
         
            +
                    def download_gist(gist_id,git_category,gist_name,gist_type)
         
     | 
| 
      
 93 
     | 
    
         
            +
                      puts "-- fetching gist [#{gist_name}] --"
         
     | 
| 
      
 94 
     | 
    
         
            +
                      # require 'uri'
         
     | 
| 
      
 95 
     | 
    
         
            +
                      # require 'yajl/http_stream'
         
     | 
| 
      
 96 
     | 
    
         
            +
                      # 
         
     | 
| 
      
 97 
     | 
    
         
            +
                      # uri = URI.parse("http://gist.github.com/api/v1/json/#{gist_id}")
         
     | 
| 
      
 98 
     | 
    
         
            +
                      # Yajl::HttpStream.get(uri, :symbolize_keys => true) do |hash|
         
     | 
| 
      
 99 
     | 
    
         
            +
                      #   
         
     | 
| 
      
 100 
     | 
    
         
            +
                      # end      
         
     | 
| 
      
 101 
     | 
    
         
            +
                      if File.directory?("Gist/#{git_category}/#{gist_name.downcase}")
         
     | 
| 
      
 102 
     | 
    
         
            +
                        `rm -rf Gist/#{git_category}/#{gist_name.downcase}`
         
     | 
| 
      
 103 
     | 
    
         
            +
                      end
         
     | 
| 
      
 104 
     | 
    
         
            +
                      if("#{gist_id}".is_numeric?)
         
     | 
| 
      
 105 
     | 
    
         
            +
                        if system('which git') != nil  
         
     | 
| 
      
 106 
     | 
    
         
            +
                          `git clone git://gist.github.com/#{gist_id}.git Gist/#{git_category}/#{gist_name.downcase} && rm -rf Gist/#{git_category}/#{gist_name.downcase}/.git`
         
     | 
| 
      
 107 
     | 
    
         
            +
                        else
         
     | 
| 
      
 108 
     | 
    
         
            +
                          say "="*70
         
     | 
| 
      
 109 
     | 
    
         
            +
                          say "Git was not installed!! check http://git-scm.com/ for installation."
         
     | 
| 
      
 110 
     | 
    
         
            +
                          say "="*70              
         
     | 
| 
      
 111 
     | 
    
         
            +
                        end
         
     | 
| 
      
 112 
     | 
    
         
            +
                      else
         
     | 
| 
      
 113 
     | 
    
         
            +
                        if "#{gist_type}".strip == 'hg'
         
     | 
| 
      
 114 
     | 
    
         
            +
                          if system('which hg') != nil
         
     | 
| 
      
 115 
     | 
    
         
            +
                            `hg clone #{gist_id} Gist/#{git_category}/#{gist_name.downcase} && rm -rf Gist/#{git_category}/#{gist_name.downcase}/.hg`
         
     | 
| 
      
 116 
     | 
    
         
            +
                          else
         
     | 
| 
      
 117 
     | 
    
         
            +
                             say "="*70
         
     | 
| 
      
 118 
     | 
    
         
            +
                             say "Mercurial was not installed!! check http://mercurial.selenic.com/ for installation."
         
     | 
| 
      
 119 
     | 
    
         
            +
                             say "="*70              
         
     | 
| 
      
 120 
     | 
    
         
            +
                          end 
         
     | 
| 
      
 121 
     | 
    
         
            +
                        end  
         
     | 
| 
      
 122 
     | 
    
         
            +
                        if "#{gist_type}".strip == 'svn'
         
     | 
| 
      
 123 
     | 
    
         
            +
                          if system('which svn') != nil
         
     | 
| 
      
 124 
     | 
    
         
            +
                            `svn co #{gist_id} Gist/#{git_category}/#{gist_name.downcase} && rm -rf Gist/#{git_category}/#{gist_name.downcase}/.svn`
         
     | 
| 
      
 125 
     | 
    
         
            +
                          else
         
     | 
| 
      
 126 
     | 
    
         
            +
                             say "="*70
         
     | 
| 
      
 127 
     | 
    
         
            +
                             say "Subversion was not installed!! check http://www.open.collab.net/downloads/community/ for installation."
         
     | 
| 
      
 128 
     | 
    
         
            +
                             say "="*70              
         
     | 
| 
      
 129 
     | 
    
         
            +
                          end 
         
     | 
| 
      
 130 
     | 
    
         
            +
                        end 
         
     | 
| 
      
 131 
     | 
    
         
            +
                        if "#{gist_type}".strip == 'git'   
         
     | 
| 
      
 132 
     | 
    
         
            +
                          if system('which git') != nil                  
         
     | 
| 
      
 133 
     | 
    
         
            +
                            `git clone #{gist_id} Gist/#{git_category}/#{gist_name.downcase} && rm -rf Gist/#{git_category}/#{gist_name.downcase}/.git`
         
     | 
| 
      
 134 
     | 
    
         
            +
                          else
         
     | 
| 
      
 135 
     | 
    
         
            +
                            say "="*70
         
     | 
| 
      
 136 
     | 
    
         
            +
                            say "Git was not installed!! check http://git-scm.com/ for installation."
         
     | 
| 
      
 137 
     | 
    
         
            +
                            say "="*70              
         
     | 
| 
      
 138 
     | 
    
         
            +
                          end
         
     | 
| 
      
 139 
     | 
    
         
            +
                        end
         
     | 
| 
      
 140 
     | 
    
         
            +
                      end
         
     | 
| 
      
 141 
     | 
    
         
            +
                      if system('which qlmanage')
         
     | 
| 
      
 142 
     | 
    
         
            +
                        system("qlmanage -p Gist/#{git_category}/#{gist_name.downcase}/* >& /dev/null")
         
     | 
| 
      
 143 
     | 
    
         
            +
                      end
         
     | 
| 
      
 144 
     | 
    
         
            +
                    end                 
         
     | 
| 
      
 145 
     | 
    
         
            +
                  end
         
     | 
| 
      
 146 
     | 
    
         
            +
                  
         
     | 
| 
      
 147 
     | 
    
         
            +
                  # Add this generator to our puer
         
     | 
| 
      
 148 
     | 
    
         
            +
                  Puer::Generators.add_generator(:gist, self)
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
                  # Define the source Gist root
         
     | 
| 
      
 151 
     | 
    
         
            +
                  def self.source_root; File.expand_path(File.dirname(__FILE__)); end
         
     | 
| 
      
 152 
     | 
    
         
            +
                  def self.banner; "puer gist [name]"; end
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                  # Include related modules
         
     | 
| 
      
 155 
     | 
    
         
            +
                  include Thor::Actions
         
     | 
| 
      
 156 
     | 
    
         
            +
                  include Puer::Generators::Actions            
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
                  desc "Description:\n\n\tpuer will generates function snippet for iphone"
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
                  argument :name, :desc => "The name of your function"
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
                  class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
         
     | 
| 
      
 163 
     | 
    
         
            +
                  class_option :destroy, :aliases => '-d', :default => false,   :type    => :boolean
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
                  def in_app_root?
         
     | 
| 
      
 166 
     | 
    
         
            +
                    # File.exist?('Classes')
         
     | 
| 
      
 167 
     | 
    
         
            +
                    Dir.glob("tiapp.xml").count >= 1
         
     | 
| 
      
 168 
     | 
    
         
            +
                  end     
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
                  def create_git  
         
     | 
| 
      
 171 
     | 
    
         
            +
                      valid_constant?(options[:gist] || name)
         
     | 
| 
      
 172 
     | 
    
         
            +
                      @gist_name = (options[:app] || name).gsub(/W/, "_").downcase
         
     | 
| 
      
 173 
     | 
    
         
            +
                      @class_name = (options[:app] || name).gsub(/W/, "_").capitalize   
         
     | 
| 
      
 174 
     | 
    
         
            +
                      @developer = "eiffel"
         
     | 
| 
      
 175 
     | 
    
         
            +
                      @created_on = Date.today.to_s
         
     | 
| 
      
 176 
     | 
    
         
            +
                      self.destination_root = options[:root]
         
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
      
 178 
     | 
    
         
            +
                      puts colorize( "Puer Version: #{Puer::Version::STRING}", { :foreground => :red, :background => :white, :config => :underline } )
         
     | 
| 
      
 179 
     | 
    
         
            +
                      puts
         
     | 
| 
      
 180 
     | 
    
         
            +
                                
         
     | 
| 
      
 181 
     | 
    
         
            +
                      unless @gist_name == 'update'
         
     | 
| 
      
 182 
     | 
    
         
            +
                        if in_app_root? 
         
     | 
| 
      
 183 
     | 
    
         
            +
                          require 'yaml'
         
     | 
| 
      
 184 
     | 
    
         
            +
                          @xcode_project_name = File.basename(Dir.glob('tiapp.xml')[0],'tiapp.xml').downcase
         
     | 
| 
      
 185 
     | 
    
         
            +
                          # begin
         
     | 
| 
      
 186 
     | 
    
         
            +
                          #   page_source = Net::HTTP.get(URI.parse("http://eiffelqiu.github.com/puer/gist.yml"))
         
     | 
| 
      
 187 
     | 
    
         
            +
                          # rescue SocketError => e
         
     | 
| 
      
 188 
     | 
    
         
            +
                          #   puts "can not access github.com, back to local version gist.yml"
         
     | 
| 
      
 189 
     | 
    
         
            +
                          # end   
         
     | 
| 
      
 190 
     | 
    
         
            +
                          gistfile = File.expand_path("~") + '/.puer/gist.yml'
         
     | 
| 
      
 191 
     | 
    
         
            +
                          Gist::update_gist unless File.exist?(gistfile)
         
     | 
| 
      
 192 
     | 
    
         
            +
                          begin 
         
     | 
| 
      
 193 
     | 
    
         
            +
                            puts "fetching new gists ..." 
         
     | 
| 
      
 194 
     | 
    
         
            +
                            g = YAML.load_file(gistfile)  
         
     | 
| 
      
 195 
     | 
    
         
            +
                          rescue ArgumentError => e
         
     | 
| 
      
 196 
     | 
    
         
            +
                            puts "can't fetch new gists, loading local gists ..."
         
     | 
| 
      
 197 
     | 
    
         
            +
                            g = YAML.load_file(File.expand_path(File.dirname(__FILE__) + '/gist.yml'))
         
     | 
| 
      
 198 
     | 
    
         
            +
                          end
         
     | 
| 
      
 199 
     | 
    
         
            +
                          puts "notice: a new version '#{g['info']}' released" if g['info'] and g['info'].strip != "#{Puer::Version::STRING}"
         
     | 
| 
      
 200 
     | 
    
         
            +
                          puts
         
     | 
| 
      
 201 
     | 
    
         
            +
                          g.each_pair {|key,value|
         
     | 
| 
      
 202 
     | 
    
         
            +
                            gcategory = key.downcase
         
     | 
| 
      
 203 
     | 
    
         
            +
                            unless (gcategory == 'lib' or gcategory == 'info')
         
     | 
| 
      
 204 
     | 
    
         
            +
                              
         
     | 
| 
      
 205 
     | 
    
         
            +
                              g[key].each { |k|
         
     | 
| 
      
 206 
     | 
    
         
            +
                                k.each_pair { |k1,v1|
         
     | 
| 
      
 207 
     | 
    
         
            +
                                  if "#{k1}" == @gist_name
         
     | 
| 
      
 208 
     | 
    
         
            +
                                    gid = k[k1][0]['id']
         
     | 
| 
      
 209 
     | 
    
         
            +
                                    gname = k[k1][1]['name']
         
     | 
| 
      
 210 
     | 
    
         
            +
                                    gtype = 'git'
         
     | 
| 
      
 211 
     | 
    
         
            +
                                    if k[k1].length == 4
         
     | 
| 
      
 212 
     | 
    
         
            +
                                      gtype = k[k1][3]['type']
         
     | 
| 
      
 213 
     | 
    
         
            +
                                    end
         
     | 
| 
      
 214 
     | 
    
         
            +
                                    puts "repository type: #{gtype}"
         
     | 
| 
      
 215 
     | 
    
         
            +
                                    Gist::download_gist("#{gid}",gcategory,gname,gtype)
         
     | 
| 
      
 216 
     | 
    
         
            +
                                    eval(File.read(__FILE__) =~ /^__END__/ && $' || '')
         
     | 
| 
      
 217 
     | 
    
         
            +
                                    say "================================================================="
         
     | 
| 
      
 218 
     | 
    
         
            +
                                    say "Your '#{gname.capitalize}' snippet code has been generated."
         
     | 
| 
      
 219 
     | 
    
         
            +
                                    say "Check Gist/#{gcategory}/#{gname}/ for snippet"
         
     | 
| 
      
 220 
     | 
    
         
            +
                                    say "Open #{@xcode_project_name.capitalize}.xcodeproj"
         
     | 
| 
      
 221 
     | 
    
         
            +
                                    say "Add 'Gist/#{gcategory}/#{gname}/' folder to the 'Classes/apps' Group"
         
     | 
| 
      
 222 
     | 
    
         
            +
                                    say "Build and Run"          
         
     | 
| 
      
 223 
     | 
    
         
            +
                                    say "================================================================="              
         
     | 
| 
      
 224 
     | 
    
         
            +
                                  end                  
         
     | 
| 
      
 225 
     | 
    
         
            +
                                }
         
     | 
| 
      
 226 
     | 
    
         
            +
                              }
         
     | 
| 
      
 227 
     | 
    
         
            +
                            end
         
     | 
| 
      
 228 
     | 
    
         
            +
                          }
         
     | 
| 
      
 229 
     | 
    
         
            +
                        else 
         
     | 
| 
      
 230 
     | 
    
         
            +
                          puts
         
     | 
| 
      
 231 
     | 
    
         
            +
                          puts '-'*70
         
     | 
| 
      
 232 
     | 
    
         
            +
                          puts "You are not in an iphone project folder"
         
     | 
| 
      
 233 
     | 
    
         
            +
                          puts '-'*70
         
     | 
| 
      
 234 
     | 
    
         
            +
                          puts
         
     | 
| 
      
 235 
     | 
    
         
            +
                        end            
         
     | 
| 
      
 236 
     | 
    
         
            +
                      else
         
     | 
| 
      
 237 
     | 
    
         
            +
                        Gist::update_gist
         
     | 
| 
      
 238 
     | 
    
         
            +
                      end
         
     | 
| 
      
 239 
     | 
    
         
            +
                  end # create_gist
         
     | 
| 
      
 240 
     | 
    
         
            +
             
     | 
| 
      
 241 
     | 
    
         
            +
                end # Gist
         
     | 
| 
      
 242 
     | 
    
         
            +
              end # Generators
         
     | 
| 
      
 243 
     | 
    
         
            +
            end # Puer
         
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
            __END__
         
     | 
| 
      
 246 
     | 
    
         
            +
            # put your Gist command here
         
     | 
| 
      
 247 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,43 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            info: 0.0.5
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib:
         
     | 
| 
      
 3 
     | 
    
         
            +
            - alloy: 
         
     | 
| 
      
 4 
     | 
    
         
            +
              - id : git://github.com/appcelerator/alloy.git
         
     | 
| 
      
 5 
     | 
    
         
            +
              - name : Alloy
         
     | 
| 
      
 6 
     | 
    
         
            +
              - description : Alloy is an MVC framework for Titanium by Appcelerator
         
     | 
| 
      
 7 
     | 
    
         
            +
            - titanium_modules: 
         
     | 
| 
      
 8 
     | 
    
         
            +
              - id : git://github.com/appcelerator/titanium_modules.git
         
     | 
| 
      
 9 
     | 
    
         
            +
              - name : TitaniumModules
         
     | 
| 
      
 10 
     | 
    
         
            +
              - description : Modules for Appcelerator's Titanium 
         
     | 
| 
      
 11 
     | 
    
         
            +
            - appcelerator_titanium_redux: 
         
     | 
| 
      
 12 
     | 
    
         
            +
              - id : git://github.com/dawsontoth/Appcelerator-Titanium-Redux.git
         
     | 
| 
      
 13 
     | 
    
         
            +
              - name :  AppceleratorTitaniumRedux
         
     | 
| 
      
 14 
     | 
    
         
            +
              - description : Reduces the amount of code you need to write when using Titanium 
         
     | 
| 
      
 15 
     | 
    
         
            +
             
         
     | 
| 
      
 16 
     | 
    
         
            +
            utility: 
         
     | 
| 
      
 17 
     | 
    
         
            +
            - titanium_tools:
         
     | 
| 
      
 18 
     | 
    
         
            +
              - id : git://github.com/krawaller/Titanium-Tools.git
         
     | 
| 
      
 19 
     | 
    
         
            +
              - name : TitaniumTools
         
     | 
| 
      
 20 
     | 
    
         
            +
              - description : A collection of nifty tools for Titanium Mobile 
         
     | 
| 
      
 21 
     | 
    
         
            +
            - titanium_calendar:
         
     | 
| 
      
 22 
     | 
    
         
            +
              - id : git://github.com/stelford/Titanium-Calendar.git
         
     | 
| 
      
 23 
     | 
    
         
            +
              - name : TitaniumCalendar
         
     | 
| 
      
 24 
     | 
    
         
            +
              - description : Providing a Calendar Widget and Event creation for iPhone  
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            app:
         
     | 
| 
      
 27 
     | 
    
         
            +
            - kitchen_sink:
         
     | 
| 
      
 28 
     | 
    
         
            +
              - id : git://github.com/appcelerator/KitchenSink.git
         
     | 
| 
      
 29 
     | 
    
         
            +
              - name : KitchenSink
         
     | 
| 
      
 30 
     | 
    
         
            +
              - description : Titanium Mobile Kitchen Sink Demo 
         
     | 
| 
      
 31 
     | 
    
         
            +
            - kitchen_sink_nook:
         
     | 
| 
      
 32 
     | 
    
         
            +
              - id : git://github.com/appcelerator/KitchenSinkNook.git
         
     | 
| 
      
 33 
     | 
    
         
            +
              - name : KitchenSinkNook
         
     | 
| 
      
 34 
     | 
    
         
            +
              - description : Titanium Mobile Kitchen Sink Nook Demo  
         
     | 
| 
      
 35 
     | 
    
         
            +
            - kitchen_sink_ipad:
         
     | 
| 
      
 36 
     | 
    
         
            +
              - id : git://github.com/appcelerator/KitchenSinkiPad.git
         
     | 
| 
      
 37 
     | 
    
         
            +
              - name : KitchenSinkiPad
         
     | 
| 
      
 38 
     | 
    
         
            +
              - description : Kitchen Sink app for iPad  
         
     | 
| 
      
 39 
     | 
    
         
            +
            - titanium_jasmine:
         
     | 
| 
      
 40 
     | 
    
         
            +
              - id : git://github.com/guilhermechapiewski/titanium-jasmine.git
         
     | 
| 
      
 41 
     | 
    
         
            +
              - name : TitaniumJasmine
         
     | 
| 
      
 42 
     | 
    
         
            +
              - description : provides testing for Appcelerator’s Titanium       
         
     | 
| 
      
 43 
     | 
    
         
            +
                                
         
     | 
| 
         @@ -0,0 +1,82 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'cli-colorize'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'thor/group'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'hirb'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../view'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/jam'
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            module Puer
         
     | 
| 
      
 9 
     | 
    
         
            +
              module Generators
         
     | 
| 
      
 10 
     | 
    
         
            +
                class Help < Jam
         
     | 
| 
      
 11 
     | 
    
         
            +
                  include CLIColorize
         
     | 
| 
      
 12 
     | 
    
         
            +
                  
         
     | 
| 
      
 13 
     | 
    
         
            +
                  CLIColorize.default_color = :red
         
     | 
| 
      
 14 
     | 
    
         
            +
                  RENDER_OPTIONS = { :fields => [:category,:command,:description] }   
         
     | 
| 
      
 15 
     | 
    
         
            +
                        
         
     | 
| 
      
 16 
     | 
    
         
            +
                  # Add this generator to our puer
         
     | 
| 
      
 17 
     | 
    
         
            +
                  Puer::Generators.add_generator(:help, self)
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  # Define the source root
         
     | 
| 
      
 20 
     | 
    
         
            +
                  def self.source_root; File.expand_path(File.dirname(__FILE__)); end
         
     | 
| 
      
 21 
     | 
    
         
            +
                  def self.banner; "puer help"; end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  # Include related modules
         
     | 
| 
      
 24 
     | 
    
         
            +
                  include Thor::Actions
         
     | 
| 
      
 25 
     | 
    
         
            +
                  include Puer::Generators::Actions            
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  desc "Description:\n\n\tpuer help screen" 
         
     | 
| 
      
 28 
     | 
    
         
            +
                  argument :name, :default => ""
         
     | 
| 
      
 29 
     | 
    
         
            +
                  
         
     | 
| 
      
 30 
     | 
    
         
            +
                  def create_help
         
     | 
| 
      
 31 
     | 
    
         
            +
                    @developer = "eiffel"
         
     | 
| 
      
 32 
     | 
    
         
            +
                    @created_on = Date.today.to_s
         
     | 
| 
      
 33 
     | 
    
         
            +
                    puts colorize( "Puer Version: #{Puer::Version::STRING}", { :foreground => :red, :background => :white, :config => :underline } )
         
     | 
| 
      
 34 
     | 
    
         
            +
                    puts
         
     | 
| 
      
 35 
     | 
    
         
            +
                    puts "Puer is a Titanium Starter Project Generate Tool"
         
     | 
| 
      
 36 
     | 
    
         
            +
                    puts  
         
     | 
| 
      
 37 
     | 
    
         
            +
                    require 'yaml'
         
     | 
| 
      
 38 
     | 
    
         
            +
                    gistfile = File.expand_path("~") + '/.puer/gist.yml'
         
     | 
| 
      
 39 
     | 
    
         
            +
                    Gist::update_gist unless File.exist?(gistfile)          
         
     | 
| 
      
 40 
     | 
    
         
            +
                    begin 
         
     | 
| 
      
 41 
     | 
    
         
            +
                      g = YAML.load_file(gistfile)  
         
     | 
| 
      
 42 
     | 
    
         
            +
                    rescue ArgumentError => e
         
     | 
| 
      
 43 
     | 
    
         
            +
                      g = YAML.load_file(File.expand_path(File.dirname(__FILE__) + '/gist.yml'))
         
     | 
| 
      
 44 
     | 
    
         
            +
                    end
         
     | 
| 
      
 45 
     | 
    
         
            +
                    puts "notice: a new version '#{g['info']}' released" if g['info'] and g['info'].strip != "#{Puer::Version::STRING}"
         
     | 
| 
      
 46 
     | 
    
         
            +
                    puts                     
         
     | 
| 
      
 47 
     | 
    
         
            +
                    puts colorize("Generator Options")
         
     | 
| 
      
 48 
     | 
    
         
            +
                    opt = [{ :category => "generator", :command => "puer controller controller_name", :description => "generate controller for titanium"},
         
     | 
| 
      
 49 
     | 
    
         
            +
                           { :category => "generator", :command => "puer model model_name",   :description => "generate model for titanium"},
         
     | 
| 
      
 50 
     | 
    
         
            +
                           { :category => "generator", :command => "puer xib",   :description => "convert xib to js"}
         
     | 
| 
      
 51 
     | 
    
         
            +
                           ] 
         
     | 
| 
      
 52 
     | 
    
         
            +
                    View.render(opt, RENDER_OPTIONS)
         
     | 
| 
      
 53 
     | 
    
         
            +
                    puts                             
         
     | 
| 
      
 54 
     | 
    
         
            +
                    g.each_pair {|key,value|
         
     | 
| 
      
 55 
     | 
    
         
            +
                      gitopt = []   
         
     | 
| 
      
 56 
     | 
    
         
            +
                      gname = key.downcase.gsub('_',' ')
         
     | 
| 
      
 57 
     | 
    
         
            +
                      puts 
         
     | 
| 
      
 58 
     | 
    
         
            +
                      if gname == 'lib'
         
     | 
| 
      
 59 
     | 
    
         
            +
                        puts colorize("Framework Lib")   
         
     | 
| 
      
 60 
     | 
    
         
            +
                      else
         
     | 
| 
      
 61 
     | 
    
         
            +
                        puts colorize("Gist Category [#{gname}]") unless gname == 'info'  
         
     | 
| 
      
 62 
     | 
    
         
            +
                      end 
         
     | 
| 
      
 63 
     | 
    
         
            +
                      unless gname == 'info'       
         
     | 
| 
      
 64 
     | 
    
         
            +
                        g[key].each { |k|
         
     | 
| 
      
 65 
     | 
    
         
            +
                          k.each_pair { |k1,v1|
         
     | 
| 
      
 66 
     | 
    
         
            +
                            if gname == 'lib'
         
     | 
| 
      
 67 
     | 
    
         
            +
                              gitopt << {:category => "#{key.gsub('_',' ')}", :command => "puer lib #{k1}",   :description => "#{k[k1][2]['description']}" }
         
     | 
| 
      
 68 
     | 
    
         
            +
                            else
         
     | 
| 
      
 69 
     | 
    
         
            +
                              gitopt << {:category => "#{key.gsub('_',' ')}", :command => "puer gist #{k1}",   :description => "#{k[k1][2]['description']}" }
         
     | 
| 
      
 70 
     | 
    
         
            +
                            end
         
     | 
| 
      
 71 
     | 
    
         
            +
                          }
         
     | 
| 
      
 72 
     | 
    
         
            +
                        }
         
     | 
| 
      
 73 
     | 
    
         
            +
                      end
         
     | 
| 
      
 74 
     | 
    
         
            +
                      View.render(gitopt, RENDER_OPTIONS) unless gname == 'info' 
         
     | 
| 
      
 75 
     | 
    
         
            +
                    }          
         
     | 
| 
      
 76 
     | 
    
         
            +
                    puts  
         
     | 
| 
      
 77 
     | 
    
         
            +
                  end
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                end # Search
         
     | 
| 
      
 80 
     | 
    
         
            +
              end # Generators
         
     | 
| 
      
 81 
     | 
    
         
            +
            end # Puer
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,80 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'thor'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'hirb'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'thor/group'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'thor/actions'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'active_support/core_ext/string'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'active_support/inflector'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'date' 
         
     | 
| 
      
 8 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/actions'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../view'
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            module Puer
         
     | 
| 
      
 12 
     | 
    
         
            +
              module Generators
         
     | 
| 
      
 13 
     | 
    
         
            +
                class Jam < Thor::Group   
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  def self.init_generator
         
     | 
| 
      
 16 
     | 
    
         
            +
                    # Define the source template root
         
     | 
| 
      
 17 
     | 
    
         
            +
                    def self.source_root; File.expand_path(File.dirname(__FILE__)); end
         
     | 
| 
      
 18 
     | 
    
         
            +
                    def self.banner; "puer #{self.to_s.downcase.intern} [name]"; end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                    # Include related modules
         
     | 
| 
      
 21 
     | 
    
         
            +
                    include Thor::Actions
         
     | 
| 
      
 22 
     | 
    
         
            +
                    include Puer::Generators::Actions 
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end     
         
     | 
| 
      
 24 
     | 
    
         
            +
                  
         
     | 
| 
      
 25 
     | 
    
         
            +
                  def self.parseTemplate(data)
         
     | 
| 
      
 26 
     | 
    
         
            +
                    eval(data)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  desc "Description:\n\n\tthis should not be used, only acts as Parent Class"
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  argument :name, :desc => "The name of your #{self.to_s.downcase.intern}"
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
         
     | 
| 
      
 34 
     | 
    
         
            +
                  class_option :destroy, :aliases => '-d', :default => false,   :type    => :boolean
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                  def in_app_root?
         
     | 
| 
      
 37 
     | 
    
         
            +
                    # File.exist?('Classes')
         
     | 
| 
      
 38 
     | 
    
         
            +
                    Dir.glob("tiapp.xml").count >= 1
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end     
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                  def create_jam
         
     | 
| 
      
 42 
     | 
    
         
            +
                    valid_constant?(options["#{self.to_s.downcase.intern}"] || name)
         
     | 
| 
      
 43 
     | 
    
         
            +
                    @jam_name = (options["#{self.to_s.downcase.intern}"] || name).gsub(/\W/, "_").downcase
         
     | 
| 
      
 44 
     | 
    
         
            +
                    @developer = "#{`whoami`.strip}"
         
     | 
| 
      
 45 
     | 
    
         
            +
                    @created_on = Date.today.to_s
         
     | 
| 
      
 46 
     | 
    
         
            +
                    self.destination_root = options[:root]
         
     | 
| 
      
 47 
     | 
    
         
            +
                    project = options["#{self.to_s.downcase.intern}"]
         
     | 
| 
      
 48 
     | 
    
         
            +
                    self.behavior = :revoke if options[:destroy]
         
     | 
| 
      
 49 
     | 
    
         
            +
                    
         
     | 
| 
      
 50 
     | 
    
         
            +
                    #empty_directory "#{@jam_name}"
         
     | 
| 
      
 51 
     | 
    
         
            +
                    
         
     | 
| 
      
 52 
     | 
    
         
            +
                  #   View.render(options)
         
     | 
| 
      
 53 
     | 
    
         
            +
                  #   say (<<-TEXT).gsub(/ {10}/,'')
         
     | 
| 
      
 54 
     | 
    
         
            +
                  # 
         
     | 
| 
      
 55 
     | 
    
         
            +
                  # =================================================================
         
     | 
| 
      
 56 
     | 
    
         
            +
                  # Your #{@jam_name} has been generated.
         
     | 
| 
      
 57 
     | 
    
         
            +
                  # =================================================================
         
     | 
| 
      
 58 
     | 
    
         
            +
                  # 
         
     | 
| 
      
 59 
     | 
    
         
            +
                  # TEXT
         
     | 
| 
      
 60 
     | 
    
         
            +
                  end
         
     | 
| 
      
 61 
     | 
    
         
            +
                  
         
     | 
| 
      
 62 
     | 
    
         
            +
                  class << self
         
     | 
| 
      
 63 
     | 
    
         
            +
                      # The methods below define the JAM DSL.
         
     | 
| 
      
 64 
     | 
    
         
            +
                      attr_reader :stable, :unstable
         
     | 
| 
      
 65 
     | 
    
         
            +
                      
         
     | 
| 
      
 66 
     | 
    
         
            +
                      def self.attr_rw(*attrs)
         
     | 
| 
      
 67 
     | 
    
         
            +
                        attrs.each do |attr|
         
     | 
| 
      
 68 
     | 
    
         
            +
                          class_eval %Q{
         
     | 
| 
      
 69 
     | 
    
         
            +
                            def #{attr}(val=nil)
         
     | 
| 
      
 70 
     | 
    
         
            +
                              val.nil? ? @#{attr} : @#{attr} = val
         
     | 
| 
      
 71 
     | 
    
         
            +
                            end
         
     | 
| 
      
 72 
     | 
    
         
            +
                          }
         
     | 
| 
      
 73 
     | 
    
         
            +
                        end
         
     | 
| 
      
 74 
     | 
    
         
            +
                      end
         
     | 
| 
      
 75 
     | 
    
         
            +
                      attr_rw :version, :homepage, :author, :email, :data
         
     | 
| 
      
 76 
     | 
    
         
            +
                  end
         
     | 
| 
      
 77 
     | 
    
         
            +
                  
         
     | 
| 
      
 78 
     | 
    
         
            +
                end # Jam
         
     | 
| 
      
 79 
     | 
    
         
            +
              end # Generators
         
     | 
| 
      
 80 
     | 
    
         
            +
            end # Puer
         
     |