Sha256: 474b1b584995b6d020c732626dd95f8cd5a6bcb77f6dcd5b1f17cdf9dc90c53d

Contents?: true

Size: 1021 Bytes

Versions: 4

Compression:

Stored size: 1021 Bytes

Contents

require "blue_printer/version"
require "fileutils"

module BluePrinter
  class Error < StandardError; end

  XCODE_TEMPLATE_PATH = File.join("Library", "Developer", "Xcode", "Templates")
  TEMPLATE_DIR = File.join(File.expand_path('~'), XCODE_TEMPLATE_PATH)
  IOS_TEMPLATE_DIR = File.join(TEMPLATE_DIR, "ios-xcode-templates")
  TEMPLATE_NAME = "VIP Architecture.xctemplate"

  def self.root
    File.dirname __dir__
  end

  def self.generate
    template_path = "tmp/VIP Architecture.xctemplate"
    FileUtils.mkdir_p template_path
    [
      "Interactor",
      "Presenter",
      "ViewController",
      "InteractorTests",
      "PresenterTests",
      "ViewControllerTests",
      "Router",
      "Worker"
    ].each do |filename|
      File.open("#{template_path}/___FILEBASENAME___#{filename}.swift", "w")
    end
  end

  def self.move_to_xcode_template_directory
    FileUtils.mkdir_p IOS_TEMPLATE_DIR
    FileUtils.copy_entry File.join(root, TEMPLATE_NAME), File.join(IOS_TEMPLATE_DIR, TEMPLATE_NAME)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blue_printer-0.1.3 lib/blue_printer.rb
blue_printer-0.1.2 lib/blue_printer.rb
blue_printer-0.1.1 lib/blue_printer.rb
blue_printer-0.1.0 lib/blue_printer.rb