Class: Pod::ConfigureMacOSSwift

Inherits:
Object
  • Object
show all
Defined in:
lib/yk_command/project/setup/ConfigureMacOSSwift.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ConfigureMacOSSwift

Returns a new instance of ConfigureMacOSSwift.



10
11
12
# File 'lib/yk_command/project/setup/ConfigureMacOSSwift.rb', line 10

def initialize(options)
  @configurator = options.fetch(:configurator)
end

Instance Attribute Details

#configuratorObject (readonly)

Returns the value of attribute configurator.



4
5
6
# File 'lib/yk_command/project/setup/ConfigureMacOSSwift.rb', line 4

def configurator
  @configurator
end

Class Method Details

.perform(options) ⇒ Object



6
7
8
# File 'lib/yk_command/project/setup/ConfigureMacOSSwift.rb', line 6

def self.perform(options)
  new(options).perform
end

Instance Method Details

#performObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/yk_command/project/setup/ConfigureMacOSSwift.rb', line 14

def perform
  keep_demo = configurator.ask_with_answers("Would you like to include a demo application with your library", ["Yes", "No"]).to_sym

  framework = configurator.ask_with_answers("Which testing frameworks will you use", ["Quick", "None"]).to_sym
  case framework
    when :quick
      configurator.add_pod_to_podfile "Quick', '~> 2.2.0"
      configurator.add_pod_to_podfile "Nimble', '~> 8.0.7"
      configurator.set_test_framework "quick", "swift", "macos-swift"

    when :none
      configurator.set_test_framework "xctest", "swift", "macos-swift"
  end

  Pod::ProjectManipulator.new({
    :configurator => @configurator,
    :xcodeproj_path => "templates/macos-swift/Example/PROJECT.xcodeproj",
    :platform => :osx,
    :remove_demo_project => (keep_demo == :no),
    :prefix => ""
  }).run

  `mv ./templates/macos-swift/* ./`

  # There has to be a single file in the Classes dir
  # or a framework won't be created
  # `touch Pod/Classes/ReplaceMe.swift`

  `mv ./NAME-osx.podspec ./NAME.podspec`
end