xcake 0.6.19 → 0.6.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -1
  3. data/CHANGELOG.md +12 -1
  4. data/Gemfile.lock +8 -50
  5. data/README.md +1 -1
  6. data/Rakefile +3 -3
  7. data/_rubocop.yml +1 -1
  8. data/bin/console +2 -2
  9. data/bin/xcake +1 -1
  10. data/docs/Cakefile.md +17 -10
  11. data/docs/Xcode Project Support.md +1 -0
  12. data/fastlane-plugin-xcake/README.md +1 -1
  13. data/fastlane-plugin-xcake/Rakefile +3 -3
  14. data/fastlane-plugin-xcake/fastlane-plugin-xcake.gemspec +5 -5
  15. data/fastlane-plugin-xcake/lib/fastlane/plugin/xcake/actions/xcake_action.rb +3 -3
  16. data/lib/xcake/command/init.rb +4 -4
  17. data/lib/xcake/command/make.rb +7 -18
  18. data/lib/xcake/command.rb +5 -6
  19. data/lib/xcake/configurable.rb +24 -10
  20. data/lib/xcake/configuration/proxies/preproccessor_definitions_setting_proxy.rb +1 -1
  21. data/lib/xcake/configuration/sugar.rb +7 -7
  22. data/lib/xcake/configuration.rb +3 -4
  23. data/lib/xcake/context/xcodeproj_context.rb +10 -7
  24. data/lib/xcake/context.rb +3 -0
  25. data/lib/xcake/core_ext/array.rb +5 -0
  26. data/lib/xcake/core_ext/object.rb +7 -0
  27. data/lib/xcake/core_ext/string.rb +3 -3
  28. data/lib/xcake/dependency.rb +4 -9
  29. data/lib/xcake/dependency_provider.rb +11 -16
  30. data/lib/xcake/file_reference_installer/compile_source_file_reference_installer.rb +1 -2
  31. data/lib/xcake/file_reference_installer/compile_xcdatamodeld_file_reference_installer.rb +2 -5
  32. data/lib/xcake/file_reference_installer/copy_resources_file_reference_installer.rb +3 -4
  33. data/lib/xcake/file_reference_installer/copy_xcassets_file_reference_installer.rb +2 -5
  34. data/lib/xcake/file_reference_installer/link_library_file_reference_installer.rb +9 -3
  35. data/lib/xcake/file_reference_installer.rb +8 -4
  36. data/lib/xcake/generator/configuration_generator.rb +6 -15
  37. data/lib/xcake/generator/project_generator.rb +2 -3
  38. data/lib/xcake/generator/project_metadata_generator.rb +1 -1
  39. data/lib/xcake/generator/project_structure_generator.rb +2 -8
  40. data/lib/xcake/generator/scheme_generator.rb +1 -3
  41. data/lib/xcake/generator/target_build_phase_generator.rb +8 -10
  42. data/lib/xcake/generator/target_custom_build_phase_generator.rb +0 -1
  43. data/lib/xcake/generator/target_file_reference_generator.rb +6 -14
  44. data/lib/xcake/generator/target_framework_generator.rb +3 -1
  45. data/lib/xcake/generator/target_library_generator.rb +3 -3
  46. data/lib/xcake/generator.rb +4 -3
  47. data/lib/xcake/informative.rb +3 -4
  48. data/lib/xcake/node.rb +11 -17
  49. data/lib/xcake/plugin.rb +8 -16
  50. data/lib/xcake/project/hooks.rb +1 -1
  51. data/lib/xcake/project/sugar.rb +12 -13
  52. data/lib/xcake/project.rb +3 -5
  53. data/lib/xcake/resources/Cakefile +2 -2
  54. data/lib/xcake/target/sugar.rb +1 -1
  55. data/lib/xcake/target.rb +22 -23
  56. data/lib/xcake/ui.rb +0 -3
  57. data/lib/xcake/version.rb +1 -1
  58. data/lib/xcake/visitor.rb +0 -1
  59. data/lib/xcake/xcode/project.rb +162 -135
  60. data/lib/xcake/xcode/scheme_list.rb +9 -11
  61. data/lib/xcake.rb +36 -58
  62. data/xcake.gemspec +20 -22
  63. metadata +8 -21
  64. data/lib/xcake/file_reference_installer/xcconfig_file_reference_installer.rb +0 -17
@@ -0,0 +1,5 @@
1
+ class Array
2
+ def to_h
3
+ Hash[*flatten(1)]
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ class Object
2
+ # Returns all descendants of a class
3
+ #
4
+ def self.descendants
5
+ ObjectSpace.each_object(Class).select { |klass| klass < self }
6
+ end
7
+ end
@@ -14,8 +14,8 @@ class String
14
14
  # Strips heredoc indents
15
15
  #
16
16
  def strip_heredoc
17
- indent = self.scan(/^[ \t]*(?=\S)/).min
18
- indent_len = (indent || "").length
19
- self.gsub(/^[ \t]{#{indent_len}}/, "")
17
+ indent = scan(/^[ \t]*(?=\S)/).min
18
+ indent_len = (indent || '').length
19
+ gsub(/^[ \t]{#{indent_len}}/, '')
20
20
  end
21
21
  end
@@ -1,12 +1,11 @@
1
1
  require 'xcodeproj'
2
2
 
3
- #TODO: Figure out a more robust Dependency system
4
- # - Needs to handle subclass of subclass.....
5
- # - Needs to have better mixin hiearchy
6
- # - Implement a pre-dependency (Something that this needs to happen in front of)
7
-
8
3
  module Xcake
9
4
  module Dependency
5
+ def self.included(base)
6
+ base.extend ClassMethods
7
+ end
8
+
10
9
  module ClassMethods
11
10
  def name
12
11
  self
@@ -16,9 +15,5 @@ module Xcake
16
15
  []
17
16
  end
18
17
  end
19
-
20
- def self.included(klass)
21
- klass.extend ClassMethods # Somewhat controversial
22
- end
23
18
  end
24
19
  end
@@ -1,28 +1,23 @@
1
- require 'molinillo'
1
+ require 'tsort'
2
2
 
3
3
  module Xcake
4
4
  class DependencyProvider
5
+ include TSort
5
6
 
6
- include Molinillo::SpecificationProvider
7
+ def initialize(dependency_class)
8
+ plugins = dependency_class.load_plugins
7
9
 
8
- attr_accessor :repository
9
-
10
- def initialize(repository)
11
- @repository = repository
12
- end
13
-
14
- def name_for(dependency)
15
- dependency
10
+ @dependency_graph = plugins.map do |p|
11
+ [p, p.dependencies]
12
+ end.to_h
16
13
  end
17
14
 
18
- def search_for(dependency)
19
- @repository.select do |g|
20
- g == dependency
21
- end
15
+ def tsort_each_node(&block)
16
+ @dependency_graph.each_key(&block)
22
17
  end
23
18
 
24
- def dependencies_for(specification)
25
- specification.dependencies
19
+ def tsort_each_child(node, &block)
20
+ @dependency_graph[node].each(&block)
26
21
  end
27
22
  end
28
23
  end
@@ -3,14 +3,13 @@ module Xcake
3
3
  # files and adds them to the compile build phase.
4
4
  #
5
5
  class CompileSourceFileReferenceInstaller < FileReferenceInstaller
6
-
7
6
  def self.can_install_node(node)
8
7
  !File.directory?(node.path) &&
9
8
  %w(.c .m .mm .cpp .swift).include?(File.extname(node.path))
10
9
  end
11
10
 
12
11
  def add_file_reference_to_target(file_reference, target)
13
- target.source_build_phase.add_file_reference(file_reference)
12
+ target.source_build_phase.add_file_reference(file_reference, true)
14
13
  end
15
14
  end
16
15
  end
@@ -2,15 +2,14 @@ module Xcake
2
2
  # This build phase generator detects XCDataModeld bundles
3
3
  # and adds them to the compile source phase.
4
4
  #
5
- class CompileXCDataModeldFileReferenceInstaller< CompileSourceFileReferenceInstaller
6
-
5
+ class CompileXCDataModeldFileReferenceInstaller < CompileSourceFileReferenceInstaller
7
6
  def self.dependencies
8
7
  []
9
8
  end
10
9
 
11
10
  def self.can_install_node(node)
12
11
  File.directory?(node.path) &&
13
- [".xcdatamodeld"].include?(File.extname(node.path))
12
+ ['.xcdatamodeld'].include?(File.extname(node.path))
14
13
  end
15
14
 
16
15
  def visit_node(node)
@@ -21,5 +20,3 @@ module Xcake
21
20
  end
22
21
  end
23
22
  end
24
-
25
- Xcake::FileReferenceInstaller.register_plugin(Xcake::CompileXCDataModeldFileReferenceInstaller)
@@ -4,9 +4,8 @@ module Xcake
4
4
  #
5
5
  # Note: This installer is always the last to be executed.
6
6
  class CopyResourcesFileReferenceInstaller < FileReferenceInstaller
7
-
8
7
  def self.dependencies
9
- FileReferenceInstaller.repository.select do |i|
8
+ FileReferenceInstaller.descendants.select do |i|
10
9
  i != self
11
10
  end
12
11
  end
@@ -15,12 +14,12 @@ module Xcake
15
14
  extension = File.extname(node.path)
16
15
  (!File.directory?(node.path) ||
17
16
  (File.directory?(node.path) &&
18
- ![".xcassets", ".xcdatamodeld", ".lproj"].include?(extension) &&
17
+ !['.xcassets', '.xcdatamodeld', '.lproj'].include?(extension) &&
19
18
  node.children.count == 0))
20
19
  end
21
20
 
22
21
  def add_file_reference_to_target(file_reference, target)
23
- target.resources_build_phase.add_file_reference(file_reference)
22
+ target.resources_build_phase.add_file_reference(file_reference, true)
24
23
  end
25
24
  end
26
25
  end
@@ -3,23 +3,20 @@ module Xcake
3
3
  # and adds them to the copy resources phase.
4
4
  #
5
5
  class CopyXCAssetsFileReferenceInstaller < CopyResourcesFileReferenceInstaller
6
-
7
6
  def self.dependencies
8
7
  []
9
8
  end
10
9
 
11
10
  def self.can_install_node(node)
12
11
  File.directory?(node.path) &&
13
- [".xcassets"].include?(File.extname(node.path))
12
+ ['.xcassets'].include?(File.extname(node.path))
14
13
  end
15
14
 
16
15
  def visit_node(node)
17
16
  super
18
17
 
19
- #Ignore all files inside of the XCAssets
18
+ # Ignore all files inside of the XCAssets
20
19
  node.children = []
21
20
  end
22
21
  end
23
22
  end
24
-
25
- Xcake::FileReferenceInstaller.register_plugin(Xcake::CopyXCAssetsFileReferenceInstaller)
@@ -4,12 +4,18 @@ module Xcake
4
4
  #
5
5
  class LinkLibraryFileReferenceInstaller < FileReferenceInstaller
6
6
  def self.can_install_node(node)
7
- !File.directory?(node.path) &&
8
- %w(.a .dylib .so).include?(File.extname(node.path))
7
+ %w(.a .dylib .so .framework).include?(File.extname(node.path))
9
8
  end
10
9
 
11
10
  def add_file_reference_to_target(file_reference, target)
12
- target.frameworks_build_phases.add_file_reference(file_reference)
11
+ target.frameworks_build_phases.add_file_reference(file_reference, true)
12
+ end
13
+
14
+ def visit_node(node)
15
+ super
16
+
17
+ # Ignore all files inside of libraries
18
+ node.children = []
13
19
  end
14
20
  end
15
21
  end
@@ -4,7 +4,6 @@ module Xcake
4
4
  # for it.
5
5
  #
6
6
  class FileReferenceInstaller
7
-
8
7
  include Dependency
9
8
  include Plugin
10
9
  include Visitor
@@ -15,6 +14,10 @@ module Xcake
15
14
  @context = context
16
15
  end
17
16
 
17
+ def self.plugins_location
18
+ "#{File.dirname(__FILE__)}/file_reference_installer/*.rb"
19
+ end
20
+
18
21
  # This should be overidden
19
22
  # by subclasses.
20
23
  #
@@ -22,7 +25,7 @@ module Xcake
22
25
  #
23
26
  # @return [Boolean] true if build phase can handle the node.
24
27
  #
25
- def self.can_install_node(node)
28
+ def self.can_install_node(_node)
26
29
  true
27
30
  end
28
31
 
@@ -44,10 +47,11 @@ module Xcake
44
47
  def visit_node(node)
45
48
  native_group = @context.native_object_for(node)
46
49
 
47
- file_reference = native_group.new_reference(node.path)
50
+ file_reference = native_group[node.component] ||
51
+ native_group.new_reference(node.component)
48
52
 
49
53
  node.targets.each do |t|
50
- add_file_reference_to_target(file_reference, t)
54
+ add_file_reference_to_target(file_reference, t)
51
55
  end
52
56
  end
53
57
  end
@@ -5,9 +5,8 @@ module Xcake
5
5
  # and creates xcode build configurations.
6
6
  #
7
7
  class ConfigurationGenerator < Generator
8
-
9
8
  def self.dependencies
10
- [TargetGenerator, ProjectStructureGenerator]
9
+ [TargetGenerator, ProjectStructureGenerator, TargetFileReferenceGenerator]
11
10
  end
12
11
 
13
12
  def visit_project(project)
@@ -28,22 +27,14 @@ module Xcake
28
27
  build_configuration.name = configuration.name
29
28
  build_configuration.build_settings = configuration.settings
30
29
 
30
+ configuration_file = configuration.configuration_file
31
+ file_reference = @context.file_reference_for_path(configuration_file)
32
+
33
+ build_configuration.base_configuration_reference = file_reference
34
+
31
35
  native_configuration_object = @context.native_object_for(configuration_object)
32
36
  native_configuration_object.build_configurations << build_configuration
33
-
34
- if configuration.configuration_file != nil
35
- xcconfig = install_xcconfig(configuration)
36
- native_configuration_object.base_configuration_reference = xcconfig
37
- end
38
37
  end
39
38
  end
40
-
41
- def install_xcconfig(configuration)
42
- # TODO: Remove need to construct a Node Object to do this.
43
- node = Node.new
44
- node.path = configuration.configuration_file
45
- native_group = @context.native_object_for(node)
46
- native_group.new_reference(node.path)
47
- end
48
39
  end
49
40
  end
@@ -1,8 +1,7 @@
1
1
  module Xcake
2
2
  class ProjectGenerator < Generator
3
-
4
3
  def self.dependencies
5
- Generator.repository.select do |g|
4
+ Generator.descendants.select do |g|
6
5
  g != self
7
6
  end
8
7
  end
@@ -11,7 +10,7 @@ module Xcake
11
10
  native_project = @context.native_object_for(project)
12
11
  native_project.save
13
12
  project.run_hook :after_save
14
- puts "Done!"
13
+ puts 'Done!'
15
14
  end
16
15
  end
17
16
  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
+ puts 'Creating 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
@@ -7,25 +7,19 @@ module Xcake
7
7
  # if none are provided and will make sure both the project
8
8
  # and targets have all of the same configurations.
9
9
  class ProjectStructureGenerator < Generator
10
-
11
10
  attr_accessor :project
12
11
 
13
12
  def visit_project(project)
14
-
15
- puts "Resolving Project..."
13
+ puts 'Resolving Project...'
16
14
 
17
15
  @project = project
18
-
19
- @project.configuration :Debug, :debug if @project.configurations_of_type(:debug).count == 0
20
- @project.configuration :Release, :release if @project.configurations_of_type(:release).count == 0
21
16
  end
22
17
 
23
18
  def leave_project(project)
24
19
  end
25
20
 
26
21
  def visit_target(target)
27
-
28
- puts "Resolving target #{target.name}..."
22
+ puts "Resolving target #{target}..."
29
23
 
30
24
  @project.all_configurations.each do |c|
31
25
  target.configuration(c.name, c.type)
@@ -1,13 +1,11 @@
1
1
  module Xcake
2
2
  class SchemeGenerator < Generator
3
-
4
3
  def self.dependencies
5
4
  [TargetGenerator, ConfigurationGenerator]
6
5
  end
7
6
 
8
7
  def visit_project(project)
9
-
10
- puts "Creating User Schemes..."
8
+ puts 'Creating User Schemes...'
11
9
 
12
10
  native_project = @context.native_object_for(project)
13
11
  native_project.recreate_user_schemes
@@ -1,16 +1,13 @@
1
1
  module Xcake
2
-
3
2
  # TODO: In future this should just infer extra targets and add it to the DSL
4
3
  # we should then implement a 2nd pass generator which turns that DSL into
5
4
  # build phases
6
5
  class TargetBuildPhaseGenerator < Generator
7
-
8
6
  def self.dependencies
9
7
  [TargetGenerator, TargetDependencyGenerator]
10
8
  end
11
9
 
12
10
  def visit_target(target)
13
-
14
11
  puts "Generating build phases for #{target}..."
15
12
 
16
13
  native_target = @context.native_object_for(target)
@@ -28,21 +25,22 @@ module Xcake
28
25
  end
29
26
 
30
27
  def create_embed_watchapp_phase(native_target, native_watchapp_target)
31
- puts "Generating embed watch app phase..."
28
+ puts 'Generating embed watch app phase...'
32
29
 
33
- phase = native_target.new_copy_files_build_phase("Embed Watch Content")
34
- phase.dst_path = "$(CONTENTS_FOLDER_PATH)/Watch"
30
+ phase = native_target.new_copy_files_build_phase('Embed Watch Content')
31
+ phase.dst_path = '$(CONTENTS_FOLDER_PATH)/Watch'
35
32
  phase.symbol_dst_subfolder_spec = :products_directory
36
- phase.add_file_reference(native_watchapp_target.product_reference)
33
+ phase.add_file_reference(native_watchapp_target.product_reference, true)
37
34
  phase
38
35
  end
39
36
 
40
37
  def create_embed_watchapp_extension_phase(native_target, native_watchapp_extension_target)
41
- puts "Generating embed watch app extension phase..."
38
+ puts 'Generating embed watch app extension phase...'
39
+ product_reference = native_watchapp_extension_target.product_reference
42
40
 
43
- phase = native_target.new_copy_files_build_phase("Embed App Extensions")
41
+ phase = native_target.new_copy_files_build_phase('Embed App Extensions')
44
42
  phase.symbol_dst_subfolder_spec = :plug_ins
45
- phase.add_file_reference(native_watchapp_extension_target.product_reference)
43
+ phase.add_file_reference(product_reference, true)
46
44
  phase
47
45
  end
48
46
  end
@@ -1,6 +1,5 @@
1
1
  module Xcake
2
2
  class TargetCustomBuildPhaseGenerator < Generator
3
-
4
3
  def self.dependencies
5
4
  [TargetGenerator]
6
5
  end
@@ -1,18 +1,13 @@
1
1
  module Xcake
2
2
  class TargetFileReferenceGenerator < Generator
3
3
  attr_accessor :root_node
4
- attr_accessor :installer_resolution
4
+ attr_accessor :dependency_provider
5
5
 
6
6
  def initialize(context)
7
7
  @context = context
8
8
  @root_node = Node.new
9
9
 
10
- repository = FileReferenceInstaller.repository
11
- puts "Registered Generators #{repository}"
12
-
13
- dependency_provider = DependencyProvider.new(repository)
14
- resolver = Molinillo::Resolver.new(dependency_provider, UI.new)
15
- @installer_resolution = resolver.resolve(repository)
10
+ @dependency_provider = DependencyProvider.new(FileReferenceInstaller)
16
11
  end
17
12
 
18
13
  def self.dependencies
@@ -43,15 +38,12 @@ module Xcake
43
38
  return unless node.path
44
39
  puts "Adding #{node.path}..."
45
40
 
46
- #TODO: Don't use class as name
47
- #TODO: Filter and first generator
48
- #TODO: Debug logs for generator
49
- installer_class = @installer_resolution.tsort.detect do |i|
50
- i.name.can_install_node(node)
41
+ installer_class = @dependency_provider.tsort.detect do |i|
42
+ i.can_install_node(node)
51
43
  end
52
44
 
53
- if installer_class != nil then
54
- installer = installer_class.name.new(context)
45
+ unless installer_class.nil?
46
+ installer = installer_class.new(context)
55
47
  node.accept(installer)
56
48
  end
57
49
  end
@@ -8,7 +8,9 @@ module Xcake
8
8
  puts "Integrating System Frameworks for #{target}..."
9
9
 
10
10
  native_target = @context.native_object_for(target)
11
- native_target.add_system_frameworks(target.system_frameworks) if target.system_frameworks
11
+
12
+ system_frameworks = target.system_frameworks
13
+ native_target.add_system_frameworks(system_frameworks) if system_frameworks
12
14
  end
13
15
  end
14
16
  end
@@ -8,9 +8,9 @@ module Xcake
8
8
  puts "Integrating System Libraries for #{target}..."
9
9
 
10
10
  native_target = @context.native_object_for(target)
11
- if target.system_libraries
12
- native_target.add_system_libraries(target.system_libraries)
13
- end
11
+
12
+ system_libraries = target.system_libraries
13
+ native_target.add_system_libraries(system_libraries) if system_libraries
14
14
  end
15
15
  end
16
16
  end
@@ -1,8 +1,5 @@
1
- require 'molinillo'
2
-
3
1
  module Xcake
4
2
  class Generator
5
-
6
3
  include Dependency
7
4
  include Plugin
8
5
  include Visitor
@@ -12,5 +9,9 @@ module Xcake
12
9
  def initialize(context)
13
10
  self.context = context
14
11
  end
12
+
13
+ def self.plugins_location
14
+ "#{File.dirname(__FILE__)}/generator/*.rb"
15
+ end
15
16
  end
16
17
  end
@@ -1,5 +1,5 @@
1
- require "claide"
2
- require "tty"
1
+ require 'claide'
2
+ require 'colored'
3
3
 
4
4
  # Indicates an user error.
5
5
  #
@@ -10,8 +10,7 @@ module Xcake
10
10
  include CLAide::InformativeError
11
11
 
12
12
  def message
13
- pastel = Pastel.new
14
- pastel.red "[!] #{super}"
13
+ "[!] #{super}".red
15
14
  end
16
15
  end
17
16
  end
data/lib/xcake/node.rb CHANGED
@@ -7,7 +7,6 @@ module Xcake
7
7
  # This tracks which target the node should be
8
8
  # added to.
9
9
  class Node
10
-
11
10
  include Visitable
12
11
 
13
12
  # @return [String] the component of this node in the path.
@@ -45,9 +44,8 @@ module Xcake
45
44
  # target to add for the child nodes
46
45
  #
47
46
  def create_children_with_path(path, target)
48
-
49
47
  components = path.split('/').keep_if do |c|
50
- c != "."
48
+ c != '.'
51
49
  end
52
50
 
53
51
  create_children_with_components(components, target)
@@ -63,9 +61,8 @@ module Xcake
63
61
  # target to remove for child nodes
64
62
  #
65
63
  def remove_children_with_path(path, target)
66
-
67
64
  components = path.split('/').keep_if do |c|
68
- c != "."
65
+ c != '.'
69
66
  end
70
67
 
71
68
  remove_children_with_components(components, target)
@@ -74,23 +71,22 @@ module Xcake
74
71
  protected
75
72
 
76
73
  def create_children_with_components(components, target)
77
-
78
74
  component = components.shift
79
75
  child = children.find do |c|
80
76
  c.component == component
81
77
  end
82
78
 
83
- if child == nil
79
+ if child.nil?
84
80
 
85
81
  child = Node.new
86
82
 
87
83
  child.component = component
88
84
 
89
- if self.path
90
- child.path = "#{self.path}/#{component}"
91
- else
92
- child.path = "#{component}"
93
- end
85
+ child.path = if path
86
+ "#{path}/#{component}"
87
+ else
88
+ component.to_s
89
+ end
94
90
 
95
91
  child.parent = self
96
92
 
@@ -105,14 +101,13 @@ module Xcake
105
101
  end
106
102
 
107
103
  def remove_children_with_components(components, target)
108
-
109
104
  component = components.shift
110
105
 
111
106
  child = children.find do |c|
112
107
  c.component == component
113
108
  end
114
109
 
115
- if child != nil
110
+ unless child.nil?
116
111
 
117
112
  child.remove_children_with_components(components, target)
118
113
 
@@ -122,8 +117,8 @@ module Xcake
122
117
 
123
118
  children.keep_if do |c|
124
119
  c != child ||
125
- c.children.count > 0 ||
126
- c.targets.count > 0
120
+ c.children.count > 0 ||
121
+ c.targets.count > 0
127
122
  end
128
123
  end
129
124
  end
@@ -131,7 +126,6 @@ module Xcake
131
126
  public
132
127
 
133
128
  def accept(visitor)
134
-
135
129
  visitor.visit(self)
136
130
 
137
131
  children.each do |c|
data/lib/xcake/plugin.rb CHANGED
@@ -1,25 +1,17 @@
1
- # TODO: Figure out a more robust Plugin system
2
- # - Needs to handle subclass of subclass.....
3
- # - Needs to have better mixin hiearchy
4
-
5
1
  module Xcake
6
2
  module Plugin
7
- module ClassMethods
8
- def repository
9
- @repository ||= []
10
- end
3
+ def self.included(base)
4
+ base.extend ClassMethods
5
+ end
11
6
 
12
- def inherited(klass)
13
- repository << klass
7
+ module ClassMethods
8
+ def load_plugins
9
+ Dir[plugins_location].each { |file| require file }
10
+ descendants
14
11
  end
15
12
 
16
- def register_plugin(klass)
17
- repository << klass
13
+ def plugins_location
18
14
  end
19
15
  end
20
-
21
- def self.included(klass)
22
- klass.extend ClassMethods # Somewhat controversial
23
- end
24
16
  end
25
17
  end
@@ -1,4 +1,4 @@
1
- require "hooks"
1
+ require 'hooks'
2
2
 
3
3
  module Xcake
4
4
  class Project