class PixateFreestyleConfig

Attributes

framework[RW]

Public Class Methods

new(config) click to toggle source
# File lib/motion/project/pixatefreestyle.rb, line 8
def initialize(config)
  @config = config
end

Public Instance Methods

framework=(path) click to toggle source
# File lib/motion/project/pixatefreestyle.rb, line 12
def framework=(path)
  if @framework != path
    @config.unvendor_project(@framework)
    @framework = path
    @config.vendor_project(path, :static, :products => ['PixateFreestyle'], :headers_dir => 'Headers')
    create_code
  end
end

Private Instance Methods

add_file(path) click to toggle source
# File lib/motion/project/pixatefreestyle.rb, line 44
def add_file(path)
  files = @config.files.flatten
  @config.files << path unless files.find { |x| File.expand_path(x) == File.expand_path(path) }
end
create_code() click to toggle source
# File lib/motion/project/pixatefreestyle.rb, line 23
  def create_code
    code = <<EOF
# This file is automatically generated. Do not edit.

def style(str)
  PixateFreestyle.initializePixateFreestyle
  PixateFreestyle.styleSheetFromSource(str, withOrigin:0)
  PixateFreestyle.updateStylesForAllViews
end
EOF
    pixate_file = './app/pixatefreestyle_code.rb'
    create_stub(pixate_file, code)
    add_file(pixate_file)
  end
create_stub(path, code) click to toggle source
# File lib/motion/project/pixatefreestyle.rb, line 38
def create_stub(path, code)
  if !File.exist?(path) or File.read(path) != code
    File.open(path, 'w') { |io| io.write(code) }
  end
end