cocoapods-plugins 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +36 -0
- data/.rubocop.yml +51 -0
- data/.travis.yml +26 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +108 -0
- data/LICENSE +21 -0
- data/README.md +15 -0
- data/Rakefile +41 -0
- data/cocoapods-plugins.gemspec +24 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/lib/cocoapods_plugins.rb +6 -0
- data/lib/pod/command/plugins.rb +155 -0
- data/spec/command/plugins_spec.rb +121 -0
- data/spec/fixtures/plugins.json +16 -0
- data/spec/spec_helper.rb +103 -0
- metadata +118 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: c7bc267f848ee30507851b6302b4291ac9472c34
|
|
4
|
+
data.tar.gz: b8dc5813586a454949f0b45f6ffdbc6259ffa300
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d75983946efe356128770b4670ce9ec2380f0a954bf8f9932570766d2b201f3713bf16d99ee7a6de0e248a82808ce7dca0e7602790c1ab880421480ee4cb4bf3
|
|
7
|
+
data.tar.gz: e71de6205045275b61cd0bfced542d725784aa7bd55a08e4381cd5817f804c888093fce575491270d73a6b1e238d5e5aae08f05cf68b93f7ab416df0c90e7195
|
data/.gitignore
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
/.config
|
|
4
|
+
/coverage/
|
|
5
|
+
/InstalledFiles
|
|
6
|
+
/pkg/
|
|
7
|
+
/spec/reports/
|
|
8
|
+
/test/tmp/
|
|
9
|
+
/test/version_tmp/
|
|
10
|
+
/tmp/
|
|
11
|
+
|
|
12
|
+
## Specific to RubyMotion:
|
|
13
|
+
.dat*
|
|
14
|
+
.repl_history
|
|
15
|
+
build/
|
|
16
|
+
|
|
17
|
+
## Documentation cache and generated files:
|
|
18
|
+
/.yardoc/
|
|
19
|
+
/_yardoc/
|
|
20
|
+
/doc/
|
|
21
|
+
/rdoc/
|
|
22
|
+
|
|
23
|
+
## Environment normalisation:
|
|
24
|
+
/.bundle/
|
|
25
|
+
/lib/bundler/man/
|
|
26
|
+
|
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
29
|
+
# Gemfile.lock
|
|
30
|
+
# .ruby-version
|
|
31
|
+
# .ruby-gemset
|
|
32
|
+
|
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
34
|
+
.rvmrc
|
|
35
|
+
|
|
36
|
+
/coverage/
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
HashSyntax:
|
|
2
|
+
EnforcedStyle: hash_rockets
|
|
3
|
+
|
|
4
|
+
StringLiterals:
|
|
5
|
+
Enabled: false
|
|
6
|
+
EnforcedStyle: double_quotes
|
|
7
|
+
|
|
8
|
+
SignalException:
|
|
9
|
+
EnforcedStyle: only_raise
|
|
10
|
+
|
|
11
|
+
ConstantName:
|
|
12
|
+
Enabled: false
|
|
13
|
+
|
|
14
|
+
IfUnlessModifier:
|
|
15
|
+
Enabled: false
|
|
16
|
+
|
|
17
|
+
EmptyLinesAroundBody:
|
|
18
|
+
Enabled: false
|
|
19
|
+
|
|
20
|
+
AsciiComments:
|
|
21
|
+
Enabled: false
|
|
22
|
+
|
|
23
|
+
Proc:
|
|
24
|
+
Enabled: false
|
|
25
|
+
|
|
26
|
+
BracesAroundHashParameters:
|
|
27
|
+
Enabled: false
|
|
28
|
+
|
|
29
|
+
Encoding:
|
|
30
|
+
Enabled: false
|
|
31
|
+
|
|
32
|
+
TrailingComma:
|
|
33
|
+
EnforcedStyleForMultiline: comma
|
|
34
|
+
|
|
35
|
+
FileName:
|
|
36
|
+
Enabled: false
|
|
37
|
+
|
|
38
|
+
#------------------------------------------------------------------------------
|
|
39
|
+
# Needs fixing
|
|
40
|
+
#------------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
ClassLength:
|
|
43
|
+
Max: 200
|
|
44
|
+
|
|
45
|
+
MethodLength:
|
|
46
|
+
Max: 18
|
|
47
|
+
|
|
48
|
+
LineLength:
|
|
49
|
+
Enabled: false
|
|
50
|
+
|
|
51
|
+
|
data/.travis.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Sets Travis to run the Ruby specs on OS X machines which are required to
|
|
2
|
+
# build the native extensions of Xcodeproj.
|
|
3
|
+
#
|
|
4
|
+
language: objective-c
|
|
5
|
+
env:
|
|
6
|
+
# This is what 10.8.x comes with and we want to support that.
|
|
7
|
+
- RVM_RUBY_VERSION=system
|
|
8
|
+
- RVM_RUBY_VERSION=2.0.0-p353
|
|
9
|
+
|
|
10
|
+
before_install:
|
|
11
|
+
- curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
|
|
12
|
+
- export SSL_CERT_FILE=/usr/local/share/cacert.pem
|
|
13
|
+
- export PYTHONPATH=/usr/local
|
|
14
|
+
- export GIT_AUTHOR_NAME=CocoaPods
|
|
15
|
+
- export GIT_AUTHOR_EMAIL=cocoapods@example.com
|
|
16
|
+
- source ~/.rvm/scripts/rvm
|
|
17
|
+
- if [[ $RVM_RUBY_VERSION != 'system' ]]; then rvm install $RVM_RUBY_VERSION; fi
|
|
18
|
+
- rvm use $RVM_RUBY_VERSION
|
|
19
|
+
- if [[ $RVM_RUBY_VERSION == 'system' ]]; then export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future; fi
|
|
20
|
+
- if [[ $RVM_RUBY_VERSION == 'system' ]]; then sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2; fi
|
|
21
|
+
- if [[ $RVM_RUBY_VERSION == 'system' ]]; then sudo gem install bundler --no-ri --no-rdoc; else gem install bundler --no-ri --no-rdoc; fi
|
|
22
|
+
|
|
23
|
+
install:
|
|
24
|
+
- bundle install --path ./travis_bundle_dir
|
|
25
|
+
|
|
26
|
+
script: bundle exec rake spec
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
cocoapods-plugins (0.1.0)
|
|
5
|
+
cocoapods
|
|
6
|
+
nap
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
activesupport (3.2.17)
|
|
12
|
+
i18n (~> 0.6, >= 0.6.4)
|
|
13
|
+
multi_json (~> 1.0)
|
|
14
|
+
addressable (2.3.6)
|
|
15
|
+
ast (1.1.0)
|
|
16
|
+
bacon (1.2.0)
|
|
17
|
+
claide (0.5.0)
|
|
18
|
+
cocoapods (0.32.1)
|
|
19
|
+
activesupport (>= 3.2.15, < 4)
|
|
20
|
+
claide (~> 0.5.0)
|
|
21
|
+
cocoapods-core (= 0.32.1)
|
|
22
|
+
cocoapods-downloader (~> 0.5.0)
|
|
23
|
+
cocoapods-try (~> 0.2.0)
|
|
24
|
+
colored (~> 1.2)
|
|
25
|
+
escape (~> 0.0.4)
|
|
26
|
+
json_pure (~> 1.8)
|
|
27
|
+
nap (~> 0.7)
|
|
28
|
+
open4 (~> 1.3)
|
|
29
|
+
xcodeproj (~> 0.16.1)
|
|
30
|
+
cocoapods-core (0.32.1)
|
|
31
|
+
activesupport (>= 3.2.15, < 4)
|
|
32
|
+
fuzzy_match (~> 2.0.4)
|
|
33
|
+
json_pure (~> 1.8)
|
|
34
|
+
nap (~> 0.5)
|
|
35
|
+
cocoapods-downloader (0.5.0)
|
|
36
|
+
cocoapods-try (0.2.0)
|
|
37
|
+
colored (1.2)
|
|
38
|
+
coveralls (0.7.0)
|
|
39
|
+
multi_json (~> 1.3)
|
|
40
|
+
rest-client
|
|
41
|
+
simplecov (>= 0.7)
|
|
42
|
+
term-ansicolor
|
|
43
|
+
thor
|
|
44
|
+
crack (0.4.2)
|
|
45
|
+
safe_yaml (~> 1.0.0)
|
|
46
|
+
docile (1.1.3)
|
|
47
|
+
escape (0.0.4)
|
|
48
|
+
fuzzy_match (2.0.4)
|
|
49
|
+
i18n (0.6.9)
|
|
50
|
+
json (1.8.1)
|
|
51
|
+
json_pure (1.8.1)
|
|
52
|
+
metaclass (0.0.4)
|
|
53
|
+
mime-types (2.2)
|
|
54
|
+
mocha (1.0.0)
|
|
55
|
+
metaclass (~> 0.0.1)
|
|
56
|
+
mocha-on-bacon (0.2.2)
|
|
57
|
+
mocha (>= 0.13.0)
|
|
58
|
+
multi_json (1.9.2)
|
|
59
|
+
nap (0.7.0)
|
|
60
|
+
open4 (1.3.3)
|
|
61
|
+
parser (2.1.7)
|
|
62
|
+
ast (~> 1.1)
|
|
63
|
+
slop (~> 3.4, >= 3.4.5)
|
|
64
|
+
powerpack (0.0.9)
|
|
65
|
+
prettybacon (0.0.1)
|
|
66
|
+
bacon (~> 1.2)
|
|
67
|
+
rainbow (2.0.0)
|
|
68
|
+
rake (10.2.2)
|
|
69
|
+
rest-client (1.6.7)
|
|
70
|
+
mime-types (>= 1.16)
|
|
71
|
+
rubocop (0.20.0)
|
|
72
|
+
json (>= 1.7.7, < 2)
|
|
73
|
+
parser (~> 2.1.7)
|
|
74
|
+
powerpack (~> 0.0.6)
|
|
75
|
+
rainbow (>= 1.99.1, < 3.0)
|
|
76
|
+
ruby-progressbar (~> 1.4)
|
|
77
|
+
ruby-progressbar (1.4.2)
|
|
78
|
+
safe_yaml (1.0.2)
|
|
79
|
+
simplecov (0.8.2)
|
|
80
|
+
docile (~> 1.1.0)
|
|
81
|
+
multi_json
|
|
82
|
+
simplecov-html (~> 0.8.0)
|
|
83
|
+
simplecov-html (0.8.0)
|
|
84
|
+
slop (3.5.0)
|
|
85
|
+
term-ansicolor (1.3.0)
|
|
86
|
+
tins (~> 1.0)
|
|
87
|
+
thor (0.19.1)
|
|
88
|
+
tins (1.1.0)
|
|
89
|
+
webmock (1.17.4)
|
|
90
|
+
addressable (>= 2.2.7)
|
|
91
|
+
crack (>= 0.3.2)
|
|
92
|
+
xcodeproj (0.16.1)
|
|
93
|
+
activesupport (~> 3.0)
|
|
94
|
+
colored (~> 1.2)
|
|
95
|
+
|
|
96
|
+
PLATFORMS
|
|
97
|
+
ruby
|
|
98
|
+
|
|
99
|
+
DEPENDENCIES
|
|
100
|
+
bacon
|
|
101
|
+
bundler (~> 1.3)
|
|
102
|
+
cocoapods-plugins!
|
|
103
|
+
coveralls
|
|
104
|
+
mocha-on-bacon
|
|
105
|
+
prettybacon
|
|
106
|
+
rake
|
|
107
|
+
rubocop
|
|
108
|
+
webmock
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 David Grandinetti
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Cocoapods plugins
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/CocoaPods/cocoapods-plugins)
|
|
4
|
+
[](https://coveralls.io/r/CocoaPods/cocoapods-plugins)
|
|
5
|
+
[](https://codeclimate.com/github/CocoaPods/cocoapods-plugins)
|
|
6
|
+
|
|
7
|
+
CocoaPods plugin which shows info about available CocoaPods plugins. Yeah, it's very meta.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
$ pod plugins
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
$ gem install cocoapods-plugins
|
data/Rakefile
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
|
|
3
|
+
task :default => "spec"
|
|
4
|
+
|
|
5
|
+
# Bootstrap
|
|
6
|
+
#-----------------------------------------------------------------------------#
|
|
7
|
+
|
|
8
|
+
task :bootstrap do
|
|
9
|
+
sh "bundle install"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Spec
|
|
13
|
+
#-----------------------------------------------------------------------------#
|
|
14
|
+
|
|
15
|
+
desc "Runs all the specs"
|
|
16
|
+
task :spec do
|
|
17
|
+
start_time = Time.now
|
|
18
|
+
sh "bundle exec bacon #{specs('**')}"
|
|
19
|
+
duration = Time.now - start_time
|
|
20
|
+
puts "Tests completed in #{duration}s"
|
|
21
|
+
Rake::Task["rubocop"].invoke
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def specs(dir)
|
|
25
|
+
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Rubocop
|
|
29
|
+
#-----------------------------------------------------------------------------#
|
|
30
|
+
|
|
31
|
+
desc 'Checks code style'
|
|
32
|
+
task :rubocop do
|
|
33
|
+
if RUBY_VERSION >= '1.9.3'
|
|
34
|
+
require 'rubocop'
|
|
35
|
+
cli = Rubocop::CLI.new
|
|
36
|
+
result = cli.run(FileList['{spec,lib}/**/*.rb'])
|
|
37
|
+
abort('RuboCop failed!') unless result == 0
|
|
38
|
+
else
|
|
39
|
+
puts "[!] Ruby > 1.9 is required to run style checks"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'cocoapods_plugins.rb'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "cocoapods-plugins"
|
|
8
|
+
spec.version = CocoapodsPlugins::VERSION
|
|
9
|
+
spec.authors = ["David Grandinetti"]
|
|
10
|
+
spec.summary = %q{CocoaPods plugin which shows info about available CocoaPods plugins.}
|
|
11
|
+
spec.homepage = "https://github.com/cocoapods/cocoapods-plugins"
|
|
12
|
+
spec.license = "MIT"
|
|
13
|
+
|
|
14
|
+
spec.files = `git ls-files`.split($/)
|
|
15
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
17
|
+
spec.require_paths = ["lib"]
|
|
18
|
+
|
|
19
|
+
spec.add_runtime_dependency "cocoapods"
|
|
20
|
+
spec.add_runtime_dependency 'nap'
|
|
21
|
+
|
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
|
23
|
+
spec.add_development_dependency "rake"
|
|
24
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'pod/command/plugins'
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
require 'rest'
|
|
2
|
+
require 'json'
|
|
3
|
+
|
|
4
|
+
# The CocoaPods namespace
|
|
5
|
+
#
|
|
6
|
+
module Pod
|
|
7
|
+
class Command
|
|
8
|
+
|
|
9
|
+
# The pod plugins command.
|
|
10
|
+
#
|
|
11
|
+
class Plugins < Command
|
|
12
|
+
|
|
13
|
+
PLUGINS_URL = 'https://raw.githubusercontent.com/CocoaPods/cocoapods.org/master/data/plugins.json'
|
|
14
|
+
|
|
15
|
+
attr_accessor :json
|
|
16
|
+
|
|
17
|
+
self.summary = 'Show available CocoaPods plugins'
|
|
18
|
+
|
|
19
|
+
self.description = <<-DESC
|
|
20
|
+
Shows the available CocoaPods plugins and if you have them installed or not.
|
|
21
|
+
DESC
|
|
22
|
+
|
|
23
|
+
def download_json
|
|
24
|
+
response = REST.get(PLUGINS_URL)
|
|
25
|
+
if response.ok?
|
|
26
|
+
@json = JSON.parse(response.body)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def installed?(gemname)
|
|
31
|
+
if Gem::Specification.methods.include?(:find_all_by_name)
|
|
32
|
+
Gem::Specification.find_all_by_name(gemname).any?
|
|
33
|
+
else
|
|
34
|
+
# Fallback to Gem.available? for old versions of rubygems
|
|
35
|
+
Gem.available?(gemname)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def run
|
|
40
|
+
UI.puts "Downloading Plugins list..."
|
|
41
|
+
begin
|
|
42
|
+
download_json unless json
|
|
43
|
+
rescue => e
|
|
44
|
+
UI.puts e.message
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
if !json
|
|
48
|
+
UI.puts "Could not download plugins list from cocoapods.org"
|
|
49
|
+
else
|
|
50
|
+
print_plugins
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def print_plugins
|
|
55
|
+
UI.puts "Available CocoaPods Plugins\n\n"
|
|
56
|
+
|
|
57
|
+
@json['plugins'].each do |plugin|
|
|
58
|
+
UI.puts "Name: #{plugin['name']}"
|
|
59
|
+
|
|
60
|
+
if installed?(plugin['gem'])
|
|
61
|
+
UI.puts "Gem: #{plugin['gem']}".green
|
|
62
|
+
else
|
|
63
|
+
UI.puts "Gem: #{plugin['gem']}".yellow
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
UI.puts "URL: #{plugin['url']}"
|
|
67
|
+
UI.puts "\n#{plugin['description']}\n\n"
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
#-----------------------------------------------------------------------#
|
|
72
|
+
|
|
73
|
+
# The create subcommand. Used to create a new plugin using either the
|
|
74
|
+
# default template (CocoaPods/cocoapods-plugin-template) or a custom
|
|
75
|
+
# template
|
|
76
|
+
#
|
|
77
|
+
class Create < Plugins
|
|
78
|
+
self.summary = 'Creates a new plugin'
|
|
79
|
+
|
|
80
|
+
self.description = <<-DESC
|
|
81
|
+
Creates a scaffold for the development of a new plugin according to the CocoaPods best practices.
|
|
82
|
+
If a `TEMPLATE_URL`, pointing to a git repo containing a compatible template, is specified, it will be used in place of the default one.
|
|
83
|
+
DESC
|
|
84
|
+
|
|
85
|
+
self.arguments = 'NAME [TEMPLATE_URL]'
|
|
86
|
+
|
|
87
|
+
def initialize(argv)
|
|
88
|
+
@name = argv.shift_argument
|
|
89
|
+
@template_url = argv.shift_argument
|
|
90
|
+
super
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def validate!
|
|
94
|
+
super
|
|
95
|
+
help! "A name for the plugin is required." if @name.nil? || @name.empty?
|
|
96
|
+
help! "The plugin name cannot contain spaces." if @name.match(/\s/)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def run
|
|
100
|
+
clone_template
|
|
101
|
+
configure_template
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
private
|
|
105
|
+
|
|
106
|
+
#----------------------------------------#
|
|
107
|
+
|
|
108
|
+
# !@group Private helpers
|
|
109
|
+
|
|
110
|
+
extend Executable
|
|
111
|
+
executable :git
|
|
112
|
+
executable :ruby
|
|
113
|
+
|
|
114
|
+
TEMPLATE_REPO = "https://github.com/CocoaPods/cocoapods-plugin-template.git"
|
|
115
|
+
TEMPLATE_INFO_URL = "https://github.com/CocoaPods/cocoapods-plugin-template"
|
|
116
|
+
|
|
117
|
+
# Clones the template from the remote in the working directory using
|
|
118
|
+
# the name of the plugin.
|
|
119
|
+
#
|
|
120
|
+
# @return [void]
|
|
121
|
+
#
|
|
122
|
+
def clone_template
|
|
123
|
+
UI.section("Creating `#{@name}` plugin") do
|
|
124
|
+
git! "clone '#{template_repo_url}' #{@name}"
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Runs the template configuration utilities.
|
|
129
|
+
#
|
|
130
|
+
# @return [void]
|
|
131
|
+
#
|
|
132
|
+
def configure_template
|
|
133
|
+
UI.section("Configuring template") do
|
|
134
|
+
Dir.chdir(@name) do
|
|
135
|
+
if File.file? "configure"
|
|
136
|
+
system "./configure #{@name}"
|
|
137
|
+
else
|
|
138
|
+
UI.warn "Template does not have a configure file."
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Checks if a template URL is given else returns the TEMPLATE_REPO URL
|
|
145
|
+
#
|
|
146
|
+
# @return String
|
|
147
|
+
#
|
|
148
|
+
def template_repo_url
|
|
149
|
+
@template_url || TEMPLATE_REPO
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
# The CocoaPods namespace
|
|
4
|
+
#
|
|
5
|
+
module Pod
|
|
6
|
+
describe Command::Plugins do
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
argv = CLAide::ARGV.new([])
|
|
10
|
+
@command = Command::Plugins.new(argv)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "registers it self" do
|
|
14
|
+
Command.parse(%w(plugins)).should.be.instance_of Command::Plugins
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "exists" do
|
|
18
|
+
@command.should.not.be.nil?
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "has a json attribute that starts out nil" do
|
|
22
|
+
@command.json.should.be.nil?
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "downloads the json file" do
|
|
26
|
+
json = File.read(fixture('plugins.json'))
|
|
27
|
+
stub_request(:get, Command::Plugins::PLUGINS_URL).to_return(:status => 200, :body => json, :headers => {})
|
|
28
|
+
@command.download_json
|
|
29
|
+
@command.json.should.not.be.nil?
|
|
30
|
+
@command.json.should.be.kind_of? Hash
|
|
31
|
+
@command.json['plugins'].size.should.eql? 2
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "handles empty/bad JSON" do
|
|
35
|
+
stub_request(:get, Command::Plugins::PLUGINS_URL).to_return(:status => 200, :body => "This is not JSON", :headers => {})
|
|
36
|
+
@command.run
|
|
37
|
+
UI.output.should.include("Could not download plugins list from cocoapods.org")
|
|
38
|
+
@command.json.should.be.nil?
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "notifies the user if the download fails" do
|
|
42
|
+
stub_request(:get, Command::Plugins::PLUGINS_URL).to_return(:status => [404, "Not Found"])
|
|
43
|
+
@command.run
|
|
44
|
+
UI.output.should.include("Could not download plugins list from cocoapods.org")
|
|
45
|
+
@command.json.should.be.nil?
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "prints out each plugin" do
|
|
49
|
+
json_fixture = fixture('plugins.json')
|
|
50
|
+
@json = JSON.parse(File.read(json_fixture))
|
|
51
|
+
@command.json = @json
|
|
52
|
+
@command.run
|
|
53
|
+
UI.output.should.include("github.com/CocoaPods/cocoapods-fake")
|
|
54
|
+
UI.output.should.include("github.com/chneukirchen/bacon")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "detects if a gem is installed" do
|
|
58
|
+
@command.installed?("bacon").should.be.true
|
|
59
|
+
@command.installed?("fake-fake-fake-gem").should.be.false
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
describe Command::Plugins::Create do
|
|
65
|
+
extend SpecHelper::PluginCreateCommand
|
|
66
|
+
|
|
67
|
+
it "registers itself" do
|
|
68
|
+
Command.parse(%w(plugins create)).should.be.instance_of Command::Plugins::Create
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "should require a name is passed in" do
|
|
72
|
+
@command = create_command(argv)
|
|
73
|
+
# rubocop:disable Lambda
|
|
74
|
+
lambda { @command.validate! }
|
|
75
|
+
.should.raise(CLAide::Help)
|
|
76
|
+
.message.should.match(/A name for the plugin is required./)
|
|
77
|
+
# rubocop:enable Lambda
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "should require a non-empty name is passed in" do
|
|
81
|
+
@command = create_command(argv(""))
|
|
82
|
+
# rubocop:disable Lambda
|
|
83
|
+
lambda { @command.validate! }
|
|
84
|
+
.should.raise(CLAide::Help)
|
|
85
|
+
.message.should.match(/A name for the plugin is required./)
|
|
86
|
+
# rubocop:enable Lambda
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it "should require the name does not have spaces" do
|
|
90
|
+
@command = create_command(argv("my gem"))
|
|
91
|
+
# rubocop:disable Lambda
|
|
92
|
+
lambda { @command.validate! }
|
|
93
|
+
.should.raise(CLAide::Help)
|
|
94
|
+
.message.should.match(/The plugin name cannot contain spaces./)
|
|
95
|
+
# rubocop:enable Lambda
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it "should download the default template repository" do
|
|
99
|
+
@command = create_command(argv("cocoapods-banana"))
|
|
100
|
+
# @command = Command::Plugins::Create.new(argv("cocoapods-banana"))
|
|
101
|
+
|
|
102
|
+
git_command = "clone 'https://github.com/CocoaPods/cocoapods-plugin-template.git' cocoapods-banana"
|
|
103
|
+
@command.expects(:git!).with(git_command)
|
|
104
|
+
@command.expects(:configure_template)
|
|
105
|
+
@command.run
|
|
106
|
+
UI.output.should.include("Creating `cocoapods-banana` plugin")
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it "should download the passed in template repository" do
|
|
110
|
+
alt_repository = "https://github.com/CocoaPods/cocoapods-banana-plugin-template.git"
|
|
111
|
+
@command = create_command(argv("cocoapods-banana", alt_repository))
|
|
112
|
+
|
|
113
|
+
@command.expects(:git!).with("clone '#{alt_repository}' cocoapods-banana")
|
|
114
|
+
@command.expects(:configure_template)
|
|
115
|
+
@command.run
|
|
116
|
+
UI.output.should.include("Creating `cocoapods-banana` plugin")
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugins":[
|
|
3
|
+
{
|
|
4
|
+
"gem":"cocoapods-fake-fake-fake",
|
|
5
|
+
"name":"CocoaPods Fake Gem",
|
|
6
|
+
"url":"https://github.com/CocoaPods/cocoapods-fake",
|
|
7
|
+
"description":"A Pod that should not exist."
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"gem":"bacon",
|
|
11
|
+
"name":"Bacon",
|
|
12
|
+
"url":"https://github.com/chneukirchen/bacon",
|
|
13
|
+
"description":"A minimal RSpec clone."
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Set up coverage analysis
|
|
2
|
+
#-----------------------------------------------------------------------------#
|
|
3
|
+
if ENV['CI'] || ENV['GENERATE_COVERAGE']
|
|
4
|
+
require 'simplecov'
|
|
5
|
+
require 'coveralls'
|
|
6
|
+
|
|
7
|
+
if ENV['CI']
|
|
8
|
+
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
|
9
|
+
elsif ENV['GENERATE_COVERAGE']
|
|
10
|
+
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
|
|
11
|
+
end
|
|
12
|
+
SimpleCov.start do
|
|
13
|
+
add_filter '/travis_bundle_dir'
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# General Setup
|
|
18
|
+
#-----------------------------------------------------------------------------#
|
|
19
|
+
|
|
20
|
+
require 'pathname'
|
|
21
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
|
22
|
+
$LOAD_PATH.unshift((ROOT + 'lib').to_s)
|
|
23
|
+
$LOAD_PATH.unshift((ROOT + 'spec').to_s)
|
|
24
|
+
|
|
25
|
+
require 'bundler/setup'
|
|
26
|
+
require 'bacon'
|
|
27
|
+
require 'mocha-on-bacon'
|
|
28
|
+
require 'pretty_bacon'
|
|
29
|
+
|
|
30
|
+
require 'webmock'
|
|
31
|
+
include WebMock::API
|
|
32
|
+
|
|
33
|
+
require 'cocoapods'
|
|
34
|
+
require 'cocoapods_plugin'
|
|
35
|
+
|
|
36
|
+
#-----------------------------------------------------------------------------#
|
|
37
|
+
|
|
38
|
+
# The CocoaPods namespace
|
|
39
|
+
#
|
|
40
|
+
module Pod
|
|
41
|
+
|
|
42
|
+
# Disable the wrapping so the output is deterministic in the tests.
|
|
43
|
+
#
|
|
44
|
+
UI.disable_wrap = true
|
|
45
|
+
|
|
46
|
+
# Redirects the messages to an internal store.
|
|
47
|
+
#
|
|
48
|
+
module UI
|
|
49
|
+
@output = ''
|
|
50
|
+
@warnings = ''
|
|
51
|
+
|
|
52
|
+
class << self
|
|
53
|
+
attr_accessor :output
|
|
54
|
+
attr_accessor :warnings
|
|
55
|
+
|
|
56
|
+
def puts(message = '')
|
|
57
|
+
@output << "#{message}\n"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def warn(message = '', actions = [])
|
|
61
|
+
@warnings << "#{message}\n"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def print(message)
|
|
65
|
+
@output << message
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
#-----------------------------------------------------------------------------#
|
|
72
|
+
|
|
73
|
+
# Bacon namespace
|
|
74
|
+
#
|
|
75
|
+
module Bacon
|
|
76
|
+
# Add a fixture helper to the Bacon Context
|
|
77
|
+
class Context
|
|
78
|
+
ROOT = ::ROOT + 'spec/fixtures'
|
|
79
|
+
|
|
80
|
+
def fixture(name)
|
|
81
|
+
ROOT + name
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
#-----------------------------------------------------------------------------#
|
|
87
|
+
|
|
88
|
+
# Pod namespace
|
|
89
|
+
#
|
|
90
|
+
module SpecHelper
|
|
91
|
+
# Add this as an extention into the Create specs
|
|
92
|
+
module PluginCreateCommand
|
|
93
|
+
|
|
94
|
+
def argv(*args)
|
|
95
|
+
CLAide::ARGV.new(args)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def create_command(args)
|
|
99
|
+
Pod::Command::Plugins::Create.new(args)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
end
|
|
103
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: cocoapods-plugins
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- David Grandinetti
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-04-22 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: cocoapods
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - '>='
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - '>='
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: nap
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: bundler
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ~>
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.3'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ~>
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '1.3'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rake
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - '>='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
description:
|
|
70
|
+
email:
|
|
71
|
+
executables: []
|
|
72
|
+
extensions: []
|
|
73
|
+
extra_rdoc_files: []
|
|
74
|
+
files:
|
|
75
|
+
- .gitignore
|
|
76
|
+
- .rubocop.yml
|
|
77
|
+
- .travis.yml
|
|
78
|
+
- CHANGELOG.md
|
|
79
|
+
- Gemfile
|
|
80
|
+
- Gemfile.lock
|
|
81
|
+
- LICENSE
|
|
82
|
+
- README.md
|
|
83
|
+
- Rakefile
|
|
84
|
+
- cocoapods-plugins.gemspec
|
|
85
|
+
- lib/cocoapods_plugin.rb
|
|
86
|
+
- lib/cocoapods_plugins.rb
|
|
87
|
+
- lib/pod/command/plugins.rb
|
|
88
|
+
- spec/command/plugins_spec.rb
|
|
89
|
+
- spec/fixtures/plugins.json
|
|
90
|
+
- spec/spec_helper.rb
|
|
91
|
+
homepage: https://github.com/cocoapods/cocoapods-plugins
|
|
92
|
+
licenses:
|
|
93
|
+
- MIT
|
|
94
|
+
metadata: {}
|
|
95
|
+
post_install_message:
|
|
96
|
+
rdoc_options: []
|
|
97
|
+
require_paths:
|
|
98
|
+
- lib
|
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - '>='
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
|
+
requirements:
|
|
106
|
+
- - '>='
|
|
107
|
+
- !ruby/object:Gem::Version
|
|
108
|
+
version: '0'
|
|
109
|
+
requirements: []
|
|
110
|
+
rubyforge_project:
|
|
111
|
+
rubygems_version: 2.2.2
|
|
112
|
+
signing_key:
|
|
113
|
+
specification_version: 4
|
|
114
|
+
summary: CocoaPods plugin which shows info about available CocoaPods plugins.
|
|
115
|
+
test_files:
|
|
116
|
+
- spec/command/plugins_spec.rb
|
|
117
|
+
- spec/fixtures/plugins.json
|
|
118
|
+
- spec/spec_helper.rb
|