-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Specification refactor #253
Conversation
Sweet. I’ve at least read specification.rb and I think you’re on the right track. One question, do you have an estimate of the timeframe for this? Can we do it in 0.6, or will that push the first RC release back too long?
dependency do |s|
s.main_subspec = 'JSON'
s.subspec 'JSON' do |js|
end
s.subspec 'XML' do |js|
end
end In your example, the value for
Is that for doc generation purposes too? Otherwise I would opt for just |
Cool i was really looking for confirmation at least for that one.
Lets see at what's left tomorrow night, but I think that it could be done for 0.6. What worries me are regressions that might arise by cases covered in the specs.
Agreed on the preferred part. However this subspec is not a dependency but it is the specification that you get, which naturally inherits from the parent. If you require RestKit but you get So
My idea was that For this reason I was tempted to specify the license file as |
Get the cache for testing. * master: Enable caching for specs and remove configurable git cache size. Save Git chaches in ~/Library/Caches/CocoaPods/Git. [Downloader::Git] Skip cache pull if ref is available. Restored Pod::Downloader::Git::GitHub. [Git] Fix for Travis errors. [Git] Increased default cache to 500Mb. [Downloader::Git] Completed cache support [Git<<Downloader] Fix for url hash [Downloader::Git] Cache repos
StateThe branch still needs a good clean up, specs, and some good testing. But the logic should be there. I have tested it with ShareKit and it seems to be working. Here is the modified version of the spec. It doesn't require a Core subspec and it doesn't require an include all subspec. dependency 'ShareKit' $ pod install --no-update --no-integrate
Installing Facebook-iOS-SDK (1.2)
Installing JSONKit (1.5pre)
Installing Reachability (3.0.0)
Installing SBJson (2.2.3)
Installing SSKeychain (0.1.2)
Installing ShareKit (2.0)
- Evernote
- Facebook
- Flickr
- Foursquare
- GoogleReader
- Instapaper
- LinkedIn
- Pinboard
- ReadItLater
- Tumblr
- Twitter
- Vkontakte
Installing objectiveflickr (0.0.1)
Generating support files dependency 'ShareKit/Facebook' $ pod install --no-update --no-integrate
Installing Facebook-iOS-SDK (1.2)
Installing SBJson (2.2.3)
Installing ShareKit (2.0)
- Facebook
Generating support files Still open questions
|
Yeah that ShareKit spec does look good.
Which hash? The
Actually, what do you think of
I’m not following. Is this about the question below?
I don’t see a benefit in blacklisting vs whitelisting in this case. Naming one makes it much clearer, to the user of the spec, which specs are going to be used.
Like with the hash, I’m not sure what the concrete question is regarding the license attribute. The |
Yes, but I don't think it is a good idea anymore.
Now that I have better comprehension of the problem I see less need for substituting the parent with the Taking into account that, your original suggestion (
Blacklisting does not require to keep the list of subspecs, but this is a minor nuisance. Related: To be fair the RestKit example was approximative, as would result in a broken dependency do |s|
s.main_subspec = 'JSON'
s.subspec 'ObjectMapping' do |s|
preferred_dependency = 'JSON-Strategy'
s.subspec 'JSON-Strategy' do |s|
s.dependency = 'RestKit/ObjectMapping/JSON'
s.dependency = 'RestKit/ObjectMapping/CoreData'
...
end
s.subspec 'XML-Strategy'
s.subspec 'JSON'
s.subspec 'XML'
s.subspec 'CoreData'
...
end
...
end To present that there is a specific strategy being used I was planning to implement some logic in
Good to know that preserve paths are needed. What I plan to do is simply avoid to clean any file matching @alloy do you have any troublesome podspec to suggest for testing? |
So what do you propose?
Agreed, let's just go with that.
Do you have the actual specification somewhere? The condensed versions are making it harder to see what's going on.
Something to the effect of “installing preferred JSON subspec”? I wonder if it's really needed. If you know what you are doing such warnings only become noise. And besides, you can see from the list of specs being installed that it chose the JSON subspec, right?
I think RestKit is definitely one of the most advanced ones. Also note how the callbacks are being handled by extending it with a module. Is that already fixed by your simplification of a spec and its subspecs? |
We should also avoid cleaning On master, if you use an external dependency ( The reason is that the second time it doesn't see the previously fetched (and cleaned) podspec, so it will try to fetch the dependency again to the same dir which is now not empty. |
@jeanregisser Thanks for pointing this out. |
The refactor is almost complete the remaining issues are:
I was tempted to remove the file key from the
I changed my mind also on this one. The current proposals are available here.
Good points that I missed on this update... however the current implementation should be fine. The installer output is |
yield self if block_given? | ||
end | ||
|
||
# TODO This is just to work around a MacRuby bug |
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.
MacRuby is not used anymore, so this is not needed... right?
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.
Indeed! You can just merge the code with the normal #initialize method.
The actual warning: ./spec/unit/sandbox_spec.rb:4: warning: already initialized constant TMP_POD_ROOT Pod::Sandbox
One of the tests wasn't restoring the changes it made to the config. As the test was difficult to track down and the problem would have become only worse in the future, the issues was solved starting with a new config before each run. The performance impact seems negligible and the testing environment is more predictable.
- Usually only the header files are commented. - The header files don't include private categories. - Performance gains, as doc generation is quite slow.
Fair enough. I think the issue I had was that I’m (currently) checking the Pods directory into SCM, which means that when I work on another machine, I don’t get the docs on a
Nice, that’s definitely the right approach.
I think we should totally get rid of the notion that people can override these methods, is that now the case? Regarding the |
Man, this PR is epic :D Kudos! |
Regarding the documentation I have removed the force_doc option.
It should be as far I'm concerned.
:-) The refactor is missing some specs for the |
How about you write some disabled stub spec descriptions so that we know what has to be done? Then I can possibly work on them too. I would do that in a separate merge, though, let's merge this bad boy asap. |
Ok, I've added the disabled specs. |
Cool. So, time to merge? :) |
Yes 🎉 If you don't have any objections I will also merge the sister branch in the specs repo to in the 0.6 branch. |
✨ 🌟 ✨ |
Go ahead. You don’t need to ask me anymore about these things, you are as much responsible for these areas of the code as much as I am nowadays :) |
Attempt to refactor the specification class. It is still a work in progress.
Objective
Have a clean hierarchy of specifications nodes:
Discusion
This is an experiment performed in total freedom (even in code style) and might have unwanted features that can be rolled back.
SubSpec class
The subspec class was decoupling inheritance logic from attributes specification and thus was removed and replaced with meta programming. Every specification can have a parent. If no parent is provided it is a top level specification.
Moreover, the subspec class was requiring its parent and this logic has been removed, in favor of the inheritance logic specified at the attribute level.
Inheritance
Will require result in the following specs being loaded:
However, to handle incompatible different strategies it is possible to specify a main subspec:
Is not fully implemented yet butthis will result in theRestKit
spec returningRestKit/JSON
instead of itself so pod installs tells to newbies that they are using a json specific strategy.Attributes inheritance
Some attributes can be specified only at the top level. They are what uniquely identifies a pod, can't be assigned by pods that have a parent (raises) and always return the top level value.
Other attributes are resolved back in the chain. For example every spec inherits all the frameworks required by its parents. The same logic will be applied to source files and if there are any duplicates local pod will filter the unique values. Looking at the code should be clear how every attribute is handled.
Todo
readme_file
attribute to specification.preserve_files
attribute.local pod will receive a all the specifications sharing a common parentit will be able to remove duplicates (source files, frameworks, xconfig, ...).Speficiation#activate_for_platform
activates a given platform so the attr readers return the value for the platform and clients will not need to be aware of which attributes are multiplatform.Related Issues