class Mayday::UserDefinitions

Public Class Methods

new(mayday_file_path) click to toggle source
# File lib/mayday/user_definitions.rb, line 7
def initialize(mayday_file_path)
  @mayday_file_path = mayday_file_path
end

Public Instance Methods

benchmark() click to toggle source
# File lib/mayday/user_definitions.rb, line 39
def benchmark
  mayday_file do |file|
    Reader.new(file).to_target_integrator.benchmark
  end
end
down() click to toggle source
# File lib/mayday/user_definitions.rb, line 33
def down
  mayday_file do |file|
    Reader.new(file).to_target_integrator.deintegrate
  end
end
init() click to toggle source
# File lib/mayday/user_definitions.rb, line 11
    def init
      if File.exist?(@mayday_file_path)
        puts "#{@mayday_file_path} already exists".red
        abort
      else
        File.open(@mayday_file_path, 'w') do |file|
          file.write <<-CODE
xcode_proj '#{nearby_xcodeproj}'

warning_regex 'TODO:', /\\s+\\/\\/\\s?TODO:/
          CODE
          puts "#{@mayday_file_path} created".green
        end
      end
    end
run() click to toggle source
# File lib/mayday/user_definitions.rb, line 45
def run
  mayday_file do |file|
    Reader.new(file).to_target_integrator.run
  end
end
up() click to toggle source
# File lib/mayday/user_definitions.rb, line 27
def up
  mayday_file do |file|
    Reader.new(file).to_target_integrator.integrate
  end
end

Private Instance Methods

mayday_file() { |file| ... } click to toggle source
# File lib/mayday/user_definitions.rb, line 51
def mayday_file
  unless File.exist?(@mayday_file_path)
    puts "No #{@mayday_file_path} found".red
    abort
  end

  file = File.open(@mayday_file_path)
  yield file
  file.close
end
nearby_xcodeproj() click to toggle source
# File lib/mayday/user_definitions.rb, line 63
def nearby_xcodeproj
  nearby = Dir["**/*.xcodeproj"].reject { |xcodeproj_path| xcodeproj_path =~ /Pods\//}.first
  puts "Xcodeproj couldn't be found".yellow unless nearby
  nearby
end