xcbootstrap 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/xcbootstrap +1 -1
- data/lib/xcbootstrap/bootstrap.rb +1 -3
- data/lib/xcbootstrap/cli.rb +35 -11
- data/lib/xcbootstrap/template.rb +1 -1
- data/lib/xcbootstrap/templates.rb +28 -0
- data/lib/xcbootstrap/version.rb +1 -1
- data/spec/acceptance/xcbootstrap_spec.rb +120 -35
- data/spec/spec_helper.rb +16 -2
- data/spec/unit/bootstrap_spec.rb +9 -8
- data/spec/unit/cli_spec.rb +56 -18
- data/spec/unit/template_spec.rb +19 -9
- data/spec/unit/templates_spec.rb +39 -0
- metadata +12 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55316dd561cbf2d95df6f98509f0351fa0ccb59a
|
4
|
+
data.tar.gz: b7c0c160c9539ea8fef3f41c532458cca20c0cf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ae0967008311f7d57e4e874766e17dde443641f91bafb3259f08a760c98fc3d3afd424b7b617fb1ff8194b1bf258910b35640dceb63c44ea79b10fe6cf3f0d7
|
7
|
+
data.tar.gz: 270c24012d640762a89320879ae4b2818fbd0d5a04c6d7d1358b4fb14351e6b472080272ae4bf7a87300f7dd0c408344ee987f46c85faadbd59fcf5244a555c0
|
data/bin/xcbootstrap
CHANGED
@@ -8,8 +8,6 @@ module XCBootstrap
|
|
8
8
|
attr_accessor :project_dir
|
9
9
|
|
10
10
|
def initialize template_root, template_name, project_dir
|
11
|
-
# FileUtils.mkdir_p project_dir
|
12
|
-
|
13
11
|
@template_dir = File.join template_root, template_name
|
14
12
|
raise "Invalid template: could not find template directory #{@template_dir}" unless File.directory?(@template_dir)
|
15
13
|
|
@@ -19,7 +17,7 @@ module XCBootstrap
|
|
19
17
|
@manifest = YAML.load_file manifest_file
|
20
18
|
raise "Invalid template: manifest file did not contain a hash of file mappings #{manifest_file}" unless manifest_data_is_valid(@manifest)
|
21
19
|
|
22
|
-
@project_dir = File.expand_path(project_dir, Dir.
|
20
|
+
@project_dir = File.expand_path(project_dir, Dir.pwd)
|
23
21
|
end
|
24
22
|
|
25
23
|
def process
|
data/lib/xcbootstrap/cli.rb
CHANGED
@@ -1,17 +1,41 @@
|
|
1
|
-
require '
|
1
|
+
require 'thor'
|
2
2
|
require 'xcbootstrap/bootstrap'
|
3
|
+
require 'xcbootstrap/templates'
|
3
4
|
|
4
5
|
module XCBootstrap
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
|
7
|
+
class Create < Thor
|
8
|
+
|
9
|
+
Templates.all_templates.each do |template_name|
|
10
|
+
desc template_name, "Create a project PROJECT_NAME based on the template '#{template_name}'"
|
11
|
+
define_method(template_name) do |project_name|
|
12
|
+
template_root = File.expand_path(File.join(File.dirname(__FILE__), "../../templates"))
|
13
|
+
bootstrapper = Bootstrap.new(template_root, template_name, project_name)
|
14
|
+
bootstrapper.process
|
15
|
+
bootstrapper.finish
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
class Cli < Thor
|
22
|
+
|
23
|
+
desc "list", "list available project templates"
|
24
|
+
def list
|
25
|
+
puts "Templates:"
|
26
|
+
|
27
|
+
Templates.all_templates.each do |template|
|
28
|
+
puts " #{template}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "create", "Create a new project, in the current working directory, based on a specified template"
|
33
|
+
subcommand "create", Create
|
34
|
+
|
35
|
+
def self.exit_on_failure?
|
36
|
+
true
|
15
37
|
end
|
38
|
+
|
16
39
|
end
|
40
|
+
|
17
41
|
end
|
data/lib/xcbootstrap/template.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module XCBootstrap
|
4
|
+
class Templates
|
5
|
+
|
6
|
+
TEMPLATE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "../../templates"))
|
7
|
+
|
8
|
+
attr_accessor :template_name
|
9
|
+
|
10
|
+
def self.all_templates
|
11
|
+
Dir.glob("#{TEMPLATE_ROOT}/*").map do |template_path|
|
12
|
+
template_name = File.basename(template_path)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(template_name)
|
17
|
+
@template_name = template_name
|
18
|
+
end
|
19
|
+
|
20
|
+
def path
|
21
|
+
File.join(TEMPLATE_ROOT, template_name)
|
22
|
+
end
|
23
|
+
|
24
|
+
def manifest
|
25
|
+
File.join(path, "manifest.yml")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/xcbootstrap/version.rb
CHANGED
@@ -1,57 +1,142 @@
|
|
1
|
-
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe 'xcbootstrap' do
|
2
4
|
before(:all) do
|
3
|
-
@test_output_directory = File.join(File.dirname(__FILE__), '../../test_output')
|
4
|
-
@bootstrap_output = File.join(@test_output_directory, '/Output')
|
5
5
|
@xcbootstrap = File.expand_path(File.join(File.dirname(__FILE__), '../../bin/xcbootstrap'))
|
6
6
|
end
|
7
7
|
|
8
|
-
context 'with
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
context 'with no arguments' do
|
9
|
+
it 'should run successfully' do
|
10
|
+
status, _ = run_command("#{@xcbootstrap}")
|
11
|
+
status.should be_true
|
12
12
|
end
|
13
13
|
|
14
|
-
it 'should
|
15
|
-
@
|
14
|
+
it 'should print usage information' do
|
15
|
+
_, output = run_command("#{@xcbootstrap}")
|
16
|
+
|
17
|
+
output.should include("Commands:")
|
18
|
+
output.should include("xcbootstrap help")
|
19
|
+
output.should include("xcbootstrap create")
|
20
|
+
output.should include("xcbootstrap list")
|
16
21
|
end
|
22
|
+
end
|
17
23
|
|
18
|
-
|
19
|
-
|
24
|
+
context 'when retrieving help on one of the available commands' do
|
25
|
+
it 'should have a help option' do
|
26
|
+
status, _ = run_command("#{@xcbootstrap} help")
|
27
|
+
status.should be_true
|
20
28
|
end
|
21
|
-
|
22
|
-
it 'should
|
23
|
-
|
24
|
-
|
29
|
+
|
30
|
+
it 'should print available help for that command' do
|
31
|
+
_, help_output = run_command("#{@xcbootstrap} help")
|
32
|
+
_, default_output = run_command("#{@xcbootstrap}")
|
33
|
+
help_output.should == default_output
|
25
34
|
end
|
26
|
-
|
27
|
-
it 'should have
|
28
|
-
|
29
|
-
|
35
|
+
|
36
|
+
it 'should have a help option for specific commands' do
|
37
|
+
status, _ = run_command("#{@xcbootstrap} help list")
|
38
|
+
status.should be_true
|
30
39
|
end
|
31
|
-
|
32
|
-
it 'should
|
33
|
-
|
40
|
+
|
41
|
+
it 'should show usage information for a specific commands' do
|
42
|
+
_, output = run_command("#{@xcbootstrap} help list")
|
43
|
+
|
44
|
+
output.should include("Usage:")
|
45
|
+
output.should include("xcbootstrap list")
|
34
46
|
end
|
47
|
+
end
|
35
48
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
49
|
+
context 'with the list argument' do
|
50
|
+
it 'should run successfully' do
|
51
|
+
status, _ = run_command("#{@xcbootstrap} list")
|
52
|
+
status.should be_true
|
40
53
|
end
|
54
|
+
|
55
|
+
it 'should list all the available templates' do
|
56
|
+
_, output = run_command("#{@xcbootstrap} list")
|
57
|
+
output.should include("Templates:")
|
58
|
+
output.should include("Sample")
|
59
|
+
end
|
41
60
|
end
|
42
61
|
|
43
|
-
context 'with
|
44
|
-
|
45
|
-
|
46
|
-
|
62
|
+
context 'with the create argument' do
|
63
|
+
context 'with a valid template option specified' do
|
64
|
+
context 'without the project option' do
|
65
|
+
it 'should not run successfully' do
|
66
|
+
status, _ = run_command("#{@xcbootstrap} create simple")
|
67
|
+
status.should be_false
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context 'with the project option' do
|
72
|
+
before(:all) do
|
73
|
+
@test_output_directory = File.join(File.dirname(__FILE__), '../../test_output')
|
74
|
+
@bootstrap_output = File.join(@test_output_directory, '/Output')
|
75
|
+
|
76
|
+
FileUtils.rm_rf @test_output_directory
|
77
|
+
FileUtils.mkdir_p @test_output_directory
|
78
|
+
|
79
|
+
Dir.chdir(@test_output_directory) do
|
80
|
+
@status, @output = run_command("#{@xcbootstrap} create Sample Output")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should run successfully' do
|
85
|
+
@status.should be_true
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should have created the output directory' do
|
89
|
+
File.exists?(@bootstrap_output).should be_true
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should have created source and test directories' do
|
93
|
+
File.directory?(File.join(@bootstrap_output, "Output")).should be_true
|
94
|
+
File.directory?(File.join(@bootstrap_output, "OutputTests")).should be_true
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'should have created all the project files' do
|
98
|
+
output_files = Dir.glob("#{@bootstrap_output}/**/{.*,*}").select { |file| !File.directory?(file) }
|
99
|
+
output_files.size.should == 13
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'should have the git ignore file renamed' do
|
103
|
+
File.exists?(File.join(@bootstrap_output, ".gitignore")).should be_true
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should have replaced the template with the project name' do
|
107
|
+
content = File.read(File.join(@bootstrap_output, "Output.xcodeproj/project.pbxproj"))
|
108
|
+
content.should_not include("Sample")
|
109
|
+
content.should include("Output")
|
110
|
+
end
|
111
|
+
|
112
|
+
it' should print out the list of files created in the new project' do
|
113
|
+
@output.should include("...project.pbxproj")
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'should print out the next steps information' do
|
117
|
+
@output.should include("** Next steps **")
|
118
|
+
end
|
119
|
+
end
|
47
120
|
end
|
48
121
|
|
49
|
-
|
50
|
-
|
122
|
+
context 'with a non-existant template option specified' do
|
123
|
+
it 'should not run successfully' do
|
124
|
+
status, _ = run_command("#{@xcbootstrap} create a-non-existant-template-name")
|
125
|
+
status.should be_false
|
126
|
+
end
|
51
127
|
end
|
52
|
-
|
53
|
-
|
54
|
-
|
128
|
+
|
129
|
+
context 'without no template option specified' do
|
130
|
+
it 'should run successfully' do
|
131
|
+
status, _ = run_command("#{@xcbootstrap} create")
|
132
|
+
status.should be_true
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'should print usage information' do
|
136
|
+
_, output = run_command("#{@xcbootstrap} create")
|
137
|
+
output.should include("Commands:")
|
138
|
+
output.should include("xcbootstrap create")
|
139
|
+
end
|
55
140
|
end
|
56
141
|
end
|
57
142
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,19 @@
|
|
1
|
+
require 'open3'
|
1
2
|
require_relative '../lib/xcbootstrap'
|
3
|
+
include XCBootstrap
|
2
4
|
|
3
|
-
def
|
4
|
-
|
5
|
+
def run_command cmd
|
6
|
+
stdin, stdout, stderr, wait_thr = Open3.popen3(cmd)
|
7
|
+
return wait_thr.value.success?, stdout.read
|
8
|
+
end
|
9
|
+
|
10
|
+
def capture_stdout(&block)
|
11
|
+
original_stdout = $stdout
|
12
|
+
$stdout = fake = StringIO.new
|
13
|
+
begin
|
14
|
+
yield
|
15
|
+
ensure
|
16
|
+
$stdout = original_stdout
|
17
|
+
end
|
18
|
+
fake.string
|
5
19
|
end
|
data/spec/unit/bootstrap_spec.rb
CHANGED
@@ -6,35 +6,35 @@ describe 'Bootstrap' do
|
|
6
6
|
|
7
7
|
context 'with a template that does not exist' do
|
8
8
|
it 'should raise an error' do
|
9
|
-
expect {
|
9
|
+
expect { Bootstrap.new("/tmp", "non_existant_template", "path-to-project") }.to raise_error
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
context 'with a template with no manifest' do
|
14
14
|
it 'should raise an error' do
|
15
15
|
FileUtils.mkdir_p "/tmp/template_with_no_manifest"
|
16
|
-
expect {
|
16
|
+
expect { Bootstrap.new("/tmp", "template_with_no_manifest", "path-to-project") }.to raise_error
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
context 'with an invalid manifest file' do
|
21
21
|
it 'should raise an error' do
|
22
22
|
create_invalid_manifest_with_content "fake manifest..\n... the end"
|
23
|
-
expect {
|
23
|
+
expect { Bootstrap.new("/tmp", "template_with_invalid_manifest", "path-to-project") }.to raise_error
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'with a manifest where files is not an array' do
|
28
28
|
it 'should raise an error' do
|
29
29
|
create_invalid_manifest_with_content "---\nfiles: blah"
|
30
|
-
expect {
|
30
|
+
expect { Bootstrap.new("/tmp", "template_with_invalid_manifest", "path-to-project") }.to raise_error
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
context 'with a manifest where files is empty' do
|
35
35
|
it 'should raise an error' do
|
36
36
|
create_invalid_manifest_with_content "---\nfiles: []"
|
37
|
-
expect {
|
37
|
+
expect { Bootstrap.new("/tmp", "template_with_invalid_manifest", "path-to-project") }.to raise_error
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -51,11 +51,11 @@ describe 'Bootstrap' do
|
|
51
51
|
from_file.puts "some content"
|
52
52
|
end
|
53
53
|
|
54
|
-
Dir.stub(:
|
54
|
+
Dir.stub(:pwd).and_return("/tmp/fake-working-dir")
|
55
55
|
end
|
56
56
|
|
57
57
|
context 'with a relative project path' do
|
58
|
-
let(:bootstrapper) {
|
58
|
+
let(:bootstrapper) { Bootstrap.new("/tmp", "my_template", "../path/to/my_project") }
|
59
59
|
|
60
60
|
it 'should have the full path to the template' do
|
61
61
|
bootstrapper.template_dir.should == "/tmp/my_template"
|
@@ -68,6 +68,7 @@ describe 'Bootstrap' do
|
|
68
68
|
context 'when the template is processed' do
|
69
69
|
before(:each) do
|
70
70
|
File.stub(:binary?).and_return(false)
|
71
|
+
File.stub(:image?).and_return(false)
|
71
72
|
bootstrapper.process
|
72
73
|
end
|
73
74
|
|
@@ -83,7 +84,7 @@ describe 'Bootstrap' do
|
|
83
84
|
end
|
84
85
|
|
85
86
|
context 'with an absolute project path' do
|
86
|
-
let(:bootstrapper) {
|
87
|
+
let(:bootstrapper) { Bootstrap.new("/tmp", "my_template", "/tmp/path/to/my_project") }
|
87
88
|
|
88
89
|
it 'should leave the project path absolute' do
|
89
90
|
bootstrapper.project_dir.should == "/tmp/path/to/my_project"
|
data/spec/unit/cli_spec.rb
CHANGED
@@ -2,32 +2,70 @@ require_relative '../spec_helper'
|
|
2
2
|
|
3
3
|
describe 'Cli' do
|
4
4
|
before(:each) do
|
5
|
-
fake_boostrap = mock().as_null_object
|
6
|
-
|
5
|
+
@fake_boostrap = mock().as_null_object
|
6
|
+
Bootstrap.stub(:new).and_return(@fake_boostrap)
|
7
|
+
|
8
|
+
Templates.stub(:all_templates).and_return(["template1", "template2"])
|
9
|
+
|
10
|
+
# Force class reload, as the method names are added automatically
|
11
|
+
load File.expand_path(File.join(File.dirname(__FILE__), "../../lib/xcbootstrap/cli.rb"))
|
7
12
|
end
|
13
|
+
|
14
|
+
let(:cli) { Cli.new }
|
15
|
+
let(:create_cli) { Create.new }
|
8
16
|
|
9
|
-
|
10
|
-
it 'should
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
17
|
+
describe 'listing all templates' do
|
18
|
+
it 'should print out all available templates' do
|
19
|
+
output = capture_stdout { cli.list }
|
20
|
+
|
21
|
+
output.split.size.should == 3
|
15
22
|
|
16
|
-
|
17
|
-
|
18
|
-
|
23
|
+
output.should include("Templates:")
|
24
|
+
output.should include("template1")
|
25
|
+
output.should include("template2")
|
19
26
|
end
|
20
27
|
end
|
21
28
|
|
22
|
-
|
23
|
-
it 'should
|
24
|
-
|
29
|
+
describe 'creating a new project based on a template' do
|
30
|
+
it 'should have the option to create new projects' do
|
31
|
+
cli.should respond_to("create")
|
25
32
|
end
|
26
|
-
|
33
|
+
|
34
|
+
it 'should be able to create each available template' do
|
35
|
+
create_cli.should respond_to("template1")
|
36
|
+
create_cli.should respond_to("template2")
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should require the project to be specified' do
|
40
|
+
expect { create_cli.template1 }.to raise_error
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'with a project name specified' do
|
44
|
+
before(:each) do
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should run successfully' do
|
49
|
+
expect { create_cli.template1("MyApp") }.to_not raise_error
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should create the bootstrapper with the template and project' do
|
53
|
+
# default_template_dir = File.expand_path("templates")
|
54
|
+
Bootstrap.should_receive(:new).with(anything, "template1", "MyApp")
|
55
|
+
create_cli.template1("MyApp")
|
56
|
+
end
|
27
57
|
|
28
|
-
|
29
|
-
|
30
|
-
|
58
|
+
it 'should pass through the template root to the bootstrapper' do
|
59
|
+
Bootstrap.should_receive(:new).with(/templates/, anything, anything)
|
60
|
+
create_cli.template1("MyApp")
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should process and finish the bootstrapping' do
|
64
|
+
@fake_boostrap.should_receive(:process)
|
65
|
+
@fake_boostrap.should_receive(:finish)
|
66
|
+
create_cli.template1("MyApp")
|
67
|
+
end
|
31
68
|
end
|
32
69
|
end
|
70
|
+
|
33
71
|
end
|
data/spec/unit/template_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe 'Template' do
|
|
8
8
|
let(:project_dir) { "/tmp/output/new_project" }
|
9
9
|
|
10
10
|
context 'with all fields specified' do
|
11
|
-
let(:template) {
|
11
|
+
let(:template) { Template.new({"from" => "some/path/from","to" => "some/path/to"}, template_dir, project_dir) }
|
12
12
|
|
13
13
|
it 'should have the from field inside the template dir' do
|
14
14
|
template.from.should == "/tmp/template/sample/some/path/from"
|
@@ -20,7 +20,7 @@ describe 'Template' do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
context 'without the to field specified' do
|
23
|
-
let(:template) {
|
23
|
+
let(:template) { Template.new({"from" => "some/path/from"}, template_dir, project_dir) }
|
24
24
|
|
25
25
|
it 'should use the from field as the to' do
|
26
26
|
template.to.should == "/tmp/output/new_project/some/path/from"
|
@@ -28,7 +28,7 @@ describe 'Template' do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
context 'with the template name in the from path' do
|
31
|
-
let(:template) {
|
31
|
+
let(:template) { Template.new({"from" => "some/path/including/sample/in/path"}, template_dir, project_dir) }
|
32
32
|
|
33
33
|
it 'should use the from field with the template name replaces with the project name' do
|
34
34
|
template.to.should == "/tmp/output/new_project/some/path/including/new_project/in/path"
|
@@ -36,10 +36,11 @@ describe 'Template' do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
context 'when processing the file' do
|
39
|
-
let(:template) {
|
39
|
+
let(:template) { Template.new({"from" => "path/to/file"}, template_dir, project_dir) }
|
40
40
|
|
41
41
|
before(:each) do
|
42
42
|
File.stub(:binary?).and_return(false)
|
43
|
+
File.stub(:image?).and_return(false)
|
43
44
|
|
44
45
|
FileUtils.mkdir_p "/tmp/template/sample/path/to/"
|
45
46
|
File.open "/tmp/template/sample/path/to/file", "w" do |from_file|
|
@@ -66,19 +67,28 @@ describe 'Template' do
|
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
69
|
-
context 'when processing
|
70
|
-
let(:template) {
|
70
|
+
context 'when processing binary and image files' do
|
71
|
+
let(:template) { Template.new({"from" => "path/to/binary/file"}, template_dir, project_dir) }
|
71
72
|
|
72
73
|
before(:each) do
|
73
|
-
File.stub(:binary?).and_return(true)
|
74
|
-
|
75
74
|
FileUtils.mkdir_p "/tmp/template/sample/path/to/binary"
|
76
75
|
File.open "/tmp/template/sample/path/to/binary/file", "wb" do |from_file|
|
77
76
|
from_file.puts "content including sample name"
|
78
77
|
end
|
79
78
|
end
|
80
79
|
|
81
|
-
it 'should not replace occurances of the template name' do
|
80
|
+
it 'should not replace occurances of the template name in binary files' do
|
81
|
+
File.stub(:binary?).and_return(true)
|
82
|
+
File.stub(:image?).and_return(false)
|
83
|
+
|
84
|
+
template.process
|
85
|
+
File.read("/tmp/output/new_project/path/to/binary/file").should include("sample")
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should not replace occurances of the template name in image files' do
|
89
|
+
File.stub(:binary?).and_return(false)
|
90
|
+
File.stub(:image?).and_return(true)
|
91
|
+
|
82
92
|
template.process
|
83
93
|
File.read("/tmp/output/new_project/path/to/binary/file").should include("sample")
|
84
94
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe 'templates' do
|
4
|
+
|
5
|
+
it 'should have a list of available templates' do
|
6
|
+
Templates.all_templates.should_not be_empty
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'each available template' do
|
10
|
+
it 'should be specified by the name of the template, not the path' do
|
11
|
+
Templates.all_templates.each do |template_name|
|
12
|
+
File.basename(template_name).should == template_name
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should have a valid template name' do
|
17
|
+
Templates.all_templates.each do |template_name|
|
18
|
+
template = Templates.new(template_name)
|
19
|
+
template.template_name.should == template_name
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should have a path ending to the template name' do
|
24
|
+
Templates.all_templates.each do |template_name|
|
25
|
+
template = Templates.new(template_name)
|
26
|
+
File.basename(template.path).should == template_name
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should have a valid manifest' do
|
31
|
+
Templates.all_templates.each do |template_name|
|
32
|
+
template = Templates.new(template_name)
|
33
|
+
File.exists?(template.manifest).should be_true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcbootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stewart Gleadow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01
|
11
|
+
date: 2014-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ptools
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.2.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.2.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: '0.18'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: '0.18'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/xcbootstrap/cli.rb
|
94
94
|
- lib/xcbootstrap/next_steps.txt
|
95
95
|
- lib/xcbootstrap/template.rb
|
96
|
+
- lib/xcbootstrap/templates.rb
|
96
97
|
- lib/xcbootstrap/version.rb
|
97
98
|
- templates/Sample/Sample.xcodeproj/project.pbxproj
|
98
99
|
- templates/Sample/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
|
@@ -177,8 +178,9 @@ files:
|
|
177
178
|
- spec/unit/bootstrap_spec.rb
|
178
179
|
- spec/unit/cli_spec.rb
|
179
180
|
- spec/unit/template_spec.rb
|
181
|
+
- spec/unit/templates_spec.rb
|
180
182
|
- bin/xcbootstrap
|
181
|
-
homepage: https://github.com/sgleadow/
|
183
|
+
homepage: https://github.com/sgleadow/xcbootstrap
|
182
184
|
licenses: []
|
183
185
|
metadata: {}
|
184
186
|
post_install_message:
|
@@ -197,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
199
|
version: '0'
|
198
200
|
requirements: []
|
199
201
|
rubyforge_project:
|
200
|
-
rubygems_version: 2.0.
|
202
|
+
rubygems_version: 2.0.5
|
201
203
|
signing_key:
|
202
204
|
specification_version: 4
|
203
205
|
summary: Bootstrap iOS projects with builds and testing already configured
|
@@ -207,3 +209,4 @@ test_files:
|
|
207
209
|
- spec/unit/bootstrap_spec.rb
|
208
210
|
- spec/unit/cli_spec.rb
|
209
211
|
- spec/unit/template_spec.rb
|
212
|
+
- spec/unit/templates_spec.rb
|