xcake 0.6.25 → 0.7.0

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile.lock +10 -10
  4. data/README.md +4 -0
  5. data/bin/xcake +1 -1
  6. data/docs/Cakefile.md +23 -4
  7. data/docs/Sample/Cakefile +365 -0
  8. data/lib/xcake/context/xcodeproj_context.rb +3 -4
  9. data/lib/xcake/generator/configuration_generator.rb +1 -1
  10. data/lib/xcake/generator/target_file_reference_generator.rb +24 -30
  11. data/lib/xcake/informative.rb +1 -1
  12. data/lib/xcake/path_classifier.rb +66 -0
  13. data/lib/xcake/project/sugar.rb +26 -0
  14. data/lib/xcake/project.rb +0 -1
  15. data/lib/xcake/target/configurable.rb +38 -0
  16. data/lib/xcake/target.rb +0 -39
  17. data/lib/xcake/ui.rb +2 -3
  18. data/lib/xcake/version.rb +1 -1
  19. data/lib/xcake/xcode/project.rb +35 -43
  20. data/lib/xcake/xcodeproj_ext/PBXGroup.rb +41 -0
  21. data/lib/xcake/xcodeproj_ext/PBXNativeTarget.rb +14 -0
  22. data/lib/xcake.rb +6 -2
  23. data/xcake.gemspec +1 -1
  24. metadata +10 -14
  25. data/lib/xcake/file_reference_installer/compile_source_file_reference_installer.rb +0 -15
  26. data/lib/xcake/file_reference_installer/compile_xcdatamodeld_file_reference_installer.rb +0 -22
  27. data/lib/xcake/file_reference_installer/copy_resources_file_reference_installer.rb +0 -25
  28. data/lib/xcake/file_reference_installer/copy_xcassets_file_reference_installer.rb +0 -22
  29. data/lib/xcake/file_reference_installer/header_file_reference_installer.rb +0 -11
  30. data/lib/xcake/file_reference_installer/link_library_file_reference_installer.rb +0 -21
  31. data/lib/xcake/file_reference_installer.rb +0 -83
  32. data/lib/xcake/node.rb +0 -138
  33. /data/{_hound.yml → hound.yml} +0 -0
  34. /data/{_rubocop.yml → rubocop.yml} +0 -0
  35. /data/{_rubocop_general.yml → rubocop_general.yml} +0 -0
@@ -1,83 +0,0 @@
1
- require 'pathname'
2
-
3
- module Xcake
4
- # This generator handles adding nodes
5
- # to the project and creating a build phase
6
- # for it.
7
- #
8
- class FileReferenceInstaller
9
- include Dependency
10
- include Plugin
11
- include Visitor
12
-
13
- attr_accessor :context
14
-
15
- def initialize(context)
16
- @context = context
17
- end
18
-
19
- def self.plugins_location
20
- "#{File.dirname(__FILE__)}/file_reference_installer/*.rb"
21
- end
22
-
23
- # This should be overidden
24
- # by subclasses.
25
- #
26
- # @param [Node] the node
27
- #
28
- # @return [Boolean] true if build phase can handle the node.
29
- #
30
- def self.can_install_node(_node)
31
- true
32
- end
33
-
34
- # Adds file reference to the target.
35
- #
36
- # This should be overidden in subclasses
37
- # to add the file reference the correct
38
- # build phase.
39
- #
40
- # @param [PBXFileReference] the file reference
41
- #
42
- # @param [PBXTarget] the xcode target
43
- #
44
- def add_file_reference_to_target(_file_reference, _target)
45
- end
46
-
47
- # @!group Visitable
48
-
49
- def visit_node(node)
50
-
51
- # Tweak this to respect localizable files
52
- #
53
- # If ".lproj" is in file path
54
- # - Create variant group from File Component
55
- # - Files added to this group should have their path to be relative from
56
- # the first non-variatn group
57
- #
58
- # Otherwise normal behaviour
59
- native_group = @context.native_object_for(node)
60
-
61
- # Make sure this is the correct parent in variant groups
62
- #
63
- # TODO: Remove this duplication of the .lproj and node path code.
64
- # Also remove need for the name hack.
65
- if node.parent.component.include?(".lproj")
66
- group_path = Pathname.new node.parent.parent.path
67
- else
68
- group_path = Pathname.new node.parent.path
69
- end
70
-
71
- file_path = Pathname.new node.path
72
-
73
- node_location = file_path.relative_path_from group_path
74
- file_reference = native_group.new_reference(node_location)
75
-
76
- ######
77
-
78
- node.targets.each do |t|
79
- add_file_reference_to_target(file_reference, t)
80
- end
81
- end
82
- end
83
- end
data/lib/xcake/node.rb DELETED
@@ -1,138 +0,0 @@
1
- require 'xcodeproj'
2
-
3
- module Xcake
4
- # This class is used to represent a
5
- # node (File or Directory) in the File System.
6
- #
7
- # This tracks which target the node should be
8
- # added to.
9
- class Node
10
- include Visitable
11
-
12
- # @return [String] the component of this node in the path.
13
- #
14
- attr_accessor :component
15
-
16
- # @return [String] the path to this node relative to the Cakefile.
17
- #
18
- attr_accessor :path
19
-
20
- # @return [String] the parent node.
21
- #
22
- attr_accessor :parent
23
-
24
- # @return [Array<Node>] the child nodes.
25
- #
26
- attr_accessor :children
27
-
28
- # @return [Array<PBXNativeTarget>] the targets for the node
29
- #
30
- attr_accessor :targets
31
-
32
- def initialize
33
- self.children = []
34
- self.targets = []
35
- end
36
-
37
- # Creates child nodes for the path and
38
- # target.
39
- #
40
- # @param [String] path
41
- # path to create children for
42
- #
43
- # @param [PBXNativeTarget] target
44
- # target to add for the child nodes
45
- #
46
- def create_children_with_path(path, target)
47
- components = path.split('/').keep_if do |c|
48
- c != '.'
49
- end
50
-
51
- create_children_with_components(components, target)
52
- end
53
-
54
- # Removes child nodes for the path and
55
- # target.
56
- #
57
- # @param [String] path
58
- # path to remove children for
59
- #
60
- # @param [PBXNativeTarget] target
61
- # target to remove for child nodes
62
- #
63
- def remove_children_with_path(path, target)
64
- components = path.split('/').keep_if do |c|
65
- c != '.'
66
- end
67
-
68
- remove_children_with_components(components, target)
69
- end
70
-
71
- protected
72
-
73
- def create_children_with_components(components, target)
74
- component = components.shift
75
- child = children.find do |c|
76
- c.component == component
77
- end
78
-
79
- if child.nil?
80
-
81
- child = Node.new
82
-
83
- child.component = component
84
-
85
- child.path = if path
86
- "#{path}/#{component}"
87
- else
88
- component.to_s
89
- end
90
-
91
- child.parent = self
92
-
93
- children << child
94
- end
95
-
96
- child.targets << target unless child.targets.include? target
97
-
98
- child.create_children_with_components(components, target) if components.count > 0
99
-
100
- child
101
- end
102
-
103
- def remove_children_with_components(components, target)
104
- component = components.shift
105
-
106
- child = children.find do |c|
107
- c.component == component
108
- end
109
-
110
- unless child.nil?
111
-
112
- child.remove_children_with_components(components, target)
113
-
114
- child.targets.keep_if do |t|
115
- t != target
116
- end
117
-
118
- children.keep_if do |c|
119
- c != child ||
120
- c.children.count > 0 ||
121
- c.targets.count > 0
122
- end
123
- end
124
- end
125
-
126
- public
127
-
128
- def accept(visitor)
129
- visitor.visit(self)
130
-
131
- children.each do |c|
132
- c.accept(visitor)
133
- end
134
-
135
- visitor.leave(self)
136
- end
137
- end
138
- end
File without changes
File without changes
File without changes