Class: Mayday::UserDefinitions

Inherits:
Object
  • Object
show all
Defined in:
lib/mayday/user_definitions.rb

Instance Method Summary collapse

Constructor Details

#initialize(mayday_file_path) ⇒ UserDefinitions

Returns a new instance of UserDefinitions.



7
8
9
# File 'lib/mayday/user_definitions.rb', line 7

def initialize(mayday_file_path)
  @mayday_file_path = mayday_file_path
end

Instance Method Details

#benchmarkObject



39
40
41
42
43
# File 'lib/mayday/user_definitions.rb', line 39

def benchmark
  mayday_file do |file|
    Reader.new(file).to_target_integrator.benchmark
  end
end

#downObject



33
34
35
36
37
# File 'lib/mayday/user_definitions.rb', line 33

def down
  mayday_file do |file|
    Reader.new(file).to_target_integrator.deintegrate
  end
end

#initObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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

#runObject



45
46
47
48
49
# File 'lib/mayday/user_definitions.rb', line 45

def run
  mayday_file do |file|
    Reader.new(file).to_target_integrator.run
  end
end

#upObject



27
28
29
30
31
# File 'lib/mayday/user_definitions.rb', line 27

def up
  mayday_file do |file|
    Reader.new(file).to_target_integrator.integrate
  end
end