Skip to content
This repository was archived by the owner on Mar 21, 2018. It is now read-only.

Commit 9bee9fb

Browse files
committed
Merge pull request #292 from CocoaPods/seg-fixes
Random changes
2 parents 181d0b9 + 08b1339 commit 9bee9fb

5 files changed

Lines changed: 36 additions & 34 deletions

File tree

classes/_utils.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
def command(command_to_run)
44
puts " " + command_to_run.yellow if $verbose
5-
success = system command_to_run
5+
success = system(*command_to_run)
66

77
# appledoc always fails for me ... ?
8-
if !success && !command_to_run.strip.start_with?("appledoc")
9-
puts (command_to_run + " failed!").red
8+
if !success && !command_to_run.join(' ').strip.start_with?("vendor/appledoc")
9+
puts (command_to_run.join(' ') + " failed!").red
1010
end
1111
end
1212

classes/cloc_stats_generator.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require 'yaml'
2+
require 'shellwords'
23

34
class ClocStatsGenerator
45
include HashInit
@@ -31,7 +32,7 @@ def generate
3132
return {}
3233
end
3334

34-
yaml = `cloc #{@options.join(' ')} #{source_files.join(' ')}`
35+
yaml = `cloc #{@options.join(' ')} #{source_files.map(&:shellescape).join(' ')}`
3536
vputs "cloc #{@options.join(' ')} #{source_files.join(' ')}"
3637
if yaml.strip.length == 0
3738
puts "Got nothing from CLOC, are you on a version of cloc with swift support? ( 1.6.2+)".red

classes/docset_fixer.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class DocsetFixer
77
attr_accessor :docset_path, :readme_path, :pod_root, :spec, :css_path, :doc_percent, :versions
88

99
def fix
10-
@version = @versions.last
10+
@version = spec.version
1111
remove_html_folder
1212
delete_extra_docset_folder
1313
fix_relative_links_in_gfm
@@ -24,7 +24,7 @@ def fix
2424
end
2525

2626
def fix_for_jazzy
27-
@version = @versions.last
27+
@version = spec.version
2828
fix_relative_links_in_gfm('article.chapter')
2929
remove_known_badges
3030
remove_named_header
@@ -282,9 +282,11 @@ def create_dash_data
282282
def add_index_redirect_to_latest_to_pod
283283
vputs "Creating a redirect to move to the latest pod"
284284

285+
latest_version = versions.reverse_each.find { |v| v !~ /[a-zA-Z_-]/ } || versions.last
286+
285287
from = @pod_root + "/index.html"
286288
server_location = "docsets/#{@spec.name}/index.html"
287-
to = "docsets/#{@spec.name}/#{@version}"
289+
to = "docsets/#{@spec.name}/#{latest_version}"
288290

289291
puts "-------------"
290292
puts to

classes/docset_generator.rb

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def create_docset
1111
cocoadocs_id = "com.cocoadocs.#{@spec.name.downcase}"
1212

1313
headers = headers_for_spec_at_location @spec
14-
headers.map! { |header| Shellwords.escape header }
1514
headers = [from] if headers.count == 0
1615

1716
guides = GuidesGenerator.new(spec: @spec, source_download_location: @source_download_location)
@@ -23,45 +22,45 @@ def create_docset
2322

2423
docset_command = [
2524
"vendor/appledoc",
26-
"--project-name #{@spec.name}", # name in top left
27-
"--project-company \"#{@spec.or_contributors_to_spec}\"", # name in top right
28-
"--company-id #{cocoadocs_id}", # the id for the
25+
"--project-name", @spec.name, # name in top left
26+
"--project-company", @spec.or_contributors_to_spec, # name in top right
27+
"--company-id", "#{cocoadocs_id}", # the id for the
2928

30-
"--project-version #{version}", # project version
31-
"--no-install-docset", # don't make a duplicate
29+
"--project-version", "#{version}", # project version
30+
"--no-install-docset", # don't make a duplicate
3231

33-
"--templates \"#{@appledoc_templates_path}\"", # use the custom template
34-
"--verbose #{verbosity}", # give some useful logs
32+
"--templates", @appledoc_templates_path, # use the custom template
33+
"--verbose", "#{verbosity}", # give some useful logs
3534

36-
"--keep-intermediate-files", # space for now is OK
37-
"--create-html", # eh, nice to have
38-
"--publish-docset", # this should create atom
35+
"--keep-intermediate-files", # space for now is OK
36+
"--create-html", # eh, nice to have
37+
"--publish-docset", # this should create atom
3938

40-
"--docset-feed-url #{$website_home}docsets/#{@spec.name}/xcode-docset.atom",
41-
"--docset-atom-filename xcode-docset.atom",
39+
"--docset-feed-url", "#{$website_home}docsets/#{@spec.name}/xcode-docset.atom",
40+
"--docset-atom-filename", "xcode-docset.atom",
4241

43-
"--docset-package-url #{$website_home}docsets/#{@spec.name}/docset.xar",
44-
"--docset-package-filename docset",
42+
"--docset-package-url", "#{$website_home}docsets/#{@spec.name}/docset.xar",
43+
"--docset-package-filename", "docset",
4544

46-
"--docset-fallback-url #{$website_home}docsets/#{@spec.name}",
47-
"--docset-feed-name #{@spec.name}",
45+
"--docset-fallback-url", "#{$website_home}docsets/#{@spec.name}",
46+
"--docset-feed-name", "#{@spec.name}",
4847

4948
# http://gentlebytes.com/appledoc-docs-examples-advanced/
5049
"--keep-undocumented-objects", # not everyone will be documenting
5150
"--keep-undocumented-members", # so we should at least show something
5251
"--search-undocumented-doc", # uh? ( no idea what this does... )
5352

54-
guides.generate_string_for_appledoc,
53+
*guides.generate_array_for_appledoc,
5554

56-
"--output \"#{@to}\"", # where should we throw stuff
55+
"--output", to, # where should we throw stuff
5756
*headers
5857
]
5958

6059
if File.exist? readme_location
61-
docset_command.insert(3, "--index-desc resources/overwritten_index.html")
60+
docset_command.insert(3, "--index-desc", "resources/overwritten_index.html")
6261
end
6362

64-
command docset_command.join(' ')
63+
command docset_command
6564

6665
fail "Appledoc crashed in creating the DocSet for this project." unless Dir.exist? to
6766

classes/guides_generator.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ class GuidesGenerator
44
include HashInit
55
attr_accessor :spec, :source_download_location
66

7-
def generate_string_for_appledoc
7+
def generate_array_for_appledoc
88
settings = cocoadocs_settings
9-
return "" if settings.nil?
10-
return "" unless settings.key? "additional_guides"
9+
return if settings.nil?
10+
return unless settings.key? "additional_guides"
1111

1212
guides = settings["additional_guides"]
13-
return "" unless guides.is_a? Array
14-
return "" if guides.count == 0
13+
return unless guides.is_a? Array
14+
return if guides.count == 0
1515

1616
vputs "Grabbing additional programming guides"
1717

@@ -53,7 +53,7 @@ def generate_string_for_appledoc
5353

5454
end
5555

56-
" --include " + File.join(@source_download_location, guides_folder)
56+
["--include", File.join(@source_download_location, guides_folder)]
5757
end
5858

5959
def cocoadocs_settings

0 commit comments

Comments
 (0)