cocoapods-appledoc 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e2d851154165a0c464d427fcffa33daf7c65a9db
4
+ data.tar.gz: f20085f052c110ce9735c868dab8050b0080a428
5
+ SHA512:
6
+ metadata.gz: 794c6de7cd804bfda512bd19b4c483cd3535f29cf08c0b11911db03d71c0fff49e2e370dd2830c2ecbd09b640e6e8df62ff9b6e313d151302db679e8fee1196f
7
+ data.tar.gz: 509cb92f67197d39187ba574e7317e8d813c9eee970e1e4ce88c9102f4d5ad567798a7b594d3c53f8df8345b3c98d6c2d752238bbf54438d52e46913692cdddf
@@ -0,0 +1,10 @@
1
+ language: objective-c
2
+ env:
3
+ # This is what 10.8.x comes with and we want to support that.
4
+ - RVM_RUBY_VERSION=system NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2' SSL_CERT_FILE=/usr/local/share/cacert.pem GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com PYTHONPATH=/usr/local/lib/python2.7/site-packages
5
+ - RVM_RUBY_VERSION=2.0.0-p247 NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo gem install bundler --no-ri --no-rdoc' GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com PYTHONPATH=/usr/local/lib/python2.7/site-packages
6
+ before_install:
7
+ - curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
8
+ - source ~/.rvm/scripts/rvm && rvm use $RVM_RUBY_VERSION
9
+ install: eval $RUBY_VERSION_SPECIFIC && rake bootstrap[use_bundle_dir]
10
+ script: bundle exec rake specs
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'bacon'
7
+ gem 'mocha-on-bacon'
8
+ gem 'mocha', '~> 0.11.4'
9
+ gem 'prettybacon', :git => 'https://github.com/irrationalfab/PrettyBacon.git', :branch => 'master'
10
+ end
11
+
@@ -0,0 +1,81 @@
1
+ GIT
2
+ remote: https://github.com/irrationalfab/PrettyBacon.git
3
+ revision: 1eeb06f7d381acd65414b86b42fdf3538faae01c
4
+ branch: master
5
+ specs:
6
+ prettybacon (0.0.2)
7
+ bacon (~> 1.2)
8
+
9
+ PATH
10
+ remote: .
11
+ specs:
12
+ cocoapods-appledoc (0.1.0)
13
+ cocoapods (~> 0.34)
14
+
15
+ GEM
16
+ remote: https://rubygems.org/
17
+ specs:
18
+ activesupport (3.2.19)
19
+ i18n (~> 0.6, >= 0.6.4)
20
+ multi_json (~> 1.0)
21
+ bacon (1.2.0)
22
+ claide (0.7.0)
23
+ cocoapods (0.34.2)
24
+ activesupport (>= 3.2.15, < 4)
25
+ claide (~> 0.7.0)
26
+ cocoapods-core (= 0.34.2)
27
+ cocoapods-downloader (~> 0.7.2)
28
+ cocoapods-plugins (~> 0.3.1)
29
+ cocoapods-trunk (~> 0.3.0)
30
+ cocoapods-try (~> 0.4.1)
31
+ colored (~> 1.2)
32
+ escape (~> 0.0.4)
33
+ json_pure (~> 1.8)
34
+ nap (~> 0.8)
35
+ open4 (~> 1.3)
36
+ resolver (~> 0)
37
+ xcodeproj (~> 0.19.3)
38
+ cocoapods-core (0.34.2)
39
+ activesupport (>= 3.2.15)
40
+ fuzzy_match (~> 2.0.4)
41
+ json_pure (~> 1.8)
42
+ nap (~> 0.8.0)
43
+ cocoapods-downloader (0.7.2)
44
+ cocoapods-plugins (0.3.1)
45
+ nap
46
+ cocoapods-trunk (0.3.0)
47
+ json_pure (~> 1.8)
48
+ nap (>= 0.8)
49
+ netrc
50
+ cocoapods-try (0.4.1)
51
+ colored (1.2)
52
+ escape (0.0.4)
53
+ fuzzy_match (2.0.4)
54
+ i18n (0.6.11)
55
+ json_pure (1.8.1)
56
+ metaclass (0.0.4)
57
+ mocha (0.11.4)
58
+ metaclass (~> 0.0.1)
59
+ mocha-on-bacon (0.2.1)
60
+ mocha (>= 0.9.8)
61
+ multi_json (1.10.1)
62
+ nap (0.8.0)
63
+ netrc (0.7.8)
64
+ open4 (1.3.4)
65
+ rake (10.3.2)
66
+ resolver (0.0.1)
67
+ xcodeproj (0.19.4)
68
+ activesupport (~> 3.0)
69
+ colored (~> 1.2)
70
+
71
+ PLATFORMS
72
+ ruby
73
+
74
+ DEPENDENCIES
75
+ bacon
76
+ bundler (~> 1.3)
77
+ cocoapods-appledoc!
78
+ mocha (~> 0.11.4)
79
+ mocha-on-bacon
80
+ prettybacon!
81
+ rake
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2013-2014 Orta Therox
2
+ Copyright (c) 2014 Kyle Fuller
3
+
4
+ MIT License
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,22 @@
1
+ # CocoaPods AppleDoc
2
+
3
+ [![Build Status](https://travis-ci.org/CocoaPods/cocoapods-appledoc.png?branch=master)](https://travis-ci.org/CocoaPods/cocoapods-appledoc)
4
+
5
+ CocoaPods plugin which allows you to generate documentation for a pod spec
6
+ using AppleDoc.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ $ gem install cocoapods-appledoc
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```bash
17
+ $ pod appledoc QueryKit
18
+
19
+ Docset has been generated for QueryKit (0.8.3) and can be found in
20
+ /Users/kylef/Desktop/QueryKit-0.8.3
21
+ ```
22
+
@@ -0,0 +1,13 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ def specs(dir)
4
+ FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
5
+ end
6
+
7
+ desc "Runs all the specs"
8
+ task :specs do
9
+ sh "bundle exec bacon #{specs('**')}"
10
+ end
11
+
12
+ task :default => :specs
13
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cocoapods_appledoc.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-appledoc'
8
+ spec.version = Pod::AppleDoc::VERSION
9
+ spec.authors = ['Orta Therox', 'Kyle Fuller']
10
+ spec.summary = 'CocoaPods plugin to build documentation for a pod.'
11
+ spec.homepage = 'https://github.com/CocoaPods/cocoapods-appledoc'
12
+ spec.license = 'MIT'
13
+ spec.files = `git ls-files`.split($/)
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ["lib"]
17
+
18
+ spec.add_runtime_dependency 'cocoapods', '~> 0.34'
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "rake"
22
+ end
23
+
@@ -0,0 +1,8 @@
1
+ module Pod
2
+ module AppleDoc
3
+ VERSION = "0.1.0"
4
+
5
+ require 'pod/command/appledoc'
6
+ end
7
+ end
8
+
@@ -0,0 +1 @@
1
+ require 'pod/command/appledoc'
@@ -0,0 +1,127 @@
1
+ require 'shellwords'
2
+ require 'cocoapods'
3
+
4
+ module Pod
5
+ class Command
6
+ class Appledoc < Command
7
+ self.summary = 'Generate documentation for a pod using appledoc'
8
+ self.arguments = [
9
+ CLAide::Argument.new('NAME', false)
10
+ ]
11
+
12
+ def initialize(argv)
13
+ @name = argv.shift_argument
14
+ super
15
+ end
16
+
17
+ def validate!
18
+ super
19
+ help! "A spec name is required" unless @name
20
+ help! 'Please install appledoc first' if `which appledoc`.empty?
21
+ end
22
+
23
+ def download_location
24
+ File.join(APPLEDOC_DOWNLOAD_DIRECTORY, "#{@spec.name}-#{@spec.version}")
25
+ end
26
+
27
+ def download
28
+ downloader = Pod::Downloader.for_target(download_location, @spec.source)
29
+ downloader.download
30
+ end
31
+
32
+ def public_headers_files
33
+ headers = []
34
+
35
+ pathlist = Pod::Sandbox::PathList.new(Pathname.new(download_location))
36
+ [@spec, *@spec.recursive_subspecs].each do |internal_spec|
37
+ internal_spec.available_platforms.each do |platform|
38
+ consumer = Pod::Specification::Consumer.new(internal_spec, platform)
39
+ accessor = Pod::Sandbox::FileAccessor.new(pathlist, consumer)
40
+
41
+ if accessor.public_headers
42
+ headers += accessor.public_headers.map{ |filepath| filepath.to_s }
43
+ end
44
+ end
45
+ end
46
+
47
+ headers.uniq
48
+ end
49
+
50
+ def spec_authors
51
+ if @spec.authors.is_a?(Hash)
52
+ @spec.authors.keys.join(', ')
53
+ else
54
+ @spec.authors.to_s
55
+ end
56
+ end
57
+
58
+ def generate_docset
59
+ escaped_headers = public_headers_files.map do |header_file|
60
+ Shellwords.escape(header_file)
61
+ end
62
+
63
+ command = [
64
+ 'appledoc',
65
+ "--company-id 'org.cocoadocs.#{@spec.name.downcase}'",
66
+ "--project-name '#{@spec.name}'",
67
+ "--project-company '#{spec_authors}'",
68
+ "--project-version '#{@spec.version}'",
69
+ '--keep-undocumented-objects',
70
+ '--keep-undocumented-members',
71
+ '--keep-intermediate-files',
72
+ '--no-install-docset', # Don't install the docset into Xcode
73
+ "--docset-feed-name #{@spec.name}",
74
+ "--docset-feed-url #{base_url}docsets/#{@spec.name}/xcode-docset.atom",
75
+ '--docset-package-filename docset',
76
+ "--docset-package-url #{base_url}docsets/#{@spec.name}/docset.xar",
77
+ '--create-html',
78
+ '--create-docset',
79
+ '--publish-docset',
80
+ "--output #{Shellwords.escape(output_location)}",
81
+ *escaped_headers
82
+ ]
83
+
84
+ system command.join(' ')
85
+ end
86
+
87
+ def output_location
88
+ File.join(Dir.pwd, "#{@spec.name}-#{@spec.version}")
89
+ end
90
+
91
+ def run
92
+ @spec = spec_with_path(@name) || spec_with_name(@name)
93
+
94
+ raise Informative, "Docset in #{output_location} already exists" if File.exist?(output_location)
95
+
96
+ download unless File.exist?(download_location)
97
+ generate_docset
98
+
99
+ UI.puts("Docset has been generated for #{@spec.name} (#{@spec.version}) and can be found in #{output_location}.".green)
100
+ end
101
+
102
+ def spec_with_path(path)
103
+ Spec.from_file(path)
104
+ rescue
105
+ nil
106
+ end
107
+
108
+ def spec_with_name(name)
109
+ set = SourcesManager.search(Dependency.new(name))
110
+
111
+ if set
112
+ set.specification.root
113
+ else
114
+ raise Informative, "Unable to find a specification for `#{name}`"
115
+ end
116
+ end
117
+
118
+ APPLEDOC_TMP_DIR = Pathname.new('/tmp/CocoaPods/AppleDoc')
119
+ APPLEDOC_DOWNLOAD_DIRECTORY = File.join(APPLEDOC_TMP_DIR, 'Sources')
120
+ end
121
+
122
+ def base_url
123
+ "http://cocoadocs.org/"
124
+ end
125
+ end
126
+ end
127
+
@@ -0,0 +1,32 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Spec::Appledoc do
5
+ describe "CLAide" do
6
+ it "registers it self" do
7
+ Command.parse(%w{ spec appledoc }).should.be.instance_of Command::Spec::Appledoc
8
+ end
9
+
10
+ it "presents the help if no spec is provided" do
11
+ command = Command.parse(%w{ spec appledoc })
12
+ should.raise CLAide::Help do
13
+ command.validate!
14
+ end.message.should.match /required/
15
+ end
16
+
17
+ it "errors if it cannot find a spec" do
18
+ SourcesManager.stubs(:search).returns(nil)
19
+ command = Command.parse(%w{ spec appledoc KFData })
20
+ should.raise Informative do
21
+ command.run
22
+ end.message.should.match /Unable to find a specification/
23
+ end
24
+
25
+ it "runs" do
26
+ command = Command.parse(%w{ spec appledoc KFData })
27
+ command.run
28
+ end
29
+ end
30
+ end
31
+ end
32
+
@@ -0,0 +1,47 @@
1
+ require 'pathname'
2
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
+ $:.unshift((ROOT + 'lib').to_s)
4
+ $:.unshift((ROOT + 'spec').to_s)
5
+
6
+ require 'bundler/setup'
7
+ require 'bacon'
8
+ require 'mocha-on-bacon'
9
+ require 'pretty_bacon'
10
+ require 'cocoapods'
11
+
12
+ require 'cocoapods_plugin'
13
+
14
+ #-----------------------------------------------------------------------------#
15
+
16
+ module Pod
17
+
18
+ # Disable the wrapping so the output is deterministic in the tests.
19
+ #
20
+ UI.disable_wrap = true
21
+
22
+ # Redirects the messages to an internal store.
23
+ #
24
+ module UI
25
+ @output = ''
26
+ @warnings = ''
27
+
28
+ class << self
29
+ attr_accessor :output
30
+ attr_accessor :warnings
31
+
32
+ def puts(message = '')
33
+ @output << "#{message}\n"
34
+ end
35
+
36
+ def warn(message = '', actions = [])
37
+ @warnings << "#{message}\n"
38
+ end
39
+
40
+ def print(message)
41
+ @output << message
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ #-----------------------------------------------------------------------------#
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-appledoc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Orta Therox
8
+ - Kyle Fuller
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-10-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: cocoapods
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '0.34'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: '0.34'
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: '1.3'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: '1.3'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ description:
57
+ email:
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .travis.yml
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - cocoapods-appledoc.gemspec
69
+ - lib/cocoapods_appledoc.rb
70
+ - lib/cocoapods_plugin.rb
71
+ - lib/pod/command/appledoc.rb
72
+ - spec/command/appledoc_spec.rb
73
+ - spec/spec_helper.rb
74
+ homepage: https://github.com/CocoaPods/cocoapods-appledoc
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.0.14
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: CocoaPods plugin to build documentation for a pod.
98
+ test_files:
99
+ - spec/command/appledoc_spec.rb
100
+ - spec/spec_helper.rb