-
Notifications
You must be signed in to change notification settings - Fork 351
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
Added module_name
attribute.
#209
Changes from all commits
113a1f0
4633668
1d37045
c897bd2
a23dcd4
f65331b
ed492e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -780,6 +780,25 @@ def dependency(*args) | |
|
||
#------------------# | ||
|
||
# @!method module_name=(name) | ||
# | ||
# The name to use for the framework / clang module which | ||
# will be generated for this specification instead of the | ||
# default (header_dir if set, otherwise the specification | ||
# name). | ||
# | ||
# @example | ||
# | ||
# spec.module_name = 'Three20' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lolol There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome :D |
||
# | ||
# @param [String] name | ||
# the module name. | ||
# | ||
root_attribute :module_name, | ||
:inherited => true | ||
|
||
#------------------# | ||
|
||
# @!method header_dir=(dir) | ||
# | ||
# The directory where to store the headers files so they don't break | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -497,5 +497,59 @@ module Pod | |
|
||
#-------------------------------------------------------------------------# | ||
|
||
describe 'module name' do | ||
it 'uses the specification name as module name by default' do | ||
spec = Specification.new(nil, 'Three20') | ||
spec.module_name.should == 'Three20' | ||
end | ||
|
||
it 'converts the name to a C99 identifier if required' do | ||
spec = Specification.new(nil, '500px') | ||
spec.module_name.should == '_500px' | ||
end | ||
|
||
it 'uses the header_dir as module name if specified' do | ||
spec = Specification.new(nil, 'Three20.swift') | ||
spec.header_dir = 'Three20' | ||
spec.module_name.should == 'Three20' | ||
end | ||
|
||
it 'converts the header_dir to a C99 identifier if required' do | ||
spec = Specification.new(nil, 'Three20.swift') | ||
spec.header_dir = 'Three-20' | ||
spec.module_name.should == 'Three_20' | ||
end | ||
|
||
it 'uses the defined module name if specified' do | ||
spec = Specification.new(nil, 'Three20.swift') | ||
spec.header_dir = 'Three20Core' | ||
spec.module_name = 'Three20' | ||
spec.module_name.should == 'Three20' | ||
end | ||
end | ||
|
||
#-------------------------------------------------------------------------# | ||
|
||
describe '#c99ext_identifier' do | ||
before do | ||
@spec = Specification.new | ||
end | ||
|
||
it 'should mask, but keep leading numbers' do | ||
@spec.send(:c99ext_identifier, '123BananaLib').should == '_123BananaLib' | ||
end | ||
|
||
it 'should mask invalid chars' do | ||
@spec.send(:c99ext_identifier, 'iOS-App BânánàLïb').should == 'iOS_App_BananaLib' | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about normalising instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea! |
||
|
||
it 'should flatten multiple underscores to a single one' do | ||
@spec.send(:c99ext_identifier, '$.swift').should == '_swift' | ||
end | ||
|
||
end | ||
|
||
#-------------------------------------------------------------------------# | ||
|
||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this possibly also need to take
header_mapping_dir
into account?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, as it doesn't change names, but just ensures that a certain structure is preserved. Also using it will most probably break for frameworks as a header directory structure is not possible inside a framework.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is a good thing to consider. Is it really not allowed or simply not the common way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It cannot be created with Xcode, unsure what happens if one creates some subdirectories in a framework after the fact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be tested, because there will be libraries that currently require this to work.