Class: Xcadaptor::Adapt

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/xcadaptor/adapt.rb

Instance Method Summary collapse

Instance Method Details

#ios(version) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/xcadaptor/adapt.rb', line 19

def ios(version)
  sub_command_file_path =  File.expand_path "#{File.dirname(__FILE__)}/IOS/#{version}"
  begin
    if require_all(sub_command_file_path)
      function_types = options[:category] 
      if function_types 
        #excute specified cateoty update
        function_types.each do |function_type|
          if File.exist? "#{sub_command_file_path}/#{function_type}.rb" 
            run_category function_type 
          else
            puts "#{function_type} not found\n"
          end
        end

      else 
        
        #excute all category update
        Dir.glob("#{sub_command_file_path}/*.rb").each do |f_path|
          pn = Pathname.new f_path
          file_name = pn.basename(".*").to_s
          run_category file_name 
        end

      end

    else 
      puts "ios version not found."
    end
  rescue => e 
    puts e
  end 
end