Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #273 #274

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [105/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

suffixes.each do |suffix|
if name.end_with?(suffix)
return true
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected.

return false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant return detected.

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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.

: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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

additional_resource_suffixes = ['foo', 'bar']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [113/80]
Redundant curly braces around a hash parameter.
Use the new Ruby 1.9 hash syntax.
Space inside { missing.
Space inside } missing.


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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

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