Class: Appjam::Generators::Jam

Inherits:
Thor::Group
  • Object
show all
Defined in:
lib/appjam/generators/jam.rb

Direct Known Subclasses

Blank, Gist, Help, Lib, MvcModel, MvcProject, Search

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.stableObject (readonly)

The methods below define the JAM DSL.



64
65
66
# File 'lib/appjam/generators/jam.rb', line 64

def stable
  @stable
end

.unstableObject (readonly)

The methods below define the JAM DSL.



64
65
66
# File 'lib/appjam/generators/jam.rb', line 64

def unstable
  @unstable
end

Class Method Details

.attr_rw(*attrs) ⇒ Object



66
67
68
69
70
71
72
73
74
# File 'lib/appjam/generators/jam.rb', line 66

def self.attr_rw(*attrs)
  attrs.each do |attr|
    class_eval %Q{
      def #{attr}(val=nil)
        val.nil? ? @#{attr} : @#{attr} = val
      end
    }
  end
end


18
# File 'lib/appjam/generators/jam.rb', line 18

def self.banner; "appjam #{self.to_s.downcase.intern} [name]"; end

.init_generatorObject



15
16
17
18
19
20
21
22
23
# File 'lib/appjam/generators/jam.rb', line 15

def self.init_generator
  # Define the source template root
  def self.source_root; File.expand_path(File.dirname(__FILE__)); end
  def self.banner; "appjam #{self.to_s.downcase.intern} [name]"; end

  # Include related modules
  include Thor::Actions
  include Appjam::Generators::Actions 
end

.parseTemplate(data) ⇒ Object



25
26
27
# File 'lib/appjam/generators/jam.rb', line 25

def self.parseTemplate(data)
  eval(data)
end

.source_rootObject

Define the source template root



17
# File 'lib/appjam/generators/jam.rb', line 17

def self.source_root; File.expand_path(File.dirname(__FILE__)); end

Instance Method Details

#create_jamObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/appjam/generators/jam.rb', line 41

def create_jam
  valid_constant?(options["#{self.to_s.downcase.intern}"] || name)
  @jam_name = (options["#{self.to_s.downcase.intern}"] || name).gsub(/\W/, "_").downcase
  @developer = "#{`whoami`.strip}"
  @created_on = Date.today.to_s
  self.destination_root = options[:root]
  project = options["#{self.to_s.downcase.intern}"]
  self.behavior = :revoke if options[:destroy]
  
  #empty_directory "#{@jam_name}"
  
#   View.render(options)
#   say (<<-TEXT).gsub(/ {10}/,'')
# 
# =================================================================
# Your #{@jam_name} has been generated.
# =================================================================
# 
# TEXT
end

#in_app_root?Boolean

Returns:

  • (Boolean)


36
37
38
39
# File 'lib/appjam/generators/jam.rb', line 36

def in_app_root?
  # File.exist?('Classes')
  Dir.glob("*.xcodeproj").count >= 1
end