xcake 0.6.20 → 0.6.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10ab3f2002a23f912cbc8a2eac97c2810d0eedec
4
- data.tar.gz: 32df4ea91d423def8d317897ba5dbcd9e666a4e7
3
+ metadata.gz: 8dbc4303d0d40a50b5fb64dde657f5118705013c
4
+ data.tar.gz: 999ec99117f340038bb5ace7aecaa7d1747492ba
5
5
  SHA512:
6
- metadata.gz: ff9b96ac30820b273bc8c2ee45c8f7c17d17d976eacfe36b8c54c0b31dc8ebb64d30f67a2a55244479bc3ef5bc8514f7eac3cc70c50e1e54af734b0dbbc5bd4f
7
- data.tar.gz: f6bb209ab0f2e521ad862648c9dbca5e4a0d3bbe923648d78939e4195d4055d71105cbbb153515cf59ff09c817c08ad933a42ed7090a735f4e8e4250bc6c6e79
6
+ metadata.gz: 54d2a101fde7dc2cbc54e2ee01ddad4b814cb5e7b28296890e7494f9e46599026cfa7c6948e564851d4bace8fb3799737e9cf7538e06e4b774f1f2d215f9f13e
7
+ data.tar.gz: 5ef0d8678dfd585751dc08eef341a853673c1a419707f2acce616033563c19888f8bd0cf31cb7318cd035e42169acf6dea31007d5f368499c9dc1e273a14732d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ v0.6.21
2
+ =======
3
+ - Improved UI Output.
4
+ - Fixes crash when no XCConfig is set.
5
+
1
6
  v0.6.20
2
7
  =======
3
8
  - When adding a file to a group, Xcode will now open the correct folder.
data/Gemfile.lock CHANGED
@@ -3,7 +3,7 @@ PATH
3
3
  specs:
4
4
  xcake (0.6.20)
5
5
  claide (>= 0.9.1, < 2.0)
6
- colored
6
+ cork
7
7
  hooks (~> 0.4.1)
8
8
  xcodeproj (>= 0.20, < 2.0.0)
9
9
 
@@ -20,6 +20,8 @@ GEM
20
20
  claide (1.0.0)
21
21
  coderay (1.1.1)
22
22
  colored (1.2)
23
+ cork (0.1.0)
24
+ colored (~> 1.2)
23
25
  coveralls (0.8.13)
24
26
  json (~> 1.8)
25
27
  simplecov (~> 0.11.0)
data/bin/xcake CHANGED
@@ -2,4 +2,6 @@
2
2
 
3
3
  require 'xcake'
4
4
 
5
+ #TODO: Make UI and EventHooks DI-able
6
+ Xcake::UI.register_ui_hooks
5
7
  Xcake::Command.run(ARGV)
@@ -9,7 +9,7 @@ module Xcake
9
9
  cakefile_contents = File.read(cakefile_path)
10
10
  File.write('Cakefile', cakefile_contents)
11
11
 
12
- puts 'Open Cakefile to edit and run xcake make to get your xcode project'
12
+ EventHooks.run_hook(:after_cakefile_init)
13
13
  end
14
14
  end
15
15
  end
@@ -11,7 +11,7 @@ module Xcake
11
11
  raise Xcake::Informative, "Couldn't find Cakefile"
12
12
  end
13
13
 
14
- puts 'Reading Cakefile...'
14
+ EventHooks.run_hook :before_cakefile_read
15
15
  file_contents = File.read(file_path)
16
16
 
17
17
  project = Project.new
@@ -17,13 +17,11 @@ module Xcake
17
17
  when Node
18
18
  create_object_for_node(dsl_object)
19
19
  else
20
- abort 'DSL Object not recognized!'
20
+ nil
21
21
  end
22
22
  end
23
23
 
24
24
  def create_object_for_project(project)
25
- puts 'Creating Project...'
26
-
27
25
  # TODO: Make setup of project testable
28
26
  @project = Xcode::Project.new("./#{project.name}.xcodeproj", true)
29
27
  @project.setup_for_xcake
@@ -31,17 +29,14 @@ module Xcake
31
29
  end
32
30
 
33
31
  def create_object_for_target(target)
34
- puts 'Creating Target...'
35
32
  @project.new_target(target)
36
33
  end
37
34
 
38
35
  def create_object_for_configuration(configuration)
39
- puts 'Creating Configuration...'
40
36
  @project.new_configuration(configuration)
41
37
  end
42
38
 
43
39
  def create_object_for_node(node)
44
- puts 'Creating Group...'
45
40
  @project.new_group(node)
46
41
  end
47
42
 
@@ -0,0 +1,90 @@
1
+ require 'hooks'
2
+
3
+ module Xcake
4
+ class EventHooks
5
+ include Hooks
6
+
7
+ # Defines hook which is ran after a Cakefile is initilized.
8
+ #
9
+ define_hooks :after_cakefile_init
10
+
11
+ # Defines hook which is ran before we start reading the cakefile
12
+ #
13
+ define_hooks :before_cakefile_read
14
+
15
+ # Defines hook which is ran before we start creating the Xcode Project
16
+ #
17
+ define_hooks :before_creating_xcode_project
18
+
19
+ # Defines hook which is ran before we start creating a Target
20
+ #
21
+ define_hooks :before_creating_target
22
+
23
+ # Defines hook which is ran before we start resolving
24
+ # issues with the Project structure
25
+ #
26
+ define_hooks :before_resolving_project_structure
27
+
28
+ # Defines hook which is ran before we start resolving
29
+ # issues with the Target structure
30
+ #
31
+ define_hooks :before_resolving_target_structure
32
+
33
+ # Defines hook which is ran before we start creating build configurations
34
+ # for a particular Xcode Project Object
35
+ #
36
+ define_hooks :before_creating_build_configurations
37
+
38
+ # Defines hook which is ran before we start creating a
39
+ # build configurations for a particular Xcode Project Object
40
+ #
41
+ define_hooks :before_creating_build_configuration
42
+
43
+ # Defines hook which is ran before we attach a XCConfig to a
44
+ # build configuration for a particular Xcode Project Object
45
+ #
46
+ define_hooks :before_attaching_xcconfig
47
+
48
+ # Defines hook which is ran before we add a system library
49
+ # to a target
50
+ #
51
+ define_hooks :before_adding_system_library
52
+
53
+ # Defines hook which is ran before we add a system framework
54
+ # to a target
55
+ #
56
+ define_hooks :before_adding_system_framework
57
+
58
+ # Defines hook which is ran before we add build phases
59
+ # to a target
60
+ #
61
+ define_hooks :before_adding_build_phases
62
+
63
+ # Defines hook which is ran before we create the user schemes
64
+ #
65
+ define_hooks :before_adding_user_schemes
66
+
67
+ # Defines hook which is ran before we add a file to the project
68
+ #
69
+ define_hooks :before_adding_file
70
+
71
+ # Defines hook which is ran before we add a custom build phase to
72
+ # a target
73
+ #
74
+ define_hooks :before_adding_custom_build_phase
75
+
76
+ # Defines hook which is ran before we add a embed watch app build phase to
77
+ # a target
78
+ #
79
+ define_hooks :before_adding_embed_watch_app_phase
80
+
81
+ # Defines hook which is ran before we add a embed watch extension build
82
+ # phase to a target
83
+ #
84
+ define_hooks :before_adding_embed_watch_extension_phase
85
+
86
+ # Defines hook which is ran after we save the generated project file
87
+ #
88
+ define_hooks :after_project_save
89
+ end
90
+ end
@@ -18,17 +18,20 @@ module Xcake
18
18
  end
19
19
 
20
20
  def create_build_configurations_for(configuration_object)
21
- puts "Creating build configurations for #{configuration_object}..."
21
+ EventHooks.run_hook :before_creating_build_configurations, configuration_object
22
22
 
23
23
  configuration_object.all_configurations.each do |configuration|
24
- puts "Creating build configuration #{configuration.name} for #{configuration_object}..."
24
+ EventHooks.run_hook :before_creating_build_configuration, configuration, configuration_object
25
25
 
26
26
  build_configuration = @context.native_object_for(configuration)
27
27
  build_configuration.name = configuration.name
28
28
  build_configuration.build_settings = configuration.settings
29
29
 
30
- configuration_file = configuration.configuration_file
31
- file_reference = @context.file_reference_for_path(configuration_file)
30
+ unless configuration.configuration_file.nil?
31
+ EventHooks.run_hook :before_attaching_xcconfig, configuration
32
+ configuration_file = configuration.configuration_file
33
+ file_reference = @context.file_reference_for_path(configuration_file)
34
+ end
32
35
 
33
36
  build_configuration.base_configuration_reference = file_reference
34
37
 
@@ -10,7 +10,8 @@ module Xcake
10
10
  native_project = @context.native_object_for(project)
11
11
  native_project.save
12
12
  project.run_hook :after_save
13
- puts 'Done!'
13
+
14
+ EventHooks.run_hook :after_project_save
14
15
  end
15
16
  end
16
17
  end
@@ -1,7 +1,7 @@
1
1
  module Xcake
2
2
  class ProjectMetadataGenerator < Generator
3
3
  def visit_project(project)
4
- puts 'Creating Project...'
4
+ EventHooks.run_hook :before_creating_xcode_project
5
5
 
6
6
  native_project = @context.native_object_for(project)
7
7
  native_project.class_prefix = project.class_prefix if project.class_prefix
@@ -10,8 +10,7 @@ module Xcake
10
10
  attr_accessor :project
11
11
 
12
12
  def visit_project(project)
13
- puts 'Resolving Project...'
14
-
13
+ EventHooks.run_hook :before_resolving_project_structure, project
15
14
  @project = project
16
15
  end
17
16
 
@@ -19,7 +18,7 @@ module Xcake
19
18
  end
20
19
 
21
20
  def visit_target(target)
22
- puts "Resolving target #{target}..."
21
+ EventHooks.run_hook :before_resolving_target_structure, target
23
22
 
24
23
  @project.all_configurations.each do |c|
25
24
  target.configuration(c.name, c.type)
@@ -5,7 +5,7 @@ module Xcake
5
5
  end
6
6
 
7
7
  def visit_project(project)
8
- puts 'Creating User Schemes...'
8
+ EventHooks.run_hook :before_adding_user_schemes
9
9
 
10
10
  native_project = @context.native_object_for(project)
11
11
  native_project.recreate_user_schemes
@@ -8,7 +8,7 @@ module Xcake
8
8
  end
9
9
 
10
10
  def visit_target(target)
11
- puts "Generating build phases for #{target}..."
11
+ EventHooks.run_hook :before_adding_build_phases, target
12
12
 
13
13
  native_target = @context.native_object_for(target)
14
14
 
@@ -25,7 +25,7 @@ module Xcake
25
25
  end
26
26
 
27
27
  def create_embed_watchapp_phase(native_target, native_watchapp_target)
28
- puts 'Generating embed watch app phase...'
28
+ EventHooks.run_hook :before_adding_embed_watch_app_phase
29
29
 
30
30
  phase = native_target.new_copy_files_build_phase('Embed Watch Content')
31
31
  phase.dst_path = '$(CONTENTS_FOLDER_PATH)/Watch'
@@ -35,9 +35,9 @@ module Xcake
35
35
  end
36
36
 
37
37
  def create_embed_watchapp_extension_phase(native_target, native_watchapp_extension_target)
38
- puts 'Generating embed watch app extension phase...'
39
- product_reference = native_watchapp_extension_target.product_reference
38
+ EventHooks.run_hook :before_adding_embed_watch_extension_phase
40
39
 
40
+ product_reference = native_watchapp_extension_target.product_reference
41
41
  phase = native_target.new_copy_files_build_phase('Embed App Extensions')
42
42
  phase.symbol_dst_subfolder_spec = :plug_ins
43
43
  phase.add_file_reference(product_reference, true)
@@ -8,7 +8,7 @@ module Xcake
8
8
  # TODO: Refactor this system.
9
9
  native_target = @context.native_object_for(target)
10
10
  target.build_phases.each do |phase|
11
- puts "Adding custom phase \"#{phase.name}\" for #{target}"
11
+ EventHooks.run_hook :before_adding_custom_build_phase, phase, target
12
12
  phase.generate_native_build_phase(native_target)
13
13
  end
14
14
  end
@@ -36,7 +36,8 @@ module Xcake
36
36
 
37
37
  def visit_node(node)
38
38
  return unless node.path
39
- puts "Adding #{node.path}..."
39
+
40
+ EventHooks.run_hook :before_adding_file, node
40
41
 
41
42
  installer_class = @dependency_provider.tsort.detect do |i|
42
43
  i.can_install_node(node)
@@ -5,12 +5,14 @@ module Xcake
5
5
  end
6
6
 
7
7
  def visit_target(target)
8
- puts "Integrating System Frameworks for #{target}..."
8
+ unless target.system_frameworks.nil?
9
+ EventHooks.run_hook :before_adding_system_framework, target
9
10
 
10
- native_target = @context.native_object_for(target)
11
+ native_target = @context.native_object_for(target)
11
12
 
12
- system_frameworks = target.system_frameworks
13
- native_target.add_system_frameworks(system_frameworks) if system_frameworks
13
+ system_frameworks = target.system_frameworks
14
+ native_target.add_system_frameworks(system_frameworks)
15
+ end
14
16
  end
15
17
  end
16
18
  end
@@ -5,7 +5,7 @@ module Xcake
5
5
  end
6
6
 
7
7
  def visit_target(target)
8
- puts "Creating target #{target.name}..."
8
+ EventHooks.run_hook :before_creating_target, target
9
9
  @context.native_object_for(target)
10
10
  end
11
11
  end
@@ -5,12 +5,14 @@ module Xcake
5
5
  end
6
6
 
7
7
  def visit_target(target)
8
- puts "Integrating System Libraries for #{target}..."
8
+ unless target.system_libraries.nil?
9
+ EventHooks.run_hook :before_adding_system_library, target
9
10
 
10
- native_target = @context.native_object_for(target)
11
+ native_target = @context.native_object_for(target)
11
12
 
12
- system_libraries = target.system_libraries
13
- native_target.add_system_libraries(system_libraries) if system_libraries
13
+ system_libraries = target.system_libraries
14
+ native_target.add_system_libraries(system_libraries)
15
+ end
14
16
  end
15
17
  end
16
18
  end
@@ -1,10 +1,6 @@
1
1
  require 'claide'
2
- require 'colored'
3
2
 
4
- # Indicates an user error.
5
- #
6
- # TODO: Move into UI Class
7
- #
3
+ #TODO: Hook into UI Class somehow.
8
4
  module Xcake
9
5
  class Informative < StandardError
10
6
  include CLAide::InformativeError
@@ -3,7 +3,6 @@ require 'hooks'
3
3
  module Xcake
4
4
  class Project
5
5
  include Hooks
6
- include Hooks::InstanceHooks
7
6
 
8
7
  # Defines hook which is ran after project is saved.
9
8
  #
data/lib/xcake/ui.rb CHANGED
@@ -1,4 +1,89 @@
1
+ require 'cork'
2
+
3
+ # TODO: i18n this.
4
+ # TODO: Different modes depending on --verbose, and CI
5
+ # TODO: Split output and UI code into seperate concerns.
1
6
  module Xcake
2
7
  class UI
8
+ def self.register_ui_hooks
9
+
10
+ board = Cork::Board.new()
11
+
12
+ EventHooks.after_cakefile_init do
13
+ board.notice 'Open Cakefile to edit and run xcake make to get your xcode project'
14
+ end
15
+
16
+ EventHooks.before_cakefile_read do
17
+ board.puts_indented '- Reading Cakefile'
18
+ end
19
+
20
+ EventHooks.before_creating_xcode_project do
21
+ board.puts_indented '- Creating Project'
22
+ end
23
+
24
+ EventHooks.before_creating_target do |target|
25
+ board.puts_indented "- Creating #{target}"
26
+ end
27
+
28
+ EventHooks.before_resolving_project_structure do
29
+ board.puts_indented "- Resolving Project"
30
+ end
31
+
32
+ EventHooks.before_resolving_target_structure do |target|
33
+ board.puts_indented "- Resolving #{target}"
34
+ end
35
+
36
+ EventHooks.before_creating_build_configurations do |configurable|
37
+ board.puts_indented "- Creating build configurations for #{configurable}"
38
+ end
39
+
40
+ EventHooks.before_creating_build_configuration do |configuration, configurable|
41
+ board.puts_indented "- Creating build configuration #{configuration.name} for #{configurable}"
42
+ end
43
+
44
+ EventHooks.before_attaching_xcconfig do |configuration|
45
+ board.puts_indented "- Attaching XCConfig #{configuration.configuration_file} to build configuration #{configuration.name}"
46
+ end
47
+
48
+ EventHooks.before_adding_system_library do |target|
49
+ board.puts_indented "- Integrating System Libraries #{target.system_libraries} for #{target}"
50
+ end
51
+
52
+ EventHooks.before_adding_system_library do |target|
53
+ board.puts_indented "- Integrating System Libraries #{target.system_libraries} for #{target}"
54
+ end
55
+
56
+ EventHooks.before_adding_system_framework do |target|
57
+ board.puts_indented "- Integrating System Frameworks #{target.system_frameworks} for #{target}"
58
+ end
59
+
60
+ EventHooks.before_adding_build_phases do |target|
61
+ board.puts_indented "- Creating build phases for #{target}"
62
+ end
63
+
64
+ EventHooks.before_adding_user_schemes do
65
+ board.puts_indented '- Creating User Schemes'
66
+ end
67
+
68
+ EventHooks.before_adding_file do |node|
69
+ board.puts "- Adding #{node.path}"
70
+ end
71
+
72
+ EventHooks.before_adding_custom_build_phase do |phase, target|
73
+ board.puts "- Adding custom phase \"#{phase.name}\" for #{target}"
74
+ end
75
+
76
+ EventHooks.before_adding_embed_watch_app_phase do
77
+ board.puts '- Generating embed watch app phase...'
78
+ end
79
+
80
+ EventHooks.before_adding_embed_watch_extension_phase do
81
+ board.puts '- Generating embed watch extension phase...'
82
+ end
83
+
84
+ EventHooks.after_project_save do
85
+ board.notice 'Done!'
86
+ end
87
+ end
3
88
  end
4
89
  end
data/lib/xcake/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Xcake
2
- VERSION = '0.6.20'.freeze
2
+ VERSION = '0.6.21'.freeze
3
3
  end
@@ -53,8 +53,6 @@ module Xcake
53
53
  end
54
54
 
55
55
  def recreate_user_schemes(*)
56
- puts 'Creating Schemes...'
57
-
58
56
  scheme_list.recreate_schemes
59
57
  scheme_list.save(path)
60
58
  end
@@ -89,6 +89,8 @@ module Xcake
89
89
  # @param [String] writing_path
90
90
  # path to write to.
91
91
  #
92
+ # TODO: Move to a Generator
93
+ #
92
94
  def save(writing_path)
93
95
  schemes_dir = Scheme.user_data_dir(writing_path)
94
96
 
@@ -96,7 +98,6 @@ module Xcake
96
98
  FileUtils.mkdir_p(schemes_dir)
97
99
 
98
100
  schemes.each do |s|
99
- puts "Saving Scheme #{s.name}..."
100
101
  s.save_as(@project.path, s.name, true)
101
102
 
102
103
  @xcschememanagement['SchemeUserState']["#{s.name}.xcscheme_^#shared#^_"] = {
@@ -104,8 +105,6 @@ module Xcake
104
105
  }
105
106
  end
106
107
 
107
- puts 'Saving Scheme List...'
108
-
109
108
  xcschememanagement_path = schemes_dir + 'xcschememanagement.plist'
110
109
  write_plist(xcschememanagement_path)
111
110
  end
data/lib/xcake.rb CHANGED
@@ -4,6 +4,7 @@ require 'xcake/core_ext/string'
4
4
  require 'xcake/modern_xcodeproj.rb'
5
5
 
6
6
  require 'xcake/version'
7
+ require 'xcake/event_hooks'
7
8
  require 'xcake/ui'
8
9
  require 'xcake/informative'
9
10
  require 'xcake/command'
data/xcake.gemspec CHANGED
@@ -31,5 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency 'claide', '< 2.0', '>= 0.9.1'
32
32
  spec.add_dependency 'hooks', '~> 0.4.1'
33
33
  spec.add_dependency 'xcodeproj', '< 2.0.0', '>= 0.20'
34
- spec.add_dependency 'colored'
34
+ spec.add_dependency 'cork'
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.20
4
+ version: 0.6.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Campbell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-03 00:00:00.000000000 Z
11
+ date: 2016-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -163,7 +163,7 @@ dependencies:
163
163
  - !ruby/object:Gem::Version
164
164
  version: '0.20'
165
165
  - !ruby/object:Gem::Dependency
166
- name: colored
166
+ name: cork
167
167
  requirement: !ruby/object:Gem::Requirement
168
168
  requirements:
169
169
  - - ">="
@@ -230,6 +230,7 @@ files:
230
230
  - lib/xcake/core_ext/string.rb
231
231
  - lib/xcake/dependency.rb
232
232
  - lib/xcake/dependency_provider.rb
233
+ - lib/xcake/event_hooks.rb
233
234
  - lib/xcake/file_reference_installer.rb
234
235
  - lib/xcake/file_reference_installer/compile_source_file_reference_installer.rb
235
236
  - lib/xcake/file_reference_installer/compile_xcdatamodeld_file_reference_installer.rb