-
Notifications
You must be signed in to change notification settings - Fork 17
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
Html rendering #47
Open
lolgear
wants to merge
22
commits into
CocoaPods:master
Choose a base branch
from
lolgear:html_rendering
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Html rendering #47
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
d7789e2
gem: rvm ruby gemset and version added.
lolgear eb1543e
gitignore: updated in case of xcode project example project.
lolgear e5bc6aa
spec: example xcode project added.
lolgear 9a8d14b
gem: html acknowledgements rendering added.
lolgear bef1e1c
gem: rvm files removed.
lolgear a455178
gem: fix indentation.
lolgear 694d867
gem: writers html nokogiri dependency removed.
lolgear d3ee536
gem: gemspec trailing newline added.
lolgear 947f4ca
gemspec: nokogiri dependency removed.
lolgear 3b7c780
changelog: updated.
lolgear b6e79fa
gem: html generator has been updated.
lolgear 78ecf99
gem: spec assets example project has been updated.
lolgear c6cdf19
gem: html writer dsl has been added.
lolgear e571bb6
gem: markdown writer has been added. erb writer variants has been added.
lolgear b002205
gem: specs assets example project markdown acknowledgements file has …
lolgear a35e4ad
gem: erb writers variants cleanup.
lolgear 4742148
gem: markdown erb-free writer has been added. gitignore has been fixed.
lolgear de284c3
gem: html layout module has been added. gitignore ds_store has been a…
lolgear 02dc5fa
gem: markdown render settings have been added. generators have been s…
lolgear 7ca1b48
gem: markdown parser have been removed from writers.
lolgear 5b18d4d
gem: metadata generators have been tangled with writers instead of ba…
lolgear 0dc1721
Merge remote-tracking branch 'upstream/master' into html_rendering.
lolgear File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module CocoaPodsAcknowledgements | ||
module Auxiliaries | ||
def file_accessor(spec, platform, sandbox) | ||
pod_root = sandbox.pod_dir(spec.name) | ||
if pod_root.exist? | ||
path_list = Pod::Sandbox::PathList.new(pod_root) | ||
Pod::Sandbox::FileAccessor.new(path_list, spec.consumer(platform)) | ||
end | ||
end | ||
|
||
# Returns the text of the license for the given spec. | ||
# | ||
# @param [Specification] spec | ||
# the specification for which license is needed. | ||
# | ||
# @return [String] The text of the license. | ||
# @return [Nil] If not license text could be found. | ||
# | ||
def license_text(spec, file_accessor) | ||
return nil unless spec.license | ||
text = spec.license[:text] | ||
unless text | ||
if file_accessor | ||
if license_file = file_accessor.license | ||
if license_file.exist? | ||
text = IO.read(license_file) | ||
else | ||
Pod::UI.warn "Unable to read the license file `#{license_file }` " \ | ||
"for the spec `#{spec}`" | ||
end | ||
end | ||
end | ||
end | ||
text | ||
end | ||
end | ||
end | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'cocoapods_acknowledgements/auxiliaries' | ||
module CocoaPodsAcknowledgements | ||
class Generator | ||
class << self | ||
include Auxiliaries | ||
|
||
def generate_specs(target_description, sandbox, excluded, root_specs) | ||
[] | ||
end | ||
|
||
def generate(target_description, sandbox, excluded) | ||
root_specs = target_description.specs.map(&:root).uniq.reject {|spec| excluded.include?(spec.name)} | ||
return nil if root_specs.empty? | ||
generate_specs(target_description, sandbox, excluded, root_specs) | ||
end | ||
end | ||
end | ||
end | ||
|
||
module CocoaPodsAcknowledgements | ||
class Generator | ||
class SpecObject | ||
attr_accessor :name, :version, :authors, :socialMedialURL, :summary, | ||
:description, :licenseType, :licenseText, :homepage | ||
def initialize(options) | ||
@name = options["name"] | ||
@version = options["version"] | ||
@authors = options["authors"] | ||
@socialMediaURL = options["socialMediaURL"] | ||
@summary = options["summary"] | ||
@description = options["description"] | ||
@licenseType = options["licenseType"] | ||
@licenseText = options["licenseText"] | ||
@homepage = options["homepage"] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'cocoapods_acknowledgements/markdown_parser' | ||
require 'cocoapods_acknowledgements/generator' | ||
|
||
module CocoaPodsAcknowledgements | ||
class HTMLGenerator < PlistGenerator | ||
class << self | ||
def generate_specs(target_description, sandbox, excluded, root_specs) | ||
metadata = super | ||
specs = metadata["specs"] | ||
metadata["specs"] = specs.map do |spec| | ||
Generator::SpecObject.new(spec) | ||
end | ||
metadata["header"] = header | ||
metadata["footer"] = footer | ||
metadata | ||
end | ||
|
||
def header | ||
'Acknowledgements' | ||
end | ||
|
||
def footer | ||
'Generated by CocoaPods - https://cocoapods.org' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
module CocoaPodsAcknowledgements | ||
module HTMLLayout | ||
end | ||
end | ||
|
||
module CocoaPodsAcknowledgements::HTMLLayout | ||
class HTMLObject | ||
attr_accessor :tag | ||
attr_accessor :children | ||
|
||
def tag_begin | ||
"<#{tag}>" | ||
end | ||
|
||
def tag_end | ||
"</#{tag}>" | ||
end | ||
|
||
def layout | ||
[tag_begin, children.map(&:layout), tag_end].join("\n") | ||
end | ||
|
||
def initialize | ||
@children = [] | ||
end | ||
|
||
def << (object) | ||
@children << object | ||
end | ||
|
||
class << self | ||
def tag(tag) | ||
item = new | ||
item.tag = tag | ||
item | ||
end | ||
end | ||
end | ||
end | ||
|
||
module CocoaPodsAcknowledgements::HTMLLayout | ||
class MarkdownObject < HTMLObject | ||
def tag_begin | ||
tag | ||
end | ||
def tag_end | ||
tag | ||
end | ||
def layout | ||
([ | ||
[tag_begin, children.first.layout, tag_end].join(" ") | ||
] + children.drop(1).map(&:layout)).join("\n\n") | ||
end | ||
end | ||
end | ||
|
||
module CocoaPodsAcknowledgements::HTMLLayout | ||
class ContentObject < HTMLObject | ||
attr_accessor :content | ||
|
||
def tag_begin | ||
"" | ||
end | ||
|
||
def tag_end | ||
"" | ||
end | ||
|
||
def layout | ||
content | ||
end | ||
|
||
class << self | ||
def content(html) | ||
new_object = new | ||
new_object.content = html | ||
new_object | ||
end | ||
end | ||
end | ||
end | ||
|
||
module CocoaPodsAcknowledgements::HTMLLayout | ||
class HTMLObjectBuilder | ||
attr_accessor :root_object | ||
attr_accessor :current_object | ||
attr_accessor :parent_object | ||
|
||
def initialize(&block) | ||
@root_object = nil | ||
@current_object = nil | ||
if block | ||
block.call(self) | ||
end | ||
end | ||
|
||
def base_object | ||
HTMLObject | ||
end | ||
|
||
def tag_or_object(tag) | ||
if tag.is_a? base_object | ||
tag | ||
else | ||
base_object.tag tag | ||
end | ||
end | ||
|
||
def open(tag) | ||
new_object = tag_or_object tag | ||
|
||
unless @root_object | ||
@root_object = new_object | ||
@current_object = @root_object | ||
@parent_object = @root_object | ||
else | ||
@parent_object = @current_object | ||
@current_object << new_object | ||
@current_object = new_object | ||
end | ||
end | ||
|
||
def close | ||
@current_object = @parent_object | ||
end | ||
|
||
def tag(tag, &block) | ||
self.open tag | ||
if block | ||
block.call(self) | ||
end | ||
self.close | ||
end | ||
|
||
def content(html) | ||
@current_object << ContentObject.content(html) | ||
end | ||
|
||
def layout | ||
root_object.layout | ||
end | ||
end | ||
end | ||
|
||
# MARK: DSL | ||
class CocoaPodsAcknowledgements::HTMLLayout::HTMLObjectBuilder | ||
def > (tag) | ||
self.open tag | ||
self | ||
end | ||
def ! | ||
self.close | ||
self | ||
end | ||
def << (html) | ||
self.content(html) | ||
self | ||
end | ||
def >= (tag) | ||
self > tag | ||
!self | ||
end | ||
def <= (html) | ||
self << html | ||
!self | ||
end | ||
end | ||
|
||
module CocoaPodsAcknowledgements::HTMLLayout | ||
class MarkdownObjectBuilder < HTMLObjectBuilder | ||
def base_object | ||
MarkdownObject | ||
end | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
trailing newlines missing in all these files, everything should also be using 2 spaces for indentation