Class: Pod::ConfigureIOS

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ConfigureIOS

Returns a new instance of ConfigureIOS.



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

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/ConfigureiOS.rb', line 4

def configurator
  @configurator
end

Class Method Details

.perform(options) ⇒ Object



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

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

Instance Method Details

#performObject



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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/yk_command/project/setup/ConfigureiOS.rb', line 15

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
  # framework = configurator.ask_with_answers("Which testing frameworks will you use", ["Specta", "Kiwi", "None"]).to_sym
  # case framework
  #   when :specta
  #     configurator.add_pod_to_podfile "Specta"
  #     configurator.add_pod_to_podfile "Expecta"

  #     configurator.add_line_to_pch "@import Specta;"
  #     configurator.add_line_to_pch "@import Expecta;"

  #     configurator.set_test_framework("specta", "m", "ios")

  #   when :kiwi
  #     configurator.add_pod_to_podfile "Kiwi"
  #     configurator.add_line_to_pch "@import Kiwi;"
  #     configurator.set_test_framework("kiwi", "m", "ios")

  #   when :none
  #     configurator.set_test_framework("xctest", "m", "ios")
  # end

  # snapshots = configurator.ask_with_answers("Would you like to do view based testing", ["Yes", "No"]).to_sym
  # case snapshots
  #   when :yes
  #     configurator.add_pod_to_podfile "FBSnapshotTestCase"
  #     configurator.add_line_to_pch "@import FBSnapshotTestCase;"

  #     if keep_demo == :no
  #         puts " Putting demo application back in, you cannot do view tests without a host application."
  #         keep_demo = :yes
  #     end

  #     if framework == :specta
  #         configurator.add_pod_to_podfile "Expecta+Snapshots"
  #         configurator.add_line_to_pch "@import Expecta_Snapshots;"
  #     end
  # end

  # prefix = nil
  prefix = ''
  # loop do
  #   prefix = configurator.ask("What is your class prefix").upcase

  #   if prefix.include?(' ')
  #     puts 'Your class prefix cannot contain spaces.'.red
  #   else
  #     break
  #   end
  # end

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

  Pod::ProjectManipulator.new({
    :configurator => @configurator,
    # :xcodeproj_path => "templates/swift/Example/PROJECT.xcodeproj",
    :xcodeproj_path => "#{$current_dir}/templates/ios/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, which is now default
  # `touch Pod/Classes/ReplaceMe.m`

  # `mv ./templates/ios/* ./`

  # # remove podspec for osx
  # `rm ./NAME-osx.podspec`
  `touch #{$current_dir}/Pod/Classes/ReplaceMe.m`

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

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

end