Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
alexiscreuzot committed Jun 13, 2016
1 parent dc30ce3 commit 326602e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions defaults/liftoffrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ templates:
- setup.sh: bin/setup
- README.md: README.md

additional_resource_suffixes:
- txt

warnings:
- GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED
- GCC_WARN_MISSING_PARENTHESES
Expand Down
8 changes: 7 additions & 1 deletion lib/liftoff/project_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ def linkable_file?(name)
end

def resource_file?(name)
name.end_with?('xcassets', 'bundle', 'xib', 'storyboard')
suffixes = ['xcassets', 'bundle', 'xib', 'storyboard'].concat(@config.additional_resource_suffixes)
suffixes.each do |suffix|
if name.end_with?(suffix)
return true
end
end
return false
end

def template_file?(object)
Expand Down
5 changes: 5 additions & 0 deletions lib/liftoff/project_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ProjectConfiguration
:indentation_level,
:warnings,
:templates,
:additional_resource_suffixes,
:project_template,
:app_target_templates,
:test_target_templates,
Expand Down Expand Up @@ -66,6 +67,10 @@ def each_template(&block)
end
end

def additional_resource_suffixes
@additional_resource_suffixes ||= []
end

def get_binding
binding
end
Expand Down
10 changes: 10 additions & 0 deletions spec/project_configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@
end
end

describe '#additional_resource_suffixes' do
it 'returns an array of suffixes' do
additional_resource_suffixes = ['foo', 'bar']

config = Liftoff::ProjectConfiguration.new({:additional_resource_suffixes => additional_resource_suffixes})

expect(config.additional_resource_suffixes).to eq(['foo', 'bar'])
end
end

describe '#app_target_groups' do
context 'when the project_template is set to swift' do
it 'returns the swift app target groups' do
Expand Down
1 change: 1 addition & 0 deletions templates/resource_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
txt test

0 comments on commit 326602e

Please sign in to comment.