diff --git a/defaults/liftoffrc b/defaults/liftoffrc index 31f056b..2bc37c0 100644 --- a/defaults/liftoffrc +++ b/defaults/liftoffrc @@ -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 diff --git a/lib/liftoff/project_builder.rb b/lib/liftoff/project_builder.rb index 8321fc6..14419cb 100644 --- a/lib/liftoff/project_builder.rb +++ b/lib/liftoff/project_builder.rb @@ -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) diff --git a/lib/liftoff/project_configuration.rb b/lib/liftoff/project_configuration.rb index e58ccc7..b3542ad 100644 --- a/lib/liftoff/project_configuration.rb +++ b/lib/liftoff/project_configuration.rb @@ -11,6 +11,7 @@ class ProjectConfiguration :indentation_level, :warnings, :templates, + :additional_resource_suffixes, :project_template, :app_target_templates, :test_target_templates, @@ -66,6 +67,10 @@ def each_template(&block) end end + def additional_resource_suffixes + @additional_resource_suffixes ||= [] + end + def get_binding binding end diff --git a/spec/project_configuration_spec.rb b/spec/project_configuration_spec.rb index a218ace..b496028 100644 --- a/spec/project_configuration_spec.rb +++ b/spec/project_configuration_spec.rb @@ -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 diff --git a/templates/resource_test.txt b/templates/resource_test.txt new file mode 100644 index 0000000..ee9a1d4 --- /dev/null +++ b/templates/resource_test.txt @@ -0,0 +1 @@ +txt test \ No newline at end of file