Class: Puer::Generators::Xib

Inherits:
Jam
  • Object
show all
Includes:
CLIColorize, Actions, Thor::Actions
Defined in:
lib/puer/generators/xib.rb

Constant Summary collapse

RENDER_OPTIONS =
{ :fields => [:category,:command,:description] }

Class Method Summary collapse

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, 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, init_generator, parseTemplate

Class Method Details



27
# File 'lib/puer/generators/xib.rb', line 27

def self.banner; "puer xib "; end

.source_rootObject

Define the source root



26
# File 'lib/puer/generators/xib.rb', line 26

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

Instance Method Details

#create_xibObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/puer/generators/xib.rb', line 42

def create_xib
  Dir.glob(File.join('**','*.xib')).each do |s| 
      puts "#{s} is converted to #{File.basename(s, '.*')}.js "
      #system "puer #{s} -o #{File.basename(s, '.*')}.js" 

      $config.parse_file s
      if $config.has_errors?
        puts "Aborted!"
        puts $config.full_log [:error]
      else  
        severities = []
        #severities.unshift :warning if @show_warnings
        log = $config.full_log severities
        script = js_comments_for(log) + js_for($config.out)
        @output_file = "#{File.basename(s, '.*')}.js"
        File.open(@output_file, 'w') do |file|
          file.write script
        end
        #puts log
      end
  end       
  puts     
end

#in_app_root?Boolean

Returns:

  • (Boolean)


37
38
39
40
# File 'lib/puer/generators/xib.rb', line 37

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