framework-x-xcodeprojgen 0.1.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 (38) hide show
  1. data/README.markdown +12 -0
  2. data/Rakefile +45 -0
  3. data/TODO +8 -0
  4. data/bin/xcodeprojgen +14 -0
  5. data/lib/xcode.rb +56 -0
  6. data/lib/xcode/frameworks.rb +100 -0
  7. data/lib/xcode/iphone.rb +29 -0
  8. data/lib/xcode/iphone_build_configurations.rb +48 -0
  9. data/lib/xcode/pbx_build_file.rb +25 -0
  10. data/lib/xcode/pbx_build_phase.rb +25 -0
  11. data/lib/xcode/pbx_copy_files_build_phase.rb +7 -0
  12. data/lib/xcode/pbx_file_reference.rb +66 -0
  13. data/lib/xcode/pbx_formatter.rb +52 -0
  14. data/lib/xcode/pbx_frameworks_build_phase.rb +7 -0
  15. data/lib/xcode/pbx_group.rb +47 -0
  16. data/lib/xcode/pbx_native_target.rb +24 -0
  17. data/lib/xcode/pbx_proj.rb +21 -0
  18. data/lib/xcode/pbx_project.rb +29 -0
  19. data/lib/xcode/pbx_resources_build_phase.rb +7 -0
  20. data/lib/xcode/pbx_sources_build_phase.rb +7 -0
  21. data/lib/xcode/xc_build_configuration.rb +20 -0
  22. data/lib/xcode/xc_configuration_list.rb +20 -0
  23. data/lib/xcodeproj_gen.rb +140 -0
  24. data/test/acceptance/command_line_foundation_test.rb +33 -0
  25. data/test/acceptance/command_line_in_c_test.rb +33 -0
  26. data/test/acceptance/test_helper.rb +18 -0
  27. data/test/unit/test_helper.rb +13 -0
  28. data/test/unit/xcode/pbx_build_file_test.rb +18 -0
  29. data/test/unit/xcode/pbx_build_phase_test.rb +27 -0
  30. data/test/unit/xcode/pbx_file_reference_test.rb +74 -0
  31. data/test/unit/xcode/pbx_formatter_test.rb +35 -0
  32. data/test/unit/xcode/pbx_group_test.rb +25 -0
  33. data/test/unit/xcode/pbx_native_target_test.rb +13 -0
  34. data/test/unit/xcode/pbx_project_test.rb +21 -0
  35. data/test/unit/xcode/xc_build_configuration_test.rb +15 -0
  36. data/test/unit/xcode/xc_configuration_list_test.rb +21 -0
  37. data/test/unit/xcode_test.rb +7 -0
  38. metadata +89 -0
@@ -0,0 +1,18 @@
1
+ BIN_DIR = File.expand_path(File.dirname(__FILE__) + "/../../bin")
2
+ EXAMPLES_DIR = File.expand_path(File.dirname(__FILE__) + "/../../examples")
3
+ LIB_DIR = File.expand_path(File.dirname(__FILE__) + "/../../lib")
4
+
5
+ require "fileutils"
6
+
7
+ require "test/unit"
8
+
9
+ Test::Unit::TestCase.class_eval do
10
+ def self.test(method, &block)
11
+ define_method "test_#{method}".gsub(/\W/,"_"), &block
12
+ end
13
+
14
+ def run_xcodeprojgen
15
+ system "ruby -I #{LIB_DIR} #{BIN_DIR}/xcodeprojgen"
16
+ raise "xcodeprojgen failed" unless $?.success?
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ $LOAD_PATH << File.dirname(__FILE__) + "/../lib"
2
+ require "xcode"
3
+
4
+ require "test/unit"
5
+ require "rubygems"
6
+ gem "mocha", "0.9.5"
7
+ require "mocha"
8
+
9
+ Test::Unit::TestCase.class_eval do
10
+ def self.test(method, &block)
11
+ define_method "test_#{method}".gsub(/\W/,"_"), &block
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ class PbxBuildFileTest < Test::Unit::TestCase
4
+ test "to_pbx" do
5
+ file = Xcode::PBXBuildFile.new_from_file(__FILE__)
6
+ assert_match /^\{isa = PBXBuildFile; fileRef = [A-Z0-9]{24};\}$/, file.to_pbx
7
+ end
8
+
9
+ test "attributes" do
10
+ file = Xcode::PBXBuildFile.new_from_file(__FILE__)
11
+ assert_equal ["isa", "fileRef"].sort, file.attributes.keys.sort
12
+ end
13
+
14
+ test "isa" do
15
+ file = Xcode::PBXBuildFile.new_from_file(__FILE__)
16
+ assert_equal "PBXBuildFile", file.isa
17
+ end
18
+ end
@@ -0,0 +1,27 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ class PbxBuildPhaseTest < Test::Unit::TestCase
4
+ Sample = Class.new(Xcode::PBXBuildPhase) do
5
+ def isa
6
+ "PBXSampleBuildPhase"
7
+ end
8
+ end
9
+
10
+ test "build_action_mask" do
11
+ phase = Sample.new
12
+ assert_equal "2147483647", phase.attributes["buildActionMask"]
13
+ end
14
+
15
+ test "files" do
16
+ phase = Sample.new
17
+ file = stub(:id => "ABC")
18
+ phase.files << file
19
+ assert_equal [file], phase.files
20
+ assert_equal ["ABC"], phase.attributes["files"]
21
+ end
22
+
23
+ test "postprocessing" do
24
+ phase = Sample.new
25
+ assert_equal "0", phase.attributes["runOnlyForDeploymentPostprocesssing"]
26
+ end
27
+ end
@@ -0,0 +1,74 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ class PbxFileReferenceTest < Test::Unit::TestCase
4
+ def test_a_file_filetype
5
+ ref = Xcode::PBXFileReference.new_from_file("foo.a")
6
+ assert_equal "archive.ar", ref.attributes["lastKnownFileType"]
7
+ end
8
+
9
+ def test_fileEncoding_for_h_file
10
+ ref = Xcode::PBXFileReference.new_from_file("foo.h")
11
+ assert_equal "4", ref.attributes["fileEncoding"]
12
+ end
13
+
14
+ def test_lastKnownFileType_for_h_file
15
+ ref = Xcode::PBXFileReference.new_from_file("foo.h")
16
+ assert_equal "sourcecode.c.h", ref.attributes["lastKnownFileType"]
17
+ end
18
+
19
+ def test_last_known_file_type_for_plist
20
+ ref = Xcode::PBXFileReference.new_from_file("foo.plist")
21
+ assert_equal "text.plist.xml", ref.attributes["lastKnownFileType"]
22
+ end
23
+
24
+ def test_last_known_file_type_for_strings
25
+ ref = Xcode::PBXFileReference.new_from_file("foo.strings")
26
+ assert_equal "text.plist.strings", ref.attributes["lastKnownFileType"]
27
+ end
28
+
29
+ def test_attributes_for_h_file
30
+ ref = Xcode::PBXFileReference.new_from_file("foo.h")
31
+ assert_equal ["isa", "fileEncoding", "lastKnownFileType", "path", "sourceTree"].sort, ref.attributes.keys.sort
32
+ end
33
+
34
+ def test_fileEncoding_for_h_file
35
+ ref = Xcode::PBXFileReference.new_from_file("foo.m")
36
+ assert_equal "4", ref.attributes["fileEncoding"]
37
+ end
38
+
39
+ def test_lastKnownFileType_for_h_file
40
+ ref = Xcode::PBXFileReference.new_from_file("foo.m")
41
+ assert_equal "sourcecode.c.objc", ref.attributes["lastKnownFileType"]
42
+ end
43
+
44
+ def test_attributes_for_h_file
45
+ ref = Xcode::PBXFileReference.new_from_file("foo.m")
46
+ assert_equal ["isa", "fileEncoding", "lastKnownFileType", "path", "sourceTree"].sort, ref.attributes.keys.sort
47
+ end
48
+
49
+ def test_lastKnownFileType_for_image_file
50
+ ref = Xcode::PBXFileReference.new_from_file("foo.png")
51
+ assert_equal "image.png", ref.attributes["lastKnownFileType"]
52
+ ref = Xcode::PBXFileReference.new_from_file("foo.tiff")
53
+ assert_equal "image.tiff", ref.attributes["lastKnownFileType"]
54
+ ref = Xcode::PBXFileReference.new_from_file("foo.jpg")
55
+ assert_equal "image.jpeg", ref.attributes["lastKnownFileType"]
56
+ ref = Xcode::PBXFileReference.new_from_file("foo.jpeg")
57
+ assert_equal "image.jpeg", ref.attributes["lastKnownFileType"]
58
+ end
59
+
60
+ def test_attributes_for_image_file
61
+ ref = Xcode::PBXFileReference.new_from_file("foo.png")
62
+ assert_equal ["isa", "lastKnownFileType", "path", "sourceTree"].sort, ref.attributes.keys.sort
63
+ end
64
+
65
+ def test_isa
66
+ ref = Xcode::PBXFileReference.new_from_file("foo.any")
67
+ assert_equal "PBXFileReference", ref.isa
68
+ end
69
+
70
+ def test_source_tree
71
+ ref = Xcode::PBXFileReference.new_from_file("foo.any")
72
+ assert_equal "<group>", ref.attributes["sourceTree"]
73
+ end
74
+ end
@@ -0,0 +1,35 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ class PbxFormatterTest < Test::Unit::TestCase
4
+ def test_to_pbx
5
+ klass = Class.new do
6
+ include Xcode::PBXFormatter
7
+
8
+ def id
9
+ "_id_"
10
+ end
11
+
12
+ def attributes
13
+ {"a" => "b", "c" => "d"}
14
+ end
15
+ end
16
+ instance = klass.new
17
+ assert_equal "{a = b; c = d;}", instance.to_pbx
18
+ end
19
+
20
+ def test_to_pbx_with_array
21
+ klass = Class.new do
22
+ include Xcode::PBXFormatter
23
+
24
+ def id
25
+ "_id_"
26
+ end
27
+
28
+ def attributes
29
+ {"a" => ["b", "c", "d"]}
30
+ end
31
+ end
32
+ instance = klass.new
33
+ assert_equal "{a = (b, c, d);}", instance.to_pbx
34
+ end
35
+ end
@@ -0,0 +1,25 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ class PbxGroupTest < Test::Unit::TestCase
4
+ def test_isa
5
+ group = Xcode::PBXGroup.new({})
6
+ assert_equal "PBXGroup", group.attributes["isa"]
7
+ end
8
+
9
+ def test_source_tree
10
+ group = Xcode::PBXGroup.new({})
11
+ assert_equal "<group>", group.attributes["sourceTree"]
12
+ end
13
+
14
+ def test_attributes_merge
15
+ group = Xcode::PBXGroup.new "key" => "value"
16
+ assert_equal "value", group.attributes["key"]
17
+ end
18
+
19
+ def test_smoke_test_to_pbx
20
+ assert_nothing_raised do
21
+ group = Xcode::PBXGroup.new({})
22
+ group.to_pbx
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ class PbxNativeTargetTest < Test::Unit::TestCase
4
+ test "attributes" do
5
+ target = Xcode::PBXNativeTarget.new "Butterfly"
6
+ assert_equal "com.apple.product-type.application", target.attributes["productType"]
7
+ assert_equal "Butterfly", target.attributes["productName"]
8
+ assert_equal [], target.attributes["dependencies"]
9
+ assert_equal [], target.attributes["buildRules"]
10
+ assert_equal "PBXNativeTarget", target.attributes["isa"]
11
+ assert_equal "Butterfly", target.attributes["name"]
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ class PbxProjectTest < Test::Unit::TestCase
4
+ def test_isa
5
+ project = Xcode::PBXProject.new
6
+ assert_equal "PBXProject", project.isa
7
+ end
8
+
9
+ def test_compatibility_version
10
+ project = Xcode::PBXProject.new
11
+ assert_equal "Xcode 3.1", project.compatibility_version
12
+ end
13
+
14
+ def test_attributes
15
+ project = Xcode::PBXProject.new
16
+ assert_equal "PBXProject", project.attributes["isa"]
17
+ assert_equal "Xcode 3.1", project.attributes["compatibilityVersion"]
18
+ assert_equal "", project.attributes["projectDirPath"]
19
+ assert_equal "", project.attributes["projectRoot"]
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ class XcBuildConfigurationTest < Test::Unit::TestCase
4
+ def test_isa
5
+ config = Xcode::XCBuildConfiguration.new "name", {}
6
+ assert_equal "XCBuildConfiguration", config.attributes["isa"]
7
+ end
8
+
9
+ def test_name_and_build_settings
10
+ build_settings = {"foo" => "bar"}
11
+ config = Xcode::XCBuildConfiguration.new "name", build_settings
12
+ assert_equal "name", config.attributes["name"]
13
+ assert_equal build_settings, config.attributes["buildSettings"]
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ class XcConfigurationListTest < Test::Unit::TestCase
4
+ def test_isa
5
+ list = Xcode::XCConfigurationList.new
6
+ assert_equal "XCConfigurationList", list.attributes["isa"]
7
+ end
8
+
9
+ def test_attributes
10
+ list = Xcode::XCConfigurationList.new
11
+ assert_equal "0", list.attributes["defaultConfigurationIsVisible"]
12
+ assert_equal "Release", list.attributes["defaultConfigurationName"]
13
+ end
14
+
15
+ def test_build_configurations
16
+ list = Xcode::XCConfigurationList.new
17
+ list.build_configurations << stub(:id => "id1")
18
+ list.build_configurations << stub(:id => "id2")
19
+ assert_equal ["id1", "id2"], list.attributes["buildConfigurations"]
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + "/test_helper"
2
+
3
+ class XcodeTest < Test::Unit::TestCase
4
+ def test_random_id_returned_from_register
5
+ assert_match /^[A-Z0-9]{24}$/, Xcode.register(stub(:id => "1", :attributes => {}, :to_pbx => ""))
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: framework-x-xcodeprojgen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dan Manges
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-09 00:00:00 -07:00
13
+ default_executable: xcodeprojgen
14
+ dependencies: []
15
+
16
+ description: generates xcodeproj files
17
+ email: daniel.manges@gmail.com
18
+ executables:
19
+ - xcodeprojgen
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - lib/xcode/frameworks.rb
26
+ - lib/xcode/iphone.rb
27
+ - lib/xcode/iphone_build_configurations.rb
28
+ - lib/xcode/pbx_build_file.rb
29
+ - lib/xcode/pbx_build_phase.rb
30
+ - lib/xcode/pbx_copy_files_build_phase.rb
31
+ - lib/xcode/pbx_file_reference.rb
32
+ - lib/xcode/pbx_formatter.rb
33
+ - lib/xcode/pbx_frameworks_build_phase.rb
34
+ - lib/xcode/pbx_group.rb
35
+ - lib/xcode/pbx_native_target.rb
36
+ - lib/xcode/pbx_proj.rb
37
+ - lib/xcode/pbx_project.rb
38
+ - lib/xcode/pbx_resources_build_phase.rb
39
+ - lib/xcode/pbx_sources_build_phase.rb
40
+ - lib/xcode/xc_build_configuration.rb
41
+ - lib/xcode/xc_configuration_list.rb
42
+ - lib/xcode.rb
43
+ - lib/xcodeproj_gen.rb
44
+ - test/acceptance/command_line_foundation_test.rb
45
+ - test/acceptance/command_line_in_c_test.rb
46
+ - test/acceptance/test_helper.rb
47
+ - test/unit/test_helper.rb
48
+ - test/unit/xcode/pbx_build_file_test.rb
49
+ - test/unit/xcode/pbx_build_phase_test.rb
50
+ - test/unit/xcode/pbx_file_reference_test.rb
51
+ - test/unit/xcode/pbx_formatter_test.rb
52
+ - test/unit/xcode/pbx_group_test.rb
53
+ - test/unit/xcode/pbx_native_target_test.rb
54
+ - test/unit/xcode/pbx_project_test.rb
55
+ - test/unit/xcode/xc_build_configuration_test.rb
56
+ - test/unit/xcode/xc_configuration_list_test.rb
57
+ - test/unit/xcode_test.rb
58
+ - TODO
59
+ - README.markdown
60
+ - Rakefile
61
+ - bin/xcodeprojgen
62
+ has_rdoc: false
63
+ homepage: http://github.com/framework-x/xcodeprojgen
64
+ post_install_message:
65
+ rdoc_options: []
66
+
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ version:
81
+ requirements: []
82
+
83
+ rubyforge_project:
84
+ rubygems_version: 1.2.0
85
+ signing_key:
86
+ specification_version: 2
87
+ summary: generates xcodeproj files
88
+ test_files: []
89
+