jazzy 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19c85014e711d310498a311bb30099ee0a6c9bbb
4
- data.tar.gz: d6c589b0ef0551de858cfc471da17108fe762972
3
+ metadata.gz: ec769c8636609b8b4d6557633fe765929a0c6734
4
+ data.tar.gz: b10db798f53a77bceed7800b3c474528371c381f
5
5
  SHA512:
6
- metadata.gz: 78fdb1e5bb33da47b03ec512f448873fa1bfc46a08cd96cb633080c4b6ed81593f14c6269710c3da2291825c0a938e0aeca47be2b88de7d6175d68689f196647
7
- data.tar.gz: 3d27a0e9fbcab0e860873c9e00594c6e43d533ad710cc0fc562c146adfd180e5841d18c2c17370fbdfe758901ab8951279c1d87ae397d146ff23dc03d7ebecbc
6
+ metadata.gz: 3efe0871f0c10b0e06dcd62fcc535e72a4adfbd938bfd8268e720ada1b625dba34e7bb91d9f2ebe240465b93d2e7ffdc95061e883b67b8e7c52def23ab014352
7
+ data.tar.gz: 998599ca369d570fb1e92132c6f96d10e5a031b48119a84d5c38cf393e8512e9b1c40b38d005a71dd8051652b549b73e713fae84e5f65b65e932f98ea80bbdec
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  language: objective-c
2
- osx_image: beta-xcode6.3
2
+ osx_image: xcode6.4
3
3
  cache: bundler
4
4
  branches:
5
5
  only:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## 0.2.3
2
+
3
+ ##### Breaking
4
+
5
+ * None.
6
+
7
+ ##### Enhancements
8
+
9
+ * The `jazzy` CLI now accepts a `--swift-version` option (defaulting to 1.2),
10
+ and will automatically find an appropriate Xcode installation.
11
+ [Samuel Giddins](https://github.com/segiddins)
12
+ [#214](https://github.com/realm/jazzy/issues/214)
13
+
14
+ ##### Bug Fixes
15
+
16
+ * Declarations with no USR will no longer be documented.
17
+ [JP Simard](https://github.com/jpsim)
18
+
19
+
1
20
  ## 0.2.2
2
21
 
3
22
  ##### Breaking
data/Gemfile.lock CHANGED
@@ -1,14 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jazzy (0.2.2)
5
- cocoapods (~> 0.37)
4
+ jazzy (0.2.3)
5
+ cocoapods (~> 0.38)
6
6
  mustache (~> 0.99)
7
7
  open4
8
8
  redcarpet (~> 3.2)
9
9
  rouge (~> 1.5)
10
10
  sass (~> 3.4)
11
11
  sqlite3 (~> 1.3)
12
+ xcinvoke (~> 0.2.0)
12
13
 
13
14
  GEM
14
15
  remote: http://rubygems.org/
@@ -24,30 +25,33 @@ GEM
24
25
  astrolabe (1.3.0)
25
26
  parser (>= 2.2.0.pre.3, < 3.0)
26
27
  bacon (1.2.0)
27
- claide (0.8.2)
28
+ claide (0.9.1)
28
29
  clintegracon (0.5.3)
29
30
  colored (~> 1.2)
30
31
  diffy
31
- cocoapods (0.37.2)
32
+ cocoapods (0.38.2)
32
33
  activesupport (>= 3.2.15)
33
- claide (~> 0.8.1)
34
- cocoapods-core (= 0.37.2)
35
- cocoapods-downloader (~> 0.9.0)
34
+ claide (~> 0.9.1)
35
+ cocoapods-core (= 0.38.2)
36
+ cocoapods-downloader (~> 0.9.1)
36
37
  cocoapods-plugins (~> 0.4.2)
38
+ cocoapods-stats (~> 0.5.3)
37
39
  cocoapods-trunk (~> 0.6.1)
38
40
  cocoapods-try (~> 0.4.5)
39
41
  colored (~> 1.2)
40
42
  escape (~> 0.0.4)
41
- molinillo (~> 0.2.3)
43
+ molinillo (~> 0.3.1)
42
44
  nap (~> 0.8)
43
- xcodeproj (~> 0.24.2)
44
- cocoapods-core (0.37.2)
45
+ xcodeproj (~> 0.26.3)
46
+ cocoapods-core (0.38.2)
45
47
  activesupport (>= 3.2.15)
46
48
  fuzzy_match (~> 2.0.4)
47
49
  nap (~> 0.8.0)
48
50
  cocoapods-downloader (0.9.1)
49
51
  cocoapods-plugins (0.4.2)
50
52
  nap
53
+ cocoapods-stats (0.5.3)
54
+ nap (~> 0.8)
51
55
  cocoapods-trunk (0.6.1)
52
56
  nap (>= 0.8)
53
57
  netrc (= 0.7.8)
@@ -60,13 +64,14 @@ GEM
60
64
  fuzzy_match (2.0.4)
61
65
  i18n (0.7.0)
62
66
  json (1.8.3)
67
+ liferaft (0.0.4)
63
68
  metaclass (0.0.4)
64
69
  minitest (5.7.0)
65
70
  mocha (1.1.0)
66
71
  metaclass (~> 0.0.1)
67
72
  mocha-on-bacon (0.2.2)
68
73
  mocha (>= 0.13.0)
69
- molinillo (0.2.3)
74
+ molinillo (0.3.1)
70
75
  mustache (0.99.8)
71
76
  nap (0.8.0)
72
77
  netrc (0.7.8)
@@ -89,7 +94,7 @@ GEM
89
94
  ruby-progressbar (~> 1.4)
90
95
  ruby-progressbar (1.6.0)
91
96
  safe_yaml (1.0.4)
92
- sass (3.4.15)
97
+ sass (3.4.16)
93
98
  slop (3.6.0)
94
99
  sqlite3 (1.3.10)
95
100
  thread_safe (0.3.5)
@@ -98,8 +103,11 @@ GEM
98
103
  webmock (1.20.0)
99
104
  addressable (>= 2.3.6)
100
105
  crack (>= 0.3.2)
101
- xcodeproj (0.24.3)
106
+ xcinvoke (0.2.0)
107
+ liferaft (~> 0.0.4)
108
+ xcodeproj (0.26.3)
102
109
  activesupport (>= 3)
110
+ claide (~> 0.9.1)
103
111
  colored (~> 1.2)
104
112
 
105
113
  PLATFORMS
@@ -119,4 +127,4 @@ DEPENDENCIES
119
127
  webmock
120
128
 
121
129
  BUNDLED WITH
122
- 1.10.5
130
+ 1.10.6
data/Rakefile CHANGED
@@ -28,7 +28,7 @@ begin
28
28
  desc 'Run specs'
29
29
  task :spec do
30
30
  title 'Running Unit Tests'
31
- files = FileList['spec/**/*_spec.rb']
31
+ files = FileList['spec/*_spec.rb']
32
32
  .exclude('spec/integration_spec.rb').shuffle.join(' ')
33
33
  sh "bundle exec bacon #{files}"
34
34
  sh 'bundle exec bacon spec/integration_spec.rb'
@@ -72,7 +72,7 @@ begin
72
72
 
73
73
  require 'rubocop/rake_task'
74
74
  RuboCop::RakeTask.new(:rubocop) do |task|
75
- task.patterns = %w(lib spec Rakefile Gemfile jazzy.gemspec)
75
+ task.patterns = %w(lib spec/*.rb Rakefile Gemfile jazzy.gemspec)
76
76
  end
77
77
 
78
78
  #-- SourceKitten -----------------------------------------------------------#
data/jazzy.gemspec CHANGED
@@ -19,13 +19,14 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.extensions = ['lib/jazzy/SourceKitten/Rakefile']
21
21
 
22
- spec.add_runtime_dependency 'cocoapods', '~> 0.37'
22
+ spec.add_runtime_dependency 'cocoapods', '~> 0.38'
23
23
  spec.add_runtime_dependency 'mustache', '~> 0.99'
24
24
  spec.add_runtime_dependency 'open4'
25
25
  spec.add_runtime_dependency 'redcarpet', '~> 3.2'
26
26
  spec.add_runtime_dependency 'rouge', '~> 1.5'
27
27
  spec.add_runtime_dependency 'sass', '~> 3.4'
28
28
  spec.add_runtime_dependency 'sqlite3', '~> 1.3'
29
+ spec.add_runtime_dependency 'xcinvoke', '~> 0.2.0'
29
30
 
30
31
  spec.add_development_dependency 'bundler', '~> 1.7'
31
32
  spec.add_development_dependency 'rake', '~> 10.3'
data/lib/jazzy/config.rb CHANGED
@@ -31,6 +31,7 @@ module Jazzy
31
31
  attr_accessor :source_directory
32
32
  attr_accessor :excluded_files
33
33
  attr_accessor :template_directory
34
+ attr_accessor :swift_version
34
35
 
35
36
  def initialize
36
37
  PodspecDocumenter.configure(self, Dir['*.podspec{,.json}'].first)
@@ -47,6 +48,7 @@ module Jazzy
47
48
  self.source_directory = Pathname.pwd
48
49
  self.excluded_files = []
49
50
  self.template_directory = Pathname(__FILE__).parent + 'templates'
51
+ self.swift_version = '1.2'
50
52
  end
51
53
 
52
54
  def podspec=(podspec)
@@ -174,6 +176,10 @@ module Jazzy
174
176
  config.template_directory = Pathname(template_directory)
175
177
  end
176
178
 
179
+ opt.on('--swift-version VERSION') do |swift_version|
180
+ config.swift_version = swift_version
181
+ end
182
+
177
183
  opt.on('--readme FILEPATH',
178
184
  'The path to a markdown README file') do |readme|
179
185
  config.readme_path = Pathname(readme)
@@ -193,24 +193,25 @@ module Jazzy
193
193
  end
194
194
 
195
195
  def self.should_link_to_github(file)
196
- developer_directory = SourceKitten.xcode_developer_directory
197
- return unless developer_directory && file
198
- !file.start_with?(developer_directory.realpath.to_s)
196
+ return unless file
197
+ file = file.realpath.to_path
198
+ source_directory = Config.instance.source_directory.to_path
199
+ file.start_with?(source_directory)
199
200
  end
200
201
 
201
202
  # Construct Github token URL
202
203
  # @param [Hash] item Parsed doc child item
203
204
  # @param [Config] options Build options
204
205
  def self.gh_token_url(item, source_module)
205
- if source_module.github_file_prefix && should_link_to_github(item.file)
206
- relative_file_path = item.file.gsub(`pwd`.strip, '')
207
- if item.start_line && (item.start_line != item.end_line)
208
- gh_line = "#L#{item.start_line}-L#{item.end_line}"
209
- else
210
- gh_line = "#L#{item.line}"
211
- end
212
- source_module.github_file_prefix + relative_file_path + gh_line
206
+ return unless github_prefix = source_module.github_file_prefix
207
+ return unless should_link_to_github(item.file)
208
+ if item.start_line && (item.start_line != item.end_line)
209
+ gh_line = "#L#{item.start_line}-L#{item.end_line}"
210
+ else
211
+ gh_line = "#L#{item.line}"
213
212
  end
213
+ relative_file_path = item.file.realpath.relative_path_from(Pathname.pwd)
214
+ "#{github_prefix}/#{relative_file_path}#{gh_line}"
214
215
  end
215
216
 
216
217
  # Build mustache item for a top-level doc
@@ -17,7 +17,7 @@ module Jazzy
17
17
  end
18
18
 
19
19
  class << self
20
- def execute_command(executable, args, raise_on_failure)
20
+ def execute_command(executable, args, raise_on_failure, env: {})
21
21
  require 'shellwords'
22
22
  bin = `which #{executable.to_s.shellescape}`.strip
23
23
  raise "Unable to locate the executable `#{executable}`" if bin.empty?
@@ -27,7 +27,7 @@ module Jazzy
27
27
  stdout, stderr = IO.new, IO.new($stderr)
28
28
 
29
29
  options = { stdout: stdout, stderr: stderr, status: true }
30
- status = Open4.spawn(bin, *args, options)
30
+ status = Open4.spawn(env, bin, *args, options)
31
31
  unless status.success?
32
32
  full_command = "#{bin.shellescape} #{args.map(&:shellescape)}"
33
33
  output = stdout.to_s << stderr.to_s
@@ -1,3 +1,3 @@
1
1
  module Jazzy
2
- VERSION = '0.2.2' unless defined? Jazzy::VERSION
2
+ VERSION = '0.2.3' unless defined? Jazzy::VERSION
3
3
  end
@@ -75,6 +75,7 @@ module Jazzy
75
75
  c.installation_root = Pathname(Dir.mktmpdir)
76
76
  c.installation_root.rmtree if c.installation_root.exist?
77
77
  c.integrate_targets = false
78
+ c.deduplicate_targets = false
78
79
  end
79
80
  end
80
81
 
@@ -1,5 +1,6 @@
1
1
  require 'json'
2
2
  require 'pathname'
3
+ require 'xcinvoke'
3
4
 
4
5
  require 'jazzy/config'
5
6
  require 'jazzy/executable'
@@ -12,7 +13,6 @@ module Jazzy
12
13
  module SourceKitten
13
14
  @documented_count = 0
14
15
  @undocumented_tokens = []
15
- @expected_swift_version = '1.2'
16
16
 
17
17
  # Group root-level docs by type and add as children to a group doc element
18
18
  def self.group_docs(docs, type)
@@ -39,49 +39,17 @@ module Jazzy
39
39
  else
40
40
  # Don't create HTML page for this doc if it doesn't have children
41
41
  # Instead, make its link a hash-link on its parent's page
42
- id = doc.usr
43
- unless id
44
- id = doc.name || 'unknown'
45
- warn "`#{id}` has no USR. First make sure all modules used in " \
46
- 'your project have been imported. If all used modules are ' \
47
- 'imported, please report this problem by filing an issue at ' \
48
- 'https://github.com/realm/jazzy/issues along with your Xcode ' \
49
- 'project. If this token is declared in an `#if` block, please ' \
50
- 'ignore this message.'
51
- end
52
- doc.url = parents.join('/') + '.html#/' + id
42
+ doc.url = parents.join('/') + '.html#/' + doc.usr
53
43
  end
54
44
  end
55
45
  end
56
46
 
57
- def self.assert_xcode_location
58
- expected_xcode_select_path =
59
- Pathname('/Applications/Xcode.app/Contents/Developer')
60
- return if xcode_developer_directory == expected_xcode_select_path
61
- raise 'Please install or symlink Xcode 6.3 in ' \
62
- "#{expected_xcode_select_path} and set as active developer " \
63
- 'directory by running `sudo xcode-select -s ' \
64
- "#{expected_xcode_select_path}`"
65
- end
66
-
67
- def self.xcode_developer_directory
68
- dir = Pathname(`xcode-select -p`.chomp)
69
- dir.directory? ? dir.expand_path : nil
70
- end
71
-
72
- def self.assert_swift_version
73
- swift_version = `xcrun swift --version` =~ /Swift version ([\d\.]+)/ &&
74
- Regexp.last_match[1]
75
- return if swift_version == @expected_swift_version
76
- raise "Jazzy only works with Swift #{@expected_swift_version}."
77
- end
78
-
79
47
  # Run sourcekitten with given arguments and return STDOUT
80
48
  def self.run_sourcekitten(arguments)
81
- assert_xcode_location
82
- assert_swift_version
49
+ xcode = XCInvoke::Xcode.find_swift_version(Config.instance.swift_version)
83
50
  bin_path = Pathname(__FILE__).parent + 'SourceKitten/sourcekitten'
84
- output, _ = Executable.execute_command(bin_path, arguments, true)
51
+ output, _ = Executable.execute_command(bin_path, arguments, true,
52
+ env: xcode.as_env)
85
53
  output
86
54
  end
87
55
 
@@ -100,6 +68,15 @@ module Jazzy
100
68
  end
101
69
 
102
70
  def self.should_document?(doc)
71
+ unless doc['key.usr']
72
+ warn "`#{doc['key.name']}` has no USR. First make sure all modules " \
73
+ 'used in your project have been imported. If all used modules ' \
74
+ 'are imported, please report this problem by filing an issue ' \
75
+ 'at https://github.com/realm/jazzy/issues along with your ' \
76
+ 'Xcode project. If this token is declared in an `#if` block, ' \
77
+ 'please ignore this message.'
78
+ return false
79
+ end
103
80
  return false if doc['key.doc.comment'].to_s.include?(':nodoc:')
104
81
 
105
82
  # Always document extensions, since we can't tell what ACL they are
@@ -186,6 +163,7 @@ module Jazzy
186
163
 
187
164
  # rubocop:disable Metrics/MethodLength
188
165
  # rubocop:disable Metrics/CyclomaticComplexity
166
+ # rubocop:disable Metrics/PerceivedComplexity
189
167
  def self.make_source_declarations(docs)
190
168
  declarations = []
191
169
  current_mark = SourceMark.new
@@ -207,7 +185,7 @@ module Jazzy
207
185
  "for `#{declaration.type.kind}`."
208
186
  end
209
187
 
210
- declaration.file = doc['key.filepath']
188
+ declaration.file = Pathname(doc['key.filepath']) if doc['key.filepath']
211
189
  declaration.usr = doc['key.usr']
212
190
  declaration.name = doc['key.name']
213
191
  declaration.mark = current_mark
@@ -222,6 +200,7 @@ module Jazzy
222
200
  end
223
201
  declarations
224
202
  end
203
+ # rubocop:enable Metrics/PerceivedComplexity
225
204
  # rubocop:enable Metrics/CyclomaticComplexity
226
205
  # rubocop:enable Metrics/MethodLength
227
206
 
@@ -102,6 +102,23 @@ describe_cli 'jazzy' do
102
102
  '--skip-undocumented'
103
103
  end
104
104
 
105
+ describe 'Creates Realm Swift docs' do
106
+ realm_version = '0.93.2'
107
+ behaves_like cli_spec 'document_realm_swift',
108
+ '--author Realm ' \
109
+ '--author_url "https://realm.io" ' \
110
+ '--github_url ' \
111
+ 'https://github.com/realm/realm-cocoa ' \
112
+ '--github-file-prefix https://github.com/realm/' \
113
+ "realm-cocoa/tree/v#{realm_version} " \
114
+ '--module RealmSwift ' \
115
+ "--module-version #{realm_version} " \
116
+ '--root-url https://realm.io/docs/swift/' \
117
+ "#{realm_version}/api/ " \
118
+ '--xcodebuild-arguments ' \
119
+ '"-project,RealmSwift.xcodeproj,-dry-run" '
120
+ end
121
+
105
122
  describe 'Creates docs for a podspec with dependencies and subspecs' do
106
123
  behaves_like cli_spec 'document_moya_podspec',
107
124
  '--podspec=Moya.podspec'
@@ -2,30 +2,5 @@ require File.expand_path('../spec_helper', __FILE__)
2
2
 
3
3
  module Jazzy
4
4
  describe SourceKitten do
5
- it 'validates the xcode-select path' do
6
- SourceKitten.stubs(:`)
7
- .returns '/Applications/Xcode.app/Contents/Developer'
8
- should.not.raise { SourceKitten.assert_xcode_location }
9
-
10
- SourceKitten.stubs(:`)
11
- .returns '/Applications/Xcode-Beta.app/Contents/Developer'
12
- should.raise { SourceKitten.assert_xcode_location }.message.should
13
- .match %r{Please install or symlink Xcode.*/Applications/Xcode.app}
14
- end
15
-
16
- it 'validates the current xcode version' do
17
- SourceKitten.stubs(:`).returns <<-O
18
- Apple Swift version 1.2 (swiftlang-602.0.49.6 clang-602.0.49)
19
- Target: x86_64-apple-darwin14.3.0
20
- O
21
- should.not.raise { SourceKitten.assert_swift_version }
22
-
23
- SourceKitten.stubs(:`).returns <<-O
24
- Swift version 1.1 (swift-600.0.57.4)
25
- Target: x86_64-apple-darwin14.1.0
26
- O
27
- should.raise { SourceKitten.assert_swift_version }.message.should
28
- .match /Jazzy.*Swift 1\.2/
29
- end
30
5
  end
31
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jazzy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Simard
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-07-07 00:00:00.000000000 Z
13
+ date: 2015-07-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cocoapods
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '0.37'
21
+ version: '0.38'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '0.37'
28
+ version: '0.38'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: mustache
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -110,6 +110,20 @@ dependencies:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
112
  version: '1.3'
113
+ - !ruby/object:Gem::Dependency
114
+ name: xcinvoke
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: 0.2.0
120
+ type: :runtime
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: 0.2.0
113
127
  - !ruby/object:Gem::Dependency
114
128
  name: bundler
115
129
  requirement: !ruby/object:Gem::Requirement
@@ -243,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
257
  version: '0'
244
258
  requirements: []
245
259
  rubyforge_project:
246
- rubygems_version: 2.2.2
260
+ rubygems_version: 2.4.8
247
261
  signing_key:
248
262
  specification_version: 4
249
263
  summary: Soulful docs for Swift & Objective-C.