Sha256: d9e8991d3e63fd157dd383919e9f735d701a07c54a83b34cad3dba58de850962

Contents?: true

Size: 1.31 KB

Versions: 42

Compression:

Stored size: 1.31 KB

Contents

require 'yaml'
require 'tmpdir'
require 'fileutils'

class ProjectGenerator
  PRJFILE_MINIMAL_CONFIG = {
    :project_name => "MyProject",
    :class_prefix => "XYZ"
  }

  PRJFILE_STANDARD_CONFIG = {
    :binary_name =>  "myproject",
    :target_name => "MyProjectTg",
    :tests_target_name => "MyProjectTgTests"
  }.merge(PRJFILE_MINIMAL_CONFIG)

  PRJFILE_COMPLETE_CONFIG = {
    :xcode_workspace => "MyProject.xcworkspace",
    :xcode_project => "MyProject/MyProject.xcodeproj",
    :xcode_scheme => "MyProject",
    :source_root => "MyProject/MyProjectTg",
    :tests_source_root => "MyProject/MyProjectTgTests",
    :frank_root => "MyProject/MyProjectTg/Frank",
    :frankified_app => "MyProject/MyProjectTg/Frank/frankified_build/Frankified.app"
  }.merge(PRJFILE_STANDARD_CONFIG)

  attr_accessor :config

  def project_folder
    @project_folder ||= Dir.mktmpdir
    raise "Can't create temp folder" unless @project_folder
    @project_folder
  end

  def create_test_project(project_file_config)
    @config = project_file_config
    File.open(File.join(project_folder, 'FWProjectfile'), 'w') {|f| f.write project_file_config.to_yaml }
    File.open(File.join(project_folder, 'Gemfile'), 'w') { |f| f.write 'gem "Bundler"'}
  end

  def delete_project
    FileUtils.rm_rf @project_folder if File.exists? @project_folder
  end

end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
fwtoolkit-2.6.4 spec/support/project_generator.rb
fwtoolkit-2.6.3 spec/support/project_generator.rb
fwtoolkit-2.6.2 spec/support/project_generator.rb
fwtoolkit-2.6.1 spec/support/project_generator.rb
fwtoolkit-2.6.0 spec/support/project_generator.rb
fwtoolkit-2.5.0 spec/support/project_generator.rb
fwtoolkit-2.4.0 spec/support/project_generator.rb
fwtoolkit-2.3.6 spec/support/project_generator.rb
fwtoolkit-2.3.5 spec/support/project_generator.rb
fwtoolkit-2.3.4 spec/support/project_generator.rb
fwtoolkit-2.3.3 spec/support/project_generator.rb
fwtoolkit-2.3.2 spec/support/project_generator.rb
fwtoolkit-2.3.1 spec/support/project_generator.rb
fwtoolkit-2.3.0 spec/support/project_generator.rb
fwtoolkit-2.2.4 spec/support/project_generator.rb
fwtoolkit-2.2.3 spec/support/project_generator.rb
fwtoolkit-2.2.2 spec/support/project_generator.rb
fwtoolkit-2.2.1 spec/support/project_generator.rb
fwtoolkit-2.2.0 spec/support/project_generator.rb
fwtoolkit-2.1.10 spec/support/project_generator.rb