groue / GRMustache.swift

Flexible Mustache templates for Swift
http://mustache.github.com/
MIT License
601 stars 154 forks source link

cocoapods support #4

Closed bluecitymoon closed 9 years ago

bluecitymoon commented 9 years ago

I find that I can't include this framework with command pod install. could you please add cocoapods support? I tried obj-c version and it is supported

bluecitymoon commented 9 years ago

Fetching external sources -> Pre-downloading: Mustache from https://github.com/groue/GRMustache.swift.git

Git download Git download $ /usr/bin/git clone https://github.com/groue/GRMustache.swift.git /Users/jerryjiang/Documents/workspace/trunk/Pods/Mustache --single-branch --depth 1 Cloning into '/Users/jerryjiang/Documents/workspace/trunk/Pods/Mustache'... [!] No podspec exists at path /Users/jerryjiang/Documents/workspace/trunk/Pods/Mustache/Mustache.podspec.json.

/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.36.4/lib/cocoapods-core/specification.rb:527:in from_file' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/external_sources/abstract_external_source.rb:142:instore_podspec' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/external_sources/abstract_external_source.rb:112:in block in pre_download' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/user_interface.rb:70:intitled_section' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/external_sources/abstract_external_source.rb:99:in pre_download' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/external_sources/downloader_source.rb:13:infetch' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/installer/analyzer.rb:347:in fetch_external_source' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/installer/analyzer.rb:324:inblock (2 levels) in fetch_external_sources' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/installer/analyzer.rb:323:in each' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/installer/analyzer.rb:323:inblock in fetch_external_sources' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/user_interface.rb:49:in section' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/installer/analyzer.rb:322:infetch_external_sources' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/installer/analyzer.rb:57:in analyze' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/installer.rb:189:inanalyze' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/installer.rb:111:in block in resolve_dependencies' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/user_interface.rb:49:insection' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/installer.rb:110:in resolve_dependencies' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/installer.rb:90:ininstall!' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/command/project.rb:71:in run_install_with_update' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/command/project.rb:101:inrun' /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:312:in run' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/command.rb:46:inrun' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/bin/pod:44:in <top (required)>' /usr/bin/pod:23:inload' /usr/bin/pod:23:in `

'

groue commented 9 years ago

I'd be very happy if GRMustache.swift had a cocoapod. Could you would help making it?

groue commented 9 years ago

Are you in for building the cocoapods spec, @bluecitymoon ?

bluecitymoon commented 9 years ago

thanks for the trust but I am really new to iOS development so that I am really sorry about I can't help on it...

bluecitymoon commented 9 years ago

right now I drag the project into mine and use it as a embedded framework. Do you have some full example on rendering html file?

groue commented 9 years ago

thanks for the trust but I am really new to iOS development so that I am really sorry about I can't help on it...

OK @bluecitymoon, that's fine, and welcome on board!

right now I drag the project into mine and use it as a embedded framework.

Good, this is quite a valid technique.

Do you have some full example on rendering html file?

One you have a template resource in your project, rendering it is easy as:

let template: Template = Template(named: "Document")!
let data = ...
let rendering: String = template.render(Box(data))!

Open Mustache.xcworkspace, have a look at the MustacheDemoiOS project inside, and its Document.mustache resource.

If you don't know what is a resource, then you need to learn a really important core concept in iOS development. I strongly suggest your read the documentation: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/Introduction/Introduction.html#//apple_ref/doc/uid/10000123i. If this is too much reading for you, check StackOverflow about bundle resources.

If you don't know where to put the rendering code (the three lines above), then you may check again MustacheDemoiOS. But it is likely that you need to read some more documentation, about UIViewController this time: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/

bluecitymoon commented 9 years ago

It works!! Thanks a lot!