Class: Pod::ConfigureSwift

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ConfigureSwift

Returns a new instance of ConfigureSwift.



11
12
13
14
# File 'lib/yk_command/project/setup/ConfigureSwift.rb', line 11

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

Instance Attribute Details

#configuratorObject (readonly)

Returns the value of attribute configurator.



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

def configurator
  @configurator
end

Class Method Details

.perform(options) ⇒ Object



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

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

end

Instance Method Details

#performObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/yk_command/project/setup/ConfigureSwift.rb', line 17

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

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

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

  `mv #{$current_dir}/templates/swift/* #{$current_dir}`

  # remove podspec for osx
  `rm #{$current_dir}/NAME-osx.podspec`
end