Skip to content
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

Swift 2.0 #261

Merged
merged 25 commits into from
Sep 8, 2015
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
01cc611
changes to support swift 2
jpsim Aug 26, 2015
8feb5ad
[Markdown] Ignore special tokens in list items
segiddins Jul 29, 2015
7e737af
Fixed broken extension? test
pcantrell Aug 2, 2015
10d50e9
Don’t document empty extensions
pcantrell Aug 2, 2015
bc5ba11
update SourceKitten, Realm, Alamofire & fix rubocop issues
jpsim Aug 26, 2015
356e1b4
[Travis] update to Xcode 7 beta 6 image
jpsim Aug 28, 2015
be5f49c
Custom categorization
pcantrell Aug 2, 2015
0edc0ba
Docs files grouped by type, even w/custom category file
pcantrell Aug 7, 2015
9fd34bf
Command-line help for custom categories
pcantrell Sep 3, 2015
7e161ea
Re-fixed bogus type name in error message
pcantrell Sep 4, 2015
3440869
Fixed subdirs for nested types
pcantrell Sep 4, 2015
9f6b9a1
Concessions to Rubocop
pcantrell Sep 4, 2015
1b9afc0
Fixed parse_config_file invocation
pcantrell Sep 4, 2015
4788efd
Reinstated space deleted during Rubocop cleanup
pcantrell Sep 4, 2015
b55dbf8
keep old copyright-related stuff for backwards compatibility
jpsim Sep 4, 2015
a906ba3
[Config] set default Swift version to 2.0
jpsim Sep 4, 2015
8cc49bd
bump integration specs
jpsim Sep 7, 2015
32b0ced
re-add Moya integration spec
jpsim Sep 7, 2015
9d703f7
[Specs] split integration specs for Swift 1.2 & Swift 2.0 & add Travi…
jpsim Sep 7, 2015
a5a75e9
[Travis] shouldn't need to install bundler or update submodules
jpsim Sep 7, 2015
34e47fd
[Travis] re-enable recursive submodules
jpsim Sep 7, 2015
977cb6f
re-added ReST definition stripping for Swift < 2 and added Alamofire …
jpsim Sep 7, 2015
59f9abf
bumped SourceKitten to 0.5.0
jpsim Sep 8, 2015
c770a85
[CHANGELOG] added several missing entries
jpsim Sep 8, 2015
8fc5469
[CHANGELOG] credit @segiddins for his Swift 2 contributions
jpsim Sep 8, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode6.4
osx_image: xcode7
cache: bundler
branches:
only:
Expand Down
2 changes: 1 addition & 1 deletion SourceKitten
Submodule SourceKitten updated 66 files
+28 −2 .gitignore
+3 −3 .gitmodules
+1 −1 .travis.yml
+16 −0 CHANGELOG.md
+2 −2 Cartfile
+1 −1 Cartfile.private
+5 −5 Cartfile.resolved
+1 −1 Carthage/Checkouts/Commandant
+0 −1 Carthage/Checkouts/LlamaKit
+1 −0 Carthage/Checkouts/Result
+1 −1 Carthage/Checkouts/SWXMLHash
+1 −1 Carthage/Checkouts/SwiftXPC
+1 −1 Carthage/Checkouts/xcconfigs
+14 −2 README.md
+2 −2 Source/SourceKittenFramework/Array+SourceKitten.swift
+16 −46 Source/SourceKittenFramework/ClangTranslationUnit.swift
+4 −4 Source/SourceKittenFramework/Dictionary+Merge.swift
+66 −117 Source/SourceKittenFramework/File.swift
+2 −2 Source/SourceKittenFramework/Info.plist
+0 −90 Source/SourceKittenFramework/Language.swift
+21 −71 Source/SourceKittenFramework/Module.swift
+22 −21 Source/SourceKittenFramework/OffsetMap.swift
+21 −23 Source/SourceKittenFramework/Request.swift
+0 −22 Source/SourceKittenFramework/SequenceType+SourceKitten.swift
+65 −0 Source/SourceKittenFramework/SourceDeclaration.swift
+2 −0 Source/SourceKittenFramework/SourceKittenFramework.h
+79 −74 Source/SourceKittenFramework/String+SourceKitten.swift
+7 −7 Source/SourceKittenFramework/Structure.swift
+5 −1 Source/SourceKittenFramework/SwiftDeclarationKind.swift
+42 −75 Source/SourceKittenFramework/SwiftDocKey.swift
+10 −8 Source/SourceKittenFramework/SwiftDocs.swift
+15 −33 Source/SourceKittenFramework/SwiftXPC+JSON.swift
+8 −2 Source/SourceKittenFramework/SyntaxKind.swift
+21 −18 Source/SourceKittenFramework/SyntaxMap.swift
+8 −8 Source/SourceKittenFramework/SyntaxToken.swift
+166 −0 Source/SourceKittenFramework/Xcode.swift
+10 −2 Source/SourceKittenFramework/clang-c/BuildSystem.h
+87 −13 Source/SourceKittenFramework/clang-c/Index.h
+38 −0 Source/SourceKittenFramework/clang-c/Makefile
+4 −0 Source/SourceKittenFramework/clang-c/module.modulemap
+1 −1 Source/SourceKittenFramework/sourcekitd.swift
+1 −1 Source/SourceKittenFrameworkTests/ClangTranslationUnitTests.swift
+16 −0 Source/SourceKittenFrameworkTests/FileTests.swift
+275 −100 Source/SourceKittenFrameworkTests/Fixtures/Bicycle.json
+25 −25 Source/SourceKittenFrameworkTests/Fixtures/Bicycle.swift
+996 −816 Source/SourceKittenFrameworkTests/Fixtures/Commandant.json
+1 −1 Source/SourceKittenFrameworkTests/Info.plist
+19 −27 Source/SourceKittenFrameworkTests/ModuleTests.swift
+6 −3 Source/SourceKittenFrameworkTests/OffsetMapTests.swift
+109 −0 Source/SourceKittenFrameworkTests/SourceKitTests.swift
+29 −48 Source/SourceKittenFrameworkTests/StringTests.swift
+31 −21 Source/SourceKittenFrameworkTests/StructureTests.swift
+1 −1 Source/SourceKittenFrameworkTests/SwiftDocsTests.swift
+3 −3 Source/SourceKittenFrameworkTests/SyntaxTests.swift
+1 −1 Source/sourcekitten/Components.plist
+21 −22 Source/sourcekitten/DocCommand.swift
+2 −7 Source/sourcekitten/Errors.swift
+2 −2 Source/sourcekitten/Info.plist
+10 −11 Source/sourcekitten/StructureCommand.swift
+8 −12 Source/sourcekitten/SyntaxCommand.swift
+5 −6 Source/sourcekitten/VersionCommand.swift
+2 −2 SourceKitten.xcworkspace/contents.xcworkspacedata
+2 −2 jazzy.sh
+58 −27 sourcekitten.xcodeproj/project.pbxproj
+8 −4 sourcekitten.xcodeproj/xcshareddata/xcschemes/SourceKittenFramework.xcscheme
+8 −5 sourcekitten.xcodeproj/xcshareddata/xcschemes/sourcekitten.xcscheme
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>15A235d</string>
<string>15A263e</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -20,22 +20,26 @@
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>6E35b</string>
<string>7A192o</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>14D125</string>
<string>15A244e</string>
<key>DTSDKName</key>
<string>macosx10.10</string>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0640</string>
<string>0700</string>
<key>DTXcodeBuild</key>
<string>6E35b</string>
<string>7A192o</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2014 Carthage. All rights reserved.</string>
</dict>
Expand Down

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,44 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>15A235d</string>
<string>15A263e</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>LlamaKit</string>
<string>Result</string>
<key>CFBundleIdentifier</key>
<string>net.robnapier.LlamaKit</string>
<string>com.antitypical.Result</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>LlamaKit</string>
<string>Result</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>0.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>6E35b</string>
<string>7A192o</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>14D125</string>
<string>15A244e</string>
<key>DTSDKName</key>
<string>macosx10.10</string>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0640</string>
<string>0700</string>
<key>DTXcodeBuild</key>
<string>6E35b</string>
<string>7A192o</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2014 Rob Napier. All rights reserved.</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<string>Copyright © 2015 Rob Rix. All rights reserved.</string>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>15A235d</string>
<string>15A263e</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -20,22 +20,26 @@
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>6E35b</string>
<string>7A192o</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>14D125</string>
<string>15A244e</string>
<key>DTSDKName</key>
<string>macosx10.10</string>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0640</string>
<string>0700</string>
<key>DTXcodeBuild</key>
<string>6E35b</string>
<string>7A192o</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>15A235d</string>
<string>15A263e</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -20,22 +20,26 @@
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>6E35b</string>
<string>7A192o</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>14D125</string>
<string>15A244e</string>
<key>DTSDKName</key>
<string>macosx10.10</string>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0640</string>
<string>0700</string>
<key>DTXcodeBuild</key>
<string>6E35b</string>
<string>7A192o</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2014 JP Simard. All rights reserved.</string>
</dict>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>15A235d</string>
<string>15A263e</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -17,25 +17,29 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.4.4</string>
<string>0.4.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>6E35b</string>
<string>7A192o</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>14D125</string>
<string>15A244e</string>
<key>DTSDKName</key>
<string>macosx10.10</string>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0640</string>
<string>0700</string>
<key>DTXcodeBuild</key>
<string>6E35b</string>
<string>7A192o</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 SourceKitten. All rights reserved.</string>
</dict>
Expand Down
Binary file not shown.
Binary file modified lib/jazzy/SourceKitten/bin/sourcekitten
Binary file not shown.
17 changes: 16 additions & 1 deletion lib/jazzy/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Config
attr_accessor :docset_path
attr_accessor :source_directory
attr_accessor :excluded_files
attr_accessor :custom_categories
attr_accessor :template_directory
attr_accessor :swift_version
attr_accessor :assets_directory
Expand All @@ -49,8 +50,9 @@ def initialize
self.skip_undocumented = false
self.source_directory = Pathname.pwd
self.excluded_files = []
self.custom_categories = {}
self.template_directory = Pathname(__FILE__).parent + 'templates'
self.swift_version = '1.2'
self.swift_version = '2.0'
self.assets_directory = Pathname(__FILE__).parent + 'assets'
end

Expand Down Expand Up @@ -198,6 +200,11 @@ def self.parse!
config.excluded_files = files.map { |f| File.expand_path(f) }
end

opt.on('--categories file',
'JSON or YAML file with custom groupings') do |file|
config.custom_categories = parse_config_file(file)
end

opt.on('-v', '--version', 'Print version number') do
puts 'jazzy version: ' + Jazzy::VERSION
exit
Expand All @@ -217,6 +224,14 @@ def self.parse!
config
end

def self.parse_config_file(file)
case File.extname(file)
when '.json' then JSON.parse(File.read(file))
when '.yaml', '.yml' then YAML.load(File.read(file))
else raise "Config file must be .yaml or .json, but got #{file.inspect}"
end
end

#-------------------------------------------------------------------------#

# @!group Singleton
Expand Down
19 changes: 19 additions & 0 deletions lib/jazzy/doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ module Jazzy
class Doc < Mustache
self.template_name = 'doc'

############################################################################
# TODO: Remove shortly (kept for backwards compatibility)
#
def date
# Fake date is used to keep integration tests consistent
ENV['JAZZY_FAKE_DATE'] || DateTime.now.strftime('%Y-%m-%d')
end

def year
# Fake date is used to keep integration tests consistent
if ENV['JAZZY_FAKE_DATE']
ENV['JAZZY_FAKE_DATE'][0..3]
else
DateTime.now.strftime('%Y')
end
end
#
############################################################################

def copyright
config = Config.instance
copyright = config.copyright || (
Expand Down
28 changes: 18 additions & 10 deletions lib/jazzy/doc_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ def self.doc_structure_for_docs(docs)
docs.map do |doc|
{
section: doc.name,
children: doc.children.sort_by(&:name).map do |child|
{ name: child.name, url: child.url }
end,
children: doc.children
.sort_by(&:name)
.sort_by(&:nav_order)
.map do |child|
{ name: child.name, url: child.url }
end,
}
end
end
Expand Down Expand Up @@ -70,25 +73,26 @@ def self.build(options)
# @param [Config] options Build options
# @param [Array] doc_structure @see #doc_structure_for_docs
def self.build_docs(output_dir, docs, source_module)
each_doc(output_dir, docs) do |doc, path, depth|
each_doc(output_dir, docs) do |doc, path|
prepare_output_dir(path.parent, false)
path_to_root = ['../'].cycle(depth).to_a.join('')
depth = path.relative_path_from(output_dir).each_filename.count - 1
path_to_root = '../' * depth
path.open('w') do |file|
file.write(document(source_module, doc, path_to_root))
end
end
end

def self.each_doc(output_dir, docs, depth = 0, &block)
def self.each_doc(output_dir, docs, &block)
docs.each do |doc|
next if doc.name != 'index' && doc.children.count == 0
path = output_dir + "#{doc.name}.html"
block.call(doc, path, depth)
# Assuming URL is relative to documentation root:
path = output_dir + (doc.url || "#{doc.name}.html")
block.call(doc, path)
next if doc.name == 'index'
each_doc(
output_dir + doc.name,
output_dir,
doc.children,
depth + 1,
&block
)
end
Expand Down Expand Up @@ -183,6 +187,8 @@ def self.document_index(source_module, path_to_root)
doc[:structure] = source_module.doc_structure
doc[:module_name] = source_module.name
doc[:author_name] = source_module.author_name
# TODO: Remove shortly (kept for backwards compatibility)
doc[:author_website] = source_module.author_url
doc[:github_url] = source_module.github_url
doc[:dash_url] = source_module.dash_url
doc[:path_to_root] = path_to_root
Expand Down Expand Up @@ -287,6 +293,8 @@ def self.document(source_module, doc_model, path_to_root)
doc[:tasks] = render_tasks(source_module, doc_model.children)
doc[:module_name] = source_module.name
doc[:author_name] = source_module.author_name
# TODO: Remove shortly (kept for backwards compatibility)
doc[:author_website] = source_module.author_url.to_s
doc[:github_url] = source_module.github_url
doc[:dash_url] = source_module.dash_url
doc[:path_to_root] = path_to_root
Expand Down
Loading