xcbootstrap 0.0.1

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 (92) hide show
  1. checksums.yaml +7 -0
  2. data/bin/xcbootstrap +8 -0
  3. data/lib/xcbootstrap/bootstrap.rb +65 -0
  4. data/lib/xcbootstrap/cli.rb +17 -0
  5. data/lib/xcbootstrap/next_steps.txt +32 -0
  6. data/lib/xcbootstrap/template.rb +40 -0
  7. data/lib/xcbootstrap/version.rb +3 -0
  8. data/lib/xcbootstrap.rb +3 -0
  9. data/spec/acceptance/xcbootstrap_spec.rb +57 -0
  10. data/spec/spec_helper.rb +5 -0
  11. data/spec/unit/bootstrap_spec.rb +100 -0
  12. data/spec/unit/cli_spec.rb +33 -0
  13. data/spec/unit/template_spec.rb +86 -0
  14. data/templates/Sample/Sample/AppDelegate.h +15 -0
  15. data/templates/Sample/Sample/AppDelegate.m +49 -0
  16. data/templates/Sample/Sample/Default-568h@2x.png +0 -0
  17. data/templates/Sample/Sample/Default.png +0 -0
  18. data/templates/Sample/Sample/Default@2x.png +0 -0
  19. data/templates/Sample/Sample/Sample-Info.plist +45 -0
  20. data/templates/Sample/Sample/Sample-Prefix.pch +14 -0
  21. data/templates/Sample/Sample/main.m +18 -0
  22. data/templates/Sample/Sample.xcodeproj/project.pbxproj +423 -0
  23. data/templates/Sample/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  24. data/templates/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme +96 -0
  25. data/templates/Sample/SampleTests/SampleTests-Info.plist +22 -0
  26. data/templates/Sample/SampleTests/SampleTests.m +22 -0
  27. data/templates/Sample/gitignore +18 -0
  28. data/templates/Sample/manifest.yml +16 -0
  29. data/templates/simple/Gemfile +7 -0
  30. data/templates/simple/Podfile +15 -0
  31. data/templates/simple/Rakefile +45 -0
  32. data/templates/simple/app/configuration/analyzer.xcconfig +21 -0
  33. data/templates/simple/app/configuration/app.xcconfig +13 -0
  34. data/templates/simple/app/configuration/architectures.xcconfig +5 -0
  35. data/templates/simple/app/configuration/compiler.xcconfig +59 -0
  36. data/templates/simple/app/configuration/debug-code-sign.xcconfig +3 -0
  37. data/templates/simple/app/configuration/debug.xcconfig +22 -0
  38. data/templates/simple/app/configuration/release-code-sign.xcconfig +3 -0
  39. data/templates/simple/app/configuration/release.xcconfig +18 -0
  40. data/templates/simple/app/configuration/shared.xcconfig +12 -0
  41. data/templates/simple/app/configuration/unit-tests.xcconfig +13 -0
  42. data/templates/simple/app/resources/AppInfo.plist +45 -0
  43. data/templates/simple/app/resources/Default-568h@2x.png +0 -0
  44. data/templates/simple/app/resources/Default.png +0 -0
  45. data/templates/simple/app/resources/Default@2x.png +0 -0
  46. data/templates/simple/app/resources/UnitTestsInfo.plist +22 -0
  47. data/templates/simple/app/simple.xcodeproj/project.pbxproj +439 -0
  48. data/templates/simple/app/simple.xcodeproj/xcshareddata/xcschemes/simple.xcscheme +138 -0
  49. data/templates/simple/app/src/AppDelegate.h +7 -0
  50. data/templates/simple/app/src/AppDelegate.m +46 -0
  51. data/templates/simple/app/src/AppPrefix.pch +10 -0
  52. data/templates/simple/app/src/main.m +9 -0
  53. data/templates/simple/app/test/ExampleSpec.m +34 -0
  54. data/templates/simple/app/test/UnitTestsPrefix.pch +11 -0
  55. data/templates/simple/gitignore +20 -0
  56. data/templates/simple/manifest.yml +31 -0
  57. data/templates/simple/simple.xcworkspace/contents.xcworkspacedata +10 -0
  58. data/templates/static-lib/Gemfile +4 -0
  59. data/templates/static-lib/Podfile +14 -0
  60. data/templates/static-lib/Rakefile +29 -0
  61. data/templates/static-lib/gitignore +20 -0
  62. data/templates/static-lib/lib/configuration/analyzer.xcconfig +21 -0
  63. data/templates/static-lib/lib/configuration/architectures.xcconfig +5 -0
  64. data/templates/static-lib/lib/configuration/compiler.xcconfig +59 -0
  65. data/templates/static-lib/lib/configuration/debug-code-sign.xcconfig +3 -0
  66. data/templates/static-lib/lib/configuration/debug.xcconfig +19 -0
  67. data/templates/static-lib/lib/configuration/lib.xcconfig +10 -0
  68. data/templates/static-lib/lib/configuration/release-code-sign.xcconfig +3 -0
  69. data/templates/static-lib/lib/configuration/release.xcconfig +18 -0
  70. data/templates/static-lib/lib/configuration/shared.xcconfig +11 -0
  71. data/templates/static-lib/lib/configuration/test-loader.xcconfig +11 -0
  72. data/templates/static-lib/lib/configuration/unit-tests.xcconfig +13 -0
  73. data/templates/static-lib/lib/resources/Default-568h@2x.png +0 -0
  74. data/templates/static-lib/lib/resources/Default.png +0 -0
  75. data/templates/static-lib/lib/resources/Default@2x.png +0 -0
  76. data/templates/static-lib/lib/resources/TestLoaderAppInfo.plist +45 -0
  77. data/templates/static-lib/lib/resources/UnitTestsInfo.plist +22 -0
  78. data/templates/static-lib/lib/src/MyFirstLibObject.h +7 -0
  79. data/templates/static-lib/lib/src/MyFirstLibObject.m +15 -0
  80. data/templates/static-lib/lib/src/StaticLibPrefix.pch +10 -0
  81. data/templates/static-lib/lib/static-lib.xcodeproj/project.pbxproj +546 -0
  82. data/templates/static-lib/lib/static-lib.xcodeproj/xcshareddata/xcschemes/static-lib.xcscheme +97 -0
  83. data/templates/static-lib/lib/test/ExampleSpec.m +34 -0
  84. data/templates/static-lib/lib/test/TestLoaderAppDelegate.h +7 -0
  85. data/templates/static-lib/lib/test/TestLoaderAppDelegate.m +13 -0
  86. data/templates/static-lib/lib/test/TestLoaderAppPrefix.pch +10 -0
  87. data/templates/static-lib/lib/test/UnitTestsPrefix.pch +11 -0
  88. data/templates/static-lib/lib/test/main.m +9 -0
  89. data/templates/static-lib/manifest.yml +36 -0
  90. data/templates/static-lib/static-lib.podspec +29 -0
  91. data/templates/static-lib/static-lib.xcworkspace/contents.xcworkspacedata +10 -0
  92. metadata +209 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9f0099b2cd9dcbe94ece7657ec7063dca7c709fe
4
+ data.tar.gz: fefd5f54a1ec68b5a8511d4da859175cdfaf2a59
5
+ SHA512:
6
+ metadata.gz: 900be5c2c06fce582e19be142ba3bfaef25d761af541668c4758749d4a3646985fc51c2c76c7c76f3a7280f328b43dfa34be4b9ea9fe16ff4f963dc52d71d247
7
+ data.tar.gz: 0e96d50fbb8c41530b3996ed219b47c1e3babf165ee30a955870713354cf677aa72d446a100062a9545c28971d02edfdd715773d99c2dc0a0481d0ec3d5e55c3
data/bin/xcbootstrap ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH << File.expand_path("../lib", File.dirname(__FILE__))
4
+
5
+ require 'rubygems'
6
+ require 'xcbootstrap'
7
+
8
+ XCBootstrap::Cli.run
@@ -0,0 +1,65 @@
1
+ require 'fileutils'
2
+ require 'yaml'
3
+ require 'xcbootstrap/template'
4
+
5
+ module XCBootstrap
6
+ class Bootstrap
7
+ attr_accessor :template_dir
8
+ attr_accessor :project_dir
9
+
10
+ def initialize template_root, template_name, project_dir
11
+ # FileUtils.mkdir_p project_dir
12
+
13
+ @template_dir = File.join template_root, template_name
14
+ raise "Invalid template: could not find template directory #{@template_dir}" unless File.directory?(@template_dir)
15
+
16
+ manifest_file = File.join @template_dir, "manifest.yml"
17
+ raise "Invalid template: could not find template manifest #{manifest_file}" unless File.exists?(manifest_file)
18
+
19
+ @manifest = YAML.load_file manifest_file
20
+ raise "Invalid template: manifest file did not contain a hash of file mappings #{manifest_file}" unless manifest_data_is_valid(@manifest)
21
+
22
+ @project_dir = File.expand_path(project_dir, Dir.getwd)
23
+ end
24
+
25
+ def process
26
+ FileUtils.mkdir_p project_dir
27
+
28
+ @manifest["files"].each do |file|
29
+ Template.new(file, @template_dir, @project_dir).process
30
+ end
31
+ end
32
+
33
+ def finish
34
+ print_output_project_files
35
+ print_next_steps
36
+ end
37
+
38
+ private
39
+
40
+ def manifest_data_is_valid manifest_data
41
+ manifest_data.kind_of?(Hash) && !manifest_data["files"].nil? && manifest_data["files"].kind_of?(Array) && !manifest_data["files"].empty?
42
+ end
43
+
44
+ def print_output_project_files
45
+ puts @project_dir
46
+ Dir.glob("#{@project_dir}/**/*").each do |item|
47
+ item.gsub(@project_dir, "").split("/").size.times do
48
+ print "."
49
+ end
50
+ puts File.basename(item)
51
+ end
52
+ puts "\n"
53
+ end
54
+
55
+ def print_next_steps
56
+ cat_file(File.join(File.dirname(__FILE__), "next_steps.txt"))
57
+ end
58
+
59
+ def cat_file file
60
+ File.readlines(file).each do |line|
61
+ puts line
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,17 @@
1
+ require 'clamp'
2
+ require 'xcbootstrap/bootstrap'
3
+
4
+ module XCBootstrap
5
+ class Cli < Clamp::Command
6
+
7
+ option ["-t", "--template"], "T", "name of the template to use", :required => true
8
+ option ["-p", "--project"], "P", "relative path to the desired project to create", :required => true
9
+
10
+ def execute
11
+ template_root = File.expand_path(File.join(File.dirname(__FILE__), "../../templates"))
12
+ bootstrapper = XCBootstrap::Bootstrap.new(template_root, template, project)
13
+ bootstrapper.process
14
+ bootstrapper.finish
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,32 @@
1
+ ** Next steps **
2
+
3
+ cd <path-to-project>
4
+
5
+ rvm / rbenv: (if that's your thing)
6
+
7
+ echo "ruby-2.0.0-p247" >> .ruby-version && echo "simple" >> .ruby-gemset && cd .
8
+
9
+ ** Configure git repo **
10
+
11
+ git init
12
+ git add .
13
+ git commit -m "Initial project setup from template"
14
+
15
+ ** Install your dependencies **
16
+
17
+ <install ruby/rvm/rbenv/bundler>
18
+ bundle install
19
+ pod install --no-integrate
20
+ open simple.xcworkspace
21
+
22
+ ** Command line build **
23
+
24
+ rake -T
25
+ - will show you the tasks you can run
26
+
27
+ You'll want to:
28
+ - bootstrap any dependencies
29
+ - build your app
30
+ - run unit tests
31
+ - configure frank
32
+ - run your frank tests
@@ -0,0 +1,40 @@
1
+ require 'fileutils'
2
+ require 'ptools'
3
+
4
+ module XCBootstrap
5
+ class Template
6
+ attr_accessor :from
7
+ attr_accessor :to
8
+
9
+ def initialize file_info, template_dir, project_dir
10
+ @template_name = File.basename template_dir
11
+ @project_name = File.basename project_dir
12
+
13
+ @from = File.join template_dir, file_info["from"]
14
+ relative_path_to = file_info["to"] || file_info["from"].gsub(@template_name, @project_name)
15
+ @to = File.join project_dir, relative_path_to
16
+ end
17
+
18
+ def process
19
+ FileUtils.mkdir_p File.dirname(to)
20
+
21
+ if File.binary? from
22
+ FileUtils.cp from, to
23
+ else
24
+ sed_copy from, to
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def sed_copy source, destination
31
+ File.open destination, "w" do |destination_file|
32
+ File.open source, "r" do |source_file|
33
+ source_file.each do |input_line|
34
+ destination_file.puts input_line.gsub(@template_name, @project_name)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ module XCBootstrap
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,3 @@
1
+ require 'xcbootstrap/cli'
2
+ require 'xcbootstrap/bootstrap'
3
+ require 'xcbootstrap/template'
@@ -0,0 +1,57 @@
1
+ describe 'xcbootstrap for a sample project' do
2
+ before(:all) do
3
+ @test_output_directory = File.join(File.dirname(__FILE__), '../../test_output')
4
+ @bootstrap_output = File.join(@test_output_directory, '/Output')
5
+ @xcbootstrap = File.expand_path(File.join(File.dirname(__FILE__), '../../bin/xcbootstrap'))
6
+ end
7
+
8
+ context 'with full option names' do
9
+ before(:all) do
10
+ FileUtils.rm_rf @test_output_directory
11
+ @xcbootstrap_result = system("#{@xcbootstrap} --template Sample --project #{@bootstrap_output}")
12
+ end
13
+
14
+ it 'should run successfully' do
15
+ @xcbootstrap_result.should be_true
16
+ end
17
+
18
+ it 'should have created the output directory' do
19
+ File.exists?(@bootstrap_output).should be_true
20
+ end
21
+
22
+ it 'should have created source and test directories' do
23
+ File.directory?(File.join(@bootstrap_output, "Output")).should be_true
24
+ File.directory?(File.join(@bootstrap_output, "OutputTests")).should be_true
25
+ end
26
+
27
+ it 'should have created all the project files' do
28
+ output_files = Dir.glob("#{@bootstrap_output}/**/{.*,*}").select { |file| !File.directory?(file) }
29
+ output_files.size.should == 13
30
+ end
31
+
32
+ it 'should have the git ignore file renamed' do
33
+ File.exists?(File.join(@bootstrap_output, ".gitignore")).should be_true
34
+ end
35
+
36
+ it 'should have replaced the template with the project name' do
37
+ content = File.read(File.join(@bootstrap_output, "Output.xcodeproj/project.pbxproj"))
38
+ content.should_not include("Sample")
39
+ content.should include("Output")
40
+ end
41
+ end
42
+
43
+ context 'with short option names' do
44
+ before(:all) do
45
+ FileUtils.rm_rf @test_output_directory
46
+ @xcbootstrap_result = system("#{@xcbootstrap} -t Sample -p #{@bootstrap_output}")
47
+ end
48
+
49
+ it 'should run successfully' do
50
+ @xcbootstrap_result.should be_true
51
+ end
52
+
53
+ it 'should have created the output directory' do
54
+ File.exists?(@bootstrap_output).should be_true
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,5 @@
1
+ require_relative '../lib/xcbootstrap'
2
+
3
+ def some_helper
4
+ true
5
+ end
@@ -0,0 +1,100 @@
1
+ require_relative '../spec_helper'
2
+ require 'fakefs/spec_helpers'
3
+
4
+ describe 'Bootstrap' do
5
+ include FakeFS::SpecHelpers
6
+
7
+ context 'with a template that does not exist' do
8
+ it 'should raise an error' do
9
+ expect { XCBootstrap::Bootstrap.new("/tmp", "non_existant_template", "path-to-project") }.to raise_error
10
+ end
11
+ end
12
+
13
+ context 'with a template with no manifest' do
14
+ it 'should raise an error' do
15
+ FileUtils.mkdir_p "/tmp/template_with_no_manifest"
16
+ expect { XCBootstrap::Bootstrap.new("/tmp", "template_with_no_manifest", "path-to-project") }.to raise_error
17
+ end
18
+ end
19
+
20
+ context 'with an invalid manifest file' do
21
+ it 'should raise an error' do
22
+ create_invalid_manifest_with_content "fake manifest..\n... the end"
23
+ expect { XCBootstrap::Bootstrap.new("/tmp", "template_with_invalid_manifest", "path-to-project") }.to raise_error
24
+ end
25
+ end
26
+
27
+ context 'with a manifest where files is not an array' do
28
+ it 'should raise an error' do
29
+ create_invalid_manifest_with_content "---\nfiles: blah"
30
+ expect { XCBootstrap::Bootstrap.new("/tmp", "template_with_invalid_manifest", "path-to-project") }.to raise_error
31
+ end
32
+ end
33
+
34
+ context 'with a manifest where files is empty' do
35
+ it 'should raise an error' do
36
+ create_invalid_manifest_with_content "---\nfiles: []"
37
+ expect { XCBootstrap::Bootstrap.new("/tmp", "template_with_invalid_manifest", "path-to-project") }.to raise_error
38
+ end
39
+ end
40
+
41
+ context 'with a valid template' do
42
+ before(:each) do
43
+ FileUtils.mkdir_p "/tmp/my_template"
44
+ File.open "/tmp/my_template/manifest.yml", "w" do |from_file|
45
+ from_file.puts "---"
46
+ from_file.puts "files:"
47
+ from_file.puts " - from: some_file.txt"
48
+ end
49
+
50
+ File.open "/tmp/my_template/some_file.txt", "w" do |from_file|
51
+ from_file.puts "some content"
52
+ end
53
+
54
+ Dir.stub(:getwd).and_return("/tmp")
55
+ end
56
+
57
+ context 'with a relative project path' do
58
+ let(:bootstrapper) { XCBootstrap::Bootstrap.new("/tmp", "my_template", "../tmp/path/to/my_project") }
59
+
60
+ it 'should have the full path to the template' do
61
+ bootstrapper.template_dir.should == "/tmp/my_template"
62
+ end
63
+
64
+ it 'should have the full path to the output project' do
65
+ bootstrapper.project_dir.should == "/tmp/path/to/my_project"
66
+ end
67
+
68
+ context 'when the template is processed' do
69
+ before(:each) do
70
+ File.stub(:binary?).and_return(false)
71
+ bootstrapper.process
72
+ end
73
+
74
+ it 'should create the output project directory' do
75
+ File.exists?(bootstrapper.project_dir).should be_true
76
+ end
77
+
78
+ it 'should copy files to the output project' do
79
+ output_file = File.join bootstrapper.project_dir, "some_file.txt"
80
+ File.exists?(output_file).should be_true
81
+ end
82
+ end
83
+ end
84
+
85
+ context 'with an absolute project path' do
86
+ let(:bootstrapper) { XCBootstrap::Bootstrap.new("/tmp", "my_template", "/tmp/path/to/my_project") }
87
+
88
+ it 'should leave the project path absolute' do
89
+ bootstrapper.project_dir.should == "/tmp/path/to/my_project"
90
+ end
91
+ end
92
+ end
93
+
94
+ def create_invalid_manifest_with_content content
95
+ FileUtils.mkdir_p "/tmp/template_with_invalid_manifest"
96
+ File.open "/tmp/template_with_invalid_manifest/manifest.yml", "w" do |from_file|
97
+ from_file.puts content
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,33 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe 'Cli' do
4
+ before(:each) do
5
+ fake_boostrap = mock().as_null_object
6
+ XCBootstrap::Bootstrap.stub(:new).and_return(fake_boostrap)
7
+ end
8
+
9
+ context 'with the template and project arguments' do
10
+ it 'should point to the default template dir' do
11
+ default_template_dir = File.expand_path("templates")
12
+ XCBootstrap::Bootstrap.should_receive(:new).with(default_template_dir, anything, anything)
13
+ XCBootstrap::Cli.new("", {}).run(["--template", "MyTemplate", "--project", "../MyProject"])
14
+ end
15
+
16
+ it 'should bootstrap the project from the template' do
17
+ XCBootstrap::Bootstrap.should_receive(:new).with(anything, "MyTemplate", "../MyProject")
18
+ XCBootstrap::Cli.new("", {}).run(["--template", "MyTemplate", "--project", "../MyProject"])
19
+ end
20
+ end
21
+
22
+ context 'without the template flag' do
23
+ it 'should raise an error' do
24
+ expect { XCBootstrap::Cli.new("", {}).run(["--project", "../MyProject"]) }.to raise_error
25
+ end
26
+ end
27
+
28
+ context 'without the project flag' do
29
+ it 'should raise an error' do
30
+ expect { XCBootstrap::Cli.new("", {}).run(["--template", "MyTemplate"]) }.to raise_error
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,86 @@
1
+ require_relative '../spec_helper'
2
+ require 'fakefs/spec_helpers'
3
+
4
+ describe 'Template' do
5
+ include FakeFS::SpecHelpers
6
+
7
+ let(:template_dir) { "/tmp/template/sample" }
8
+ let(:project_dir) { "/tmp/output/new_project" }
9
+
10
+ context 'with all fields specified' do
11
+ let(:template) { XCBootstrap::Template.new({"from" => "some/path/from","to" => "some/path/to"}, template_dir, project_dir) }
12
+
13
+ it 'should have the from field inside the template dir' do
14
+ template.from.should == "/tmp/template/sample/some/path/from"
15
+ end
16
+
17
+ it 'should have the to field inside the output project dir' do
18
+ template.to.should == "/tmp/output/new_project/some/path/to"
19
+ end
20
+ end
21
+
22
+ context 'without the to field specified' do
23
+ let(:template) { XCBootstrap::Template.new({"from" => "some/path/from"}, template_dir, project_dir) }
24
+
25
+ it 'should use the from field as the to' do
26
+ template.to.should == "/tmp/output/new_project/some/path/from"
27
+ end
28
+ end
29
+
30
+ context 'with the template name in the from path' do
31
+ let(:template) { XCBootstrap::Template.new({"from" => "some/path/including/sample/in/path"}, template_dir, project_dir) }
32
+
33
+ it 'should use the from field with the template name replaces with the project name' do
34
+ template.to.should == "/tmp/output/new_project/some/path/including/new_project/in/path"
35
+ end
36
+ end
37
+
38
+ context 'when processing the file' do
39
+ let(:template) { XCBootstrap::Template.new({"from" => "path/to/file"}, template_dir, project_dir) }
40
+
41
+ before(:each) do
42
+ File.stub(:binary?).and_return(false)
43
+
44
+ FileUtils.mkdir_p "/tmp/template/sample/path/to/"
45
+ File.open "/tmp/template/sample/path/to/file", "w" do |from_file|
46
+ from_file.puts "content including sample name"
47
+ end
48
+ end
49
+
50
+ it 'should create any intermediate directories to the destination' do
51
+ template.process
52
+ File.exists?("/tmp/output/new_project/path/to/").should be_true
53
+ File.directory?("/tmp/output/new_project/path/to/").should be_true
54
+ end
55
+
56
+ it 'should copy the file to the destination' do
57
+ template.process
58
+ File.exists?("/tmp/output/new_project/path/to/file").should be_true
59
+ File.directory?("/tmp/output/new_project/path/to/file").should be_false
60
+ end
61
+
62
+ it 'should replace occurances of the template name with the new project name' do
63
+ template.process
64
+ File.read("/tmp/output/new_project/path/to/file").should_not include("sample")
65
+ File.read("/tmp/output/new_project/path/to/file").should include("new_project")
66
+ end
67
+ end
68
+
69
+ context 'when processing a binary file' do
70
+ let(:template) { XCBootstrap::Template.new({"from" => "path/to/binary/file"}, template_dir, project_dir) }
71
+
72
+ before(:each) do
73
+ File.stub(:binary?).and_return(true)
74
+
75
+ FileUtils.mkdir_p "/tmp/template/sample/path/to/binary"
76
+ File.open "/tmp/template/sample/path/to/binary/file", "wb" do |from_file|
77
+ from_file.puts "content including sample name"
78
+ end
79
+ end
80
+
81
+ it 'should not replace occurances of the template name' do
82
+ template.process
83
+ File.read("/tmp/output/new_project/path/to/binary/file").should include("sample")
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,15 @@
1
+ //
2
+ // AppDelegate.h
3
+ // Sample
4
+ //
5
+ // Created by Stewart Gleadow on 12/06/13.
6
+ // Copyright (c) 2013 yourcompanyname. All rights reserved.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+
11
+ @interface AppDelegate : UIResponder <UIApplicationDelegate>
12
+
13
+ @property (strong, nonatomic) UIWindow *window;
14
+
15
+ @end
@@ -0,0 +1,49 @@
1
+ //
2
+ // AppDelegate.m
3
+ // Sample
4
+ //
5
+ // Created by Stewart Gleadow on 12/06/13.
6
+ // Copyright (c) 2013 yourcompanyname. All rights reserved.
7
+ //
8
+
9
+ #import "AppDelegate.h"
10
+
11
+ @implementation AppDelegate
12
+
13
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
14
+ {
15
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
16
+ // Override point for customization after application launch.
17
+ self.window.backgroundColor = [UIColor whiteColor];
18
+ [self.window makeKeyAndVisible];
19
+ return YES;
20
+ }
21
+
22
+ - (void)applicationWillResignActive:(UIApplication *)application
23
+ {
24
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
25
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
26
+ }
27
+
28
+ - (void)applicationDidEnterBackground:(UIApplication *)application
29
+ {
30
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
31
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
32
+ }
33
+
34
+ - (void)applicationWillEnterForeground:(UIApplication *)application
35
+ {
36
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
37
+ }
38
+
39
+ - (void)applicationDidBecomeActive:(UIApplication *)application
40
+ {
41
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
42
+ }
43
+
44
+ - (void)applicationWillTerminate:(UIApplication *)application
45
+ {
46
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
47
+ }
48
+
49
+ @end
Binary file
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>en</string>
7
+ <key>CFBundleDisplayName</key>
8
+ <string>${PRODUCT_NAME}</string>
9
+ <key>CFBundleExecutable</key>
10
+ <string>${EXECUTABLE_NAME}</string>
11
+ <key>CFBundleIdentifier</key>
12
+ <string>com.yourcompanyname.${PRODUCT_NAME:rfc1034identifier}</string>
13
+ <key>CFBundleInfoDictionaryVersion</key>
14
+ <string>6.0</string>
15
+ <key>CFBundleName</key>
16
+ <string>${PRODUCT_NAME}</string>
17
+ <key>CFBundlePackageType</key>
18
+ <string>APPL</string>
19
+ <key>CFBundleShortVersionString</key>
20
+ <string>1.0</string>
21
+ <key>CFBundleSignature</key>
22
+ <string>????</string>
23
+ <key>CFBundleVersion</key>
24
+ <string>1.0</string>
25
+ <key>LSRequiresIPhoneOS</key>
26
+ <true/>
27
+ <key>UIRequiredDeviceCapabilities</key>
28
+ <array>
29
+ <string>armv7</string>
30
+ </array>
31
+ <key>UISupportedInterfaceOrientations</key>
32
+ <array>
33
+ <string>UIInterfaceOrientationPortrait</string>
34
+ <string>UIInterfaceOrientationLandscapeLeft</string>
35
+ <string>UIInterfaceOrientationLandscapeRight</string>
36
+ </array>
37
+ <key>UISupportedInterfaceOrientations~ipad</key>
38
+ <array>
39
+ <string>UIInterfaceOrientationPortrait</string>
40
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
41
+ <string>UIInterfaceOrientationLandscapeLeft</string>
42
+ <string>UIInterfaceOrientationLandscapeRight</string>
43
+ </array>
44
+ </dict>
45
+ </plist>
@@ -0,0 +1,14 @@
1
+ //
2
+ // Prefix header for all source files of the 'Sample' target in the 'Sample' project
3
+ //
4
+
5
+ #import <Availability.h>
6
+
7
+ #ifndef __IPHONE_3_0
8
+ #warning "This project uses features only available in iOS SDK 3.0 and later."
9
+ #endif
10
+
11
+ #ifdef __OBJC__
12
+ #import <UIKit/UIKit.h>
13
+ #import <Foundation/Foundation.h>
14
+ #endif
@@ -0,0 +1,18 @@
1
+ //
2
+ // main.m
3
+ // Sample
4
+ //
5
+ // Created by Stewart Gleadow on 12/06/13.
6
+ // Copyright (c) 2013 yourcompanyname. All rights reserved.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+
11
+ #import "AppDelegate.h"
12
+
13
+ int main(int argc, char *argv[])
14
+ {
15
+ @autoreleasepool {
16
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17
+ }
18
+ }