xcake 0.6.19 → 0.6.20

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6a20b9a1ed07a07a5d8f0120654dbd3fb3039ea
4
- data.tar.gz: f605d186b78d8e598b2a91cf254a007610daf672
3
+ metadata.gz: 10ab3f2002a23f912cbc8a2eac97c2810d0eedec
4
+ data.tar.gz: 32df4ea91d423def8d317897ba5dbcd9e666a4e7
5
5
  SHA512:
6
- metadata.gz: 9a9ac89d9458724f4765bac32db2150e19f35c90a1e36e0908d82306e93e6fded9e8f39324eaaa43bfef53e173fe6afdf88ba2ff3d2ab0cfac6fb2bb56b781d0
7
- data.tar.gz: 518834da68df9c79b9a2633bbaa8af13b1bdbbabbc273192a6ccc9fbe93c102ac86bc8e2f2f50456925bce8c7becab392ade7f9babb11d3eb1889a80ee687b8f
6
+ metadata.gz: ff9b96ac30820b273bc8c2ee45c8f7c17d17d976eacfe36b8c54c0b31dc8ebb64d30f67a2a55244479bc3ef5bc8514f7eac3cc70c50e1e54af734b0dbbc5bd4f
7
+ data.tar.gz: f6bb209ab0f2e521ad862648c9dbca5e4a0d3bbe923648d78939e4195d4055d71105cbbb153515cf59ff09c817c08ad933a42ed7090a735f4e8e4250bc6c6e79
data/.travis.yml CHANGED
@@ -6,4 +6,3 @@ rvm:
6
6
  - 2.1.6
7
7
  - 2.2.2
8
8
  before_install: gem install bundler -v 1.10.6
9
- cache: bundler
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ v0.6.20
2
+ =======
3
+ - When adding a file to a group, Xcode will now open the correct folder.
4
+ - Adds support for adding third-party frameworks.
5
+ - Fixes `all_configurations` not returning all configurations when using implicit configurations.
6
+ - Names of the implicit configurations match the default configurations for Xcode projects.
7
+ - Fixes out of date documentation.
8
+ - Fixes typos and out of date API used in `xcake init` template.
9
+ - Removes dependency on `Molinillo` for internal dependency resolution.
10
+ - Fixes issues with adding XCConfig.
11
+
1
12
  v0.6.19
2
13
  =======
3
14
  - Uses the reccomended code signing settings from Apple.
@@ -31,7 +42,7 @@ v0.6.13
31
42
 
32
43
  v0.6.12
33
44
  =======
34
- - Fixes issues when resolving project if sensible default configurations.
45
+ - Fixes issues when resolving project with implicit configurations.
35
46
 
36
47
  v0.6.11
37
48
  =======
data/Gemfile.lock CHANGED
@@ -1,11 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xcake (0.6.19)
4
+ xcake (0.6.20)
5
5
  claide (>= 0.9.1, < 2.0)
6
+ colored
6
7
  hooks (~> 0.4.1)
7
- molinillo
8
- tty (~> 0.3.2)
9
8
  xcodeproj (>= 0.20, < 2.0.0)
10
9
 
11
10
  GEM
@@ -29,20 +28,14 @@ GEM
29
28
  tins (~> 1.6.0)
30
29
  diff-lcs (1.2.5)
31
30
  docile (1.1.5)
32
- equatable (0.5.0)
33
31
  hooks (0.4.1)
34
32
  uber (~> 0.0.14)
35
33
  i18n (0.7.0)
36
34
  json (1.8.3)
37
35
  method_source (0.8.2)
38
36
  minitest (5.9.0)
39
- molinillo (0.4.5)
40
- necromancer (0.3.0)
41
37
  parser (2.3.1.0)
42
38
  ast (~> 2.2)
43
- pastel (0.5.3)
44
- equatable (~> 0.5.0)
45
- tty-screen (~> 0.4.3)
46
39
  powerpack (0.1.1)
47
40
  pry (0.10.3)
48
41
  coderay (~> 1.1.0)
@@ -63,12 +56,14 @@ GEM
63
56
  diff-lcs (>= 1.2.0, < 2.0)
64
57
  rspec-support (~> 3.4.0)
65
58
  rspec-support (3.4.1)
66
- rubocop (0.39.0)
67
- parser (>= 2.3.0.7, < 3.0)
59
+ rubocop (0.40.0)
60
+ parser (>= 2.3.1.0, < 3.0)
68
61
  powerpack (~> 0.1)
69
62
  rainbow (>= 1.99.1, < 3.0)
70
63
  ruby-progressbar (~> 1.7)
71
64
  unicode-display_width (~> 1.0, >= 1.0.1)
65
+ rubocop-git (0.1.1)
66
+ rubocop (>= 0.24.1)
72
67
  ruby-progressbar (1.8.1)
73
68
  simplecov (0.11.2)
74
69
  docile (~> 1.1.0)
@@ -81,47 +76,10 @@ GEM
81
76
  thor (0.19.1)
82
77
  thread_safe (0.3.5)
83
78
  tins (1.6.0)
84
- tty (0.3.2)
85
- equatable (~> 0.5.0)
86
- pastel (~> 0.5.1)
87
- tty-cursor (~> 0.1.0)
88
- tty-pager (~> 0.3.0)
89
- tty-platform (~> 0.1.0)
90
- tty-progressbar (~> 0.7.0)
91
- tty-prompt (~> 0.2.0)
92
- tty-screen (~> 0.4.0)
93
- tty-spinner (~> 0.1.0)
94
- tty-table (~> 0.4.0)
95
- tty-which (~> 0.1.0)
96
- tty-cursor (0.1.0)
97
- tty-pager (0.3.0)
98
- tty-screen (~> 0.4.0)
99
- tty-which (~> 0.1.0)
100
- verse (~> 0.4.0)
101
- tty-platform (0.1.0)
102
- tty-progressbar (0.7.0)
103
- tty-screen (~> 0.4.0)
104
- tty-prompt (0.2.0)
105
- necromancer (~> 0.3.0)
106
- pastel (~> 0.5.1)
107
- tty-platform (~> 0.1.0)
108
- tty-screen (0.4.3)
109
- tty-spinner (0.1.0)
110
- tty-table (0.4.0)
111
- equatable (~> 0.5.0)
112
- necromancer (~> 0.3.0)
113
- pastel (~> 0.5.1)
114
- tty-screen (~> 0.4.0)
115
- unicode_utils (~> 1.4.0)
116
- verse (~> 0.4.0)
117
- tty-which (0.1.0)
118
79
  tzinfo (1.2.2)
119
80
  thread_safe (~> 0.1)
120
81
  uber (0.0.15)
121
82
  unicode-display_width (1.0.5)
122
- unicode_utils (1.4.0)
123
- verse (0.4.0)
124
- unicode_utils (~> 1.4.0)
125
83
  xcodeproj (1.0.0)
126
84
  activesupport (>= 3)
127
85
  claide (>= 1.0.0, < 2.0)
@@ -137,9 +95,9 @@ DEPENDENCIES
137
95
  pry (~> 0.10)
138
96
  rake (~> 10.0)
139
97
  rspec (~> 3.4.0)
140
- rubocop (~> 0.39.0)
98
+ rubocop-git (~> 0.1.1)
141
99
  xcake!
142
100
  yard (~> 0.8)
143
101
 
144
102
  BUNDLED WITH
145
- 1.12.1
103
+ 1.11.2
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/fastlane/fastlane/blob/master/LICENSE)
5
5
  [![Build Status](https://img.shields.io/travis/jcampbell05/xcake/master.svg?style=flat)](https://travis-ci.org/jcampbell05/xcake)
6
6
  [![Test Coverage](https://img.shields.io/coveralls/jcampbell05/xcake/master.svg)](https://coveralls.io/github/jcampbell05/xcake)
7
- [![Gem](https://raw.githubusercontent.com/fastlane/fastlane/master/fastlane/lib/fastlane/plugins/templates/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-xcake)
7
+ [![Gem](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-xcake)
8
8
 
9
9
  ###Xcode projects made a piece of cake.
10
10
 
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/_rubocop.yml CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  inherit_from: .rubocop_general.yml
6
6
 
7
- # e.g.
7
+ # e.g.
8
8
  # def self.is_supported?(platform)
9
9
  # we may never use `platform`
10
10
  Lint/UnusedMethodArgument:
data/bin/console CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
3
+ require 'bundler/setup'
4
4
 
5
5
  # You can add fixtures and/or initialization code here to make experimenting
6
6
  # with your gem easier. You can also use a different console, if you like.
7
7
 
8
8
  # (If you use this, don't forget to add pry to your Gemfile!)
9
- require "pry"
9
+ require 'pry'
10
10
  Pry.start
data/bin/xcake CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "xcake"
3
+ require 'xcake'
4
4
 
5
5
  Xcake::Command.run(ARGV)
data/docs/Cakefile.md CHANGED
@@ -51,7 +51,7 @@ project.project_name = "Project"
51
51
  Sets the filename for the project
52
52
 
53
53
  ```ruby
54
- project.project_name = "Project"
54
+ project.name = "Project"
55
55
  ```
56
56
 
57
57
  #### Class Prefix
@@ -98,7 +98,7 @@ We can also specify a testing targets for other targets as well:
98
98
 
99
99
  ```ruby
100
100
  application_for :mac, 8.0 do |target|
101
- unit_tests_for target
101
+ unit_tests_for target
102
102
  end
103
103
  ```
104
104
 
@@ -110,14 +110,14 @@ If you want to manually control configuration of unit tests targets (and/or have
110
110
  application_for :mac, 8.0 do |target|
111
111
 
112
112
  unit_tests_for target do |test_target|
113
-
113
+
114
114
  test_target.name = "MyAwesomeTests"
115
115
  test_target.include_files = ["Tests/**/*.*"]
116
-
116
+
117
117
  # configure any other target-related properties
118
118
  # as you would do with normal target
119
119
 
120
- end
120
+ end
121
121
  end
122
122
  ```
123
123
 
@@ -258,6 +258,8 @@ end
258
258
  We can apply a particular shared setting across all of our configurations.
259
259
  Xcake provides a simply way of doing this via an "all" configuration.
260
260
 
261
+ This will return an array of all of the currently declared configurations.
262
+
261
263
  ```ruby
262
264
  all_configurations.each { |c| c.supported_devices = :iphone_only }
263
265
  ```
@@ -289,9 +291,6 @@ it also has its own hiearchy of settings, which are in the following order
289
291
  - Default Settings
290
292
  These are the sensible defaults xcake provides for the configuration.
291
293
 
292
- - All Settings
293
- These are any settings set via the "All" configuration
294
-
295
294
  - Custom Settings
296
295
  These are the settings set directly on the configuration.
297
296
 
@@ -305,15 +304,23 @@ Sets the name of the configuration
305
304
  configuration.name = "Release"
306
305
  ```
307
306
 
307
+ #### Configuration File
308
+
309
+ Sets the path to a XCConfig file to inherit build settings from.
310
+
311
+ ```ruby
312
+ configuration.configuration_file = "Files/Settings.xcconfig"
313
+ ```
314
+
308
315
  #### Build Settings
309
316
 
310
317
  A hash of all the build settings for a configuration
311
318
 
312
319
  ```ruby
313
- configuration.build_settings["ENABLE_BITCODE"] = false
320
+ configuration.settings["ENABLE_BITCODE"] = false
314
321
  ```
315
322
 
316
- ###Build Settings Shortcuts
323
+ ### Build Settings Shortcuts
317
324
 
318
325
  Xcake also provides some shortcuts for some more common build settings.
319
326
 
@@ -35,6 +35,7 @@ This document describes the level of support Xcake has for the various aspects o
35
35
  - Specify build settings
36
36
  - Used to create build configuration for project and targets.
37
37
  - Used to create schemes for applications
38
+ - Set XCConfig to inherit settings from.
38
39
 
39
40
  ## Scheme
40
41
 
@@ -1,6 +1,6 @@
1
1
  # xcake `fastlane` Plugin
2
2
 
3
- [![Gem](https://raw.githubusercontent.com/fastlane/fastlane/master/fastlane/lib/fastlane/plugins/templates/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-xcake)
3
+ [![Gem](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-xcake)
4
4
 
5
5
  ## Getting Started
6
6
 
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -6,12 +6,12 @@ require 'fastlane/plugin/xcake/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'fastlane-plugin-xcake'
8
8
  spec.version = Fastlane::Xcake::VERSION
9
- spec.authors = ["James Campbell"]
10
- spec.email = ["james@supmenow.com"]
9
+ spec.authors = ['James Campbell']
10
+ spec.email = ['james@supmenow.com']
11
11
 
12
- spec.summary = %q{DSL for Xcode Projects.}
13
- spec.description = %q{Create your Xcode projects automatically using a stupid simple DSL.}
14
- spec.homepage = "https://github.com/jcampbell05/xcake/"
12
+ spec.summary = 'DSL for Xcode Projects.'
13
+ spec.description = 'Create your Xcode projects automatically using a stupid simple DSL.'
14
+ spec.homepage = 'https://github.com/jcampbell05/xcake/'
15
15
  spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -1,7 +1,7 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  class XcakeAction < Action
4
- def self.run(params)
4
+ def self.run(_params)
5
5
  require 'xcake'
6
6
 
7
7
  if defined?(::Xcake::Command::Make)
@@ -14,7 +14,7 @@ module Fastlane
14
14
  end
15
15
 
16
16
  def self.description
17
- "Runs `xcake` for the project"
17
+ 'Runs `xcake` for the project'
18
18
  end
19
19
 
20
20
  def self.available_options
@@ -27,7 +27,7 @@ module Fastlane
27
27
  end
28
28
 
29
29
  def self.authors
30
- ["jcampbell05"]
30
+ ['jcampbell05']
31
31
  end
32
32
  end
33
33
  end
@@ -1,15 +1,15 @@
1
1
  module Xcake
2
2
  class Command
3
3
  class Init < Command
4
- self.summary = "Initilises an example Cakefile for creating a project"
5
- self.description = "Initilises an example Cakefile for creating a project"
4
+ self.summary = 'Initilises an example Cakefile for creating a project'
5
+ self.description = 'Initilises an example Cakefile for creating a project'
6
6
 
7
7
  def run
8
8
  cakefile_path = "#{File.dirname(__FILE__)}/../resources/Cakefile"
9
9
  cakefile_contents = File.read(cakefile_path)
10
- File.write("Cakefile", cakefile_contents)
10
+ File.write('Cakefile', cakefile_contents)
11
11
 
12
- puts "Open Cakefile to edit and run xcake make to get your xcode project"
12
+ puts 'Open Cakefile to edit and run xcake make to get your xcode project'
13
13
  end
14
14
  end
15
15
  end
@@ -1,11 +1,8 @@
1
- require 'molinillo'
2
-
3
- #TODO: Reduce lines of code here :)
4
1
  module Xcake
5
2
  class Command
6
3
  class Make < Command
7
- self.summary = "Makes the Xcode project from a Cakefile"
8
- self.description = "Makes the Xcode project from a Cakefile"
4
+ self.summary = 'Makes the Xcode project from a Cakefile'
5
+ self.description = 'Makes the Xcode project from a Cakefile'
9
6
 
10
7
  def run
11
8
  file_path = "#{Dir.pwd}/Cakefile"
@@ -14,25 +11,17 @@ module Xcake
14
11
  raise Xcake::Informative, "Couldn't find Cakefile"
15
12
  end
16
13
 
17
- puts "Reading Cakefile..."
14
+ puts 'Reading Cakefile...'
18
15
  file_contents = File.read(file_path)
19
16
 
20
17
  project = Project.new
21
- project.instance_eval(file_contents)
18
+ project.instance_eval(file_contents, file_path)
22
19
 
23
20
  context = XcodeprojContext.new
24
21
 
25
- #TODO: Debug logs for generator
26
- repository = Generator.repository
27
- #puts "Registered Generators #{repository}"
28
-
29
- #TODO: Don't use class as name
30
- dependency_provider = DependencyProvider.new(repository)
31
- resolver = Molinillo::Resolver.new(dependency_provider, UI.new)
32
- resolution = resolver.resolve(Generator.repository)
33
- resolution.tsort.map do |g|
34
- #puts "Running #{g.name}..."
35
- generator = g.name.new(context)
22
+ dependency_provider = DependencyProvider.new(Generator)
23
+ dependency_provider.tsort.each do |g|
24
+ generator = g.new(context)
36
25
  project.accept(generator)
37
26
  end
38
27
  end
data/lib/xcake/command.rb CHANGED
@@ -1,15 +1,14 @@
1
- require "claide"
1
+ require 'claide'
2
2
 
3
3
  module Xcake
4
4
  class Command < CLAide::Command
5
-
6
- require "xcake/command/init"
7
- require "xcake/command/make"
5
+ require 'xcake/command/init'
6
+ require 'xcake/command/make'
8
7
 
9
8
  self.abstract_command = true
10
- self.command = "xcake"
9
+ self.command = 'xcake'
11
10
  self.version = VERSION
12
- self.description = "Create and maintain Xcode project files easily."
11
+ self.description = 'Create and maintain Xcode project files easily.'
13
12
  self.plugin_prefixes = %w(claide xcake)
14
13
  end
15
14
  end
@@ -12,7 +12,6 @@ module Xcake
12
12
  # end
13
13
  #
14
14
  module Configurable
15
-
16
15
  private
17
16
 
18
17
  attr_accessor :configurations
@@ -25,14 +24,28 @@ module Xcake
25
24
  if @configurations.nil?
26
25
  @configurations = []
27
26
 
28
- parent_configurable.all_configurations.each do |c|
29
- configuration(c.name, c.type)
30
- end if parent_configurable
27
+ if parent_configurable && parent_configurable.all_configurations
28
+ copy_parent_configurations
29
+ else
30
+ debug_configuration :Debug
31
+ release_configuration :Release
32
+ end
33
+
31
34
  end
32
35
 
33
36
  @configurations
34
37
  end
35
38
 
39
+ private
40
+
41
+ def copy_parent_configurations
42
+ parent_configurable.all_configurations.each do |c|
43
+ configuration(c.name, c.type)
44
+ end if parent_configurable
45
+ end
46
+
47
+ public
48
+
36
49
  # @param [Array<Configuration>] new list of configurations to set
37
50
  #
38
51
  def all_configurations=(configurations)
@@ -42,7 +55,9 @@ module Xcake
42
55
  # @return [Array<Configuration>] list of configurations of a type
43
56
  #
44
57
  def configurations_of_type(type)
45
- all_configurations.select do |c|
58
+ return [] if @configurations.nil?
59
+
60
+ @configurations.select do |c|
46
61
  c.type == type
47
62
  end
48
63
  end
@@ -76,8 +91,7 @@ module Xcake
76
91
  #
77
92
  # @return [Configuration] the new or existing configuration
78
93
  #
79
- def configuration(name, type, &block)
80
-
94
+ def configuration(name, type)
81
95
  default_settings = default_settings_for_type(type)
82
96
  configurations = configurations_of_type(type)
83
97
 
@@ -94,14 +108,14 @@ module Xcake
94
108
  name = type.to_s.capitalize if name.nil?
95
109
 
96
110
  build_configuration = Configuration.new(name) do |b|
97
-
98
111
  b.type = type
99
112
  b.settings.merge!(default_settings)
100
113
 
101
- block.call(b) if block_given?
114
+ yield(b) if block_given?
102
115
  end
103
116
 
104
- all_configurations << build_configuration
117
+ @configurations ||= []
118
+ @configurations << build_configuration
105
119
  end
106
120
 
107
121
  build_configuration
@@ -29,7 +29,7 @@ module Xcake
29
29
  def initialize(settings, key)
30
30
  @settings = settings
31
31
  @key = key
32
- @settings[@key] ||= ["$(inherited)"]
32
+ @settings[@key] ||= ['$(inherited)']
33
33
  end
34
34
 
35
35
  # The subscript operator is used to define the preprocessor defination
@@ -4,10 +4,10 @@ module Xcake
4
4
  # supported_devices setting
5
5
  #
6
6
  SUPPORTED_DEVICES = {
7
- iphone_only: "1",
8
- ipad_only: "2",
9
- universal: "1,2"
10
- }
7
+ iphone_only: '1',
8
+ ipad_only: '2',
9
+ universal: '1,2'
10
+ }.freeze
11
11
 
12
12
  # Convienence method to easily set the
13
13
  # supported devices for a application.
@@ -25,14 +25,14 @@ module Xcake
25
25
  #
26
26
  def supported_devices=(devices)
27
27
  supported_devices = SUPPORTED_DEVICES[devices]
28
- settings["TARGETED_DEVICE_FAMILY"] = supported_devices
28
+ settings['TARGETED_DEVICE_FAMILY'] = supported_devices
29
29
  end
30
30
 
31
31
  # Convienience method to easily set the
32
32
  # product's bundle identifier
33
33
  #
34
34
  def product_bundle_identifier=(identifier)
35
- settings["PRODUCT_BUNDLE_IDENTIFIER"] = identifier
35
+ settings['PRODUCT_BUNDLE_IDENTIFIER'] = identifier
36
36
  end
37
37
 
38
38
  # Convienence method to easily set preprocessor directives
@@ -40,7 +40,7 @@ module Xcake
40
40
  def preprocessor_definitions
41
41
  PreprocessorDefinitionsSettingProxy.new(
42
42
  settings,
43
- "GCC_PREPROCESSOR_DEFINITIONS"
43
+ 'GCC_PREPROCESSOR_DEFINITIONS'
44
44
  )
45
45
  end
46
46
  end
@@ -11,7 +11,6 @@ module Xcake
11
11
  # target.
12
12
  #
13
13
  class Configuration
14
-
15
14
  include Visitable
16
15
 
17
16
  # @return [String] the name of the configuration
@@ -30,7 +29,7 @@ module Xcake
30
29
  #
31
30
  attr_accessor :settings
32
31
 
33
- # @return [String] the name of the xcconfig file to use for
32
+ # @return [String] the path of the xcconfig file to use for
34
33
  # the build configuration.
35
34
  #
36
35
  # This is resolved to a PBXFileReference.
@@ -51,11 +50,11 @@ module Xcake
51
50
  # c.settings["INFO_PLIST"] = "./myapp/info.plist"
52
51
  # end
53
52
  #
54
- def initialize(name, &block)
53
+ def initialize(name)
55
54
  self.name = name.to_s
56
55
  self.settings = {}
57
56
 
58
- block.call(self) if block_given?
57
+ yield(self) if block_given?
59
58
  end
60
59
  end
61
60
  end
@@ -1,8 +1,7 @@
1
- require "xcodeproj"
1
+ require 'xcodeproj'
2
2
 
3
3
  module Xcake
4
4
  class XcodeprojContext
5
-
6
5
  include Context
7
6
 
8
7
  attr_accessor :project
@@ -18,12 +17,12 @@ module Xcake
18
17
  when Node
19
18
  create_object_for_node(dsl_object)
20
19
  else
21
- abort "DSL Object not recognized!"
20
+ abort 'DSL Object not recognized!'
22
21
  end
23
22
  end
24
23
 
25
24
  def create_object_for_project(project)
26
- puts "Creating Project..."
25
+ puts 'Creating Project...'
27
26
 
28
27
  # TODO: Make setup of project testable
29
28
  @project = Xcode::Project.new("./#{project.name}.xcodeproj", true)
@@ -32,18 +31,22 @@ module Xcake
32
31
  end
33
32
 
34
33
  def create_object_for_target(target)
35
- puts "Creating Target..."
34
+ puts 'Creating Target...'
36
35
  @project.new_target(target)
37
36
  end
38
37
 
39
38
  def create_object_for_configuration(configuration)
40
- puts "Creating Configuration..."
39
+ puts 'Creating Configuration...'
41
40
  @project.new_configuration(configuration)
42
41
  end
43
42
 
44
43
  def create_object_for_node(node)
45
- puts "Creating Group..."
44
+ puts 'Creating Group...'
46
45
  @project.new_group(node)
47
46
  end
47
+
48
+ def file_reference_for_path(path)
49
+ @project.reference_for_path(path) || @project.new_file_reference(path)
50
+ end
48
51
  end
49
52
  end
data/lib/xcake/context.rb CHANGED
@@ -11,5 +11,8 @@ module Xcake
11
11
  def native_object_for(dsl_object)
12
12
  object_hash[dsl_object] ||= create_object_for(dsl_object)
13
13
  end
14
+
15
+ def file_reference_for_path(path)
16
+ end
14
17
  end
15
18
  end