cocoapods-plugins 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop-cocoapods.yml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +1 -1
- data/Rakefile +47 -29
- data/lib/cocoapods_plugins.rb +1 -1
- data/lib/pod/command/plugins/create.rb +12 -3
- data/lib/pod/command/plugins/search.rb +3 -1
- data/spec/command/plugins/create_spec.rb +32 -15
- data/spec/command/plugins/search_spec.rb +6 -10
- data/spec/command/plugins_helper_spec.rb +8 -11
- data/spec/spec_helper.rb +1 -1
- metadata +16 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 627b3a781e5eb3dcd8bab22e1c54fab8cd28195f
|
4
|
+
data.tar.gz: df053120c04bba449b761518c619f5843eac54ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cd540ae5191ef202aebf16877f9ba09e10213162eefa8abd3787a2f1a2fda32cf82c417a799b3ed0e910956477cf3556ffbadab168a1b58ef2060b7fa2c0cab
|
7
|
+
data.tar.gz: ee7c74aa53ab71e6be6b5652dfb165215a596cb4aa5f64f7ab625b5ff56f0b5eb12c21a0ddc91241677c8d8d30f71284c83f3ef079f794d804bcf08f5a7d98b1
|
data/.rubocop-cocoapods.yml
CHANGED
@@ -44,18 +44,18 @@ Lambda:
|
|
44
44
|
# Allow for `should.match /regexp/`.
|
45
45
|
AmbiguousRegexpLiteral:
|
46
46
|
Exclude:
|
47
|
-
- spec
|
47
|
+
- spec/**/*
|
48
48
|
|
49
49
|
# Allow `object.should == object` syntax.
|
50
50
|
Void:
|
51
51
|
Exclude:
|
52
|
-
- spec
|
52
|
+
- spec/**/*
|
53
53
|
|
54
54
|
ClassAndModuleChildren:
|
55
55
|
Exclude:
|
56
|
-
- spec
|
56
|
+
- spec/**/*
|
57
57
|
|
58
58
|
UselessComparison:
|
59
59
|
Exclude:
|
60
|
-
- spec
|
60
|
+
- spec/**/*
|
61
61
|
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Cocoapods::Plugins Changelog
|
2
2
|
|
3
|
+
## 0.2.0
|
4
|
+
|
5
|
+
* Migrating to new syntax of CLAide::Command#arguments (fix #23)
|
6
|
+
[Olivier Halligon](https://github.com/AliSoftware)
|
7
|
+
|
8
|
+
* Printing URL of template used (fixes #21) [Olivier Halligon]
|
9
|
+
[Olivier Halligon](https://github.com/AliSoftware)
|
10
|
+
|
11
|
+
* `create` subcommand now prefixes the given name if not already (fix #20)
|
12
|
+
[Olivier Halligon](https://github.com/AliSoftware)
|
13
|
+
|
3
14
|
## 0.1.1
|
4
15
|
|
5
16
|
* Making `pod plugins` an abstract command, with `list` the default subcommand (#11, #12)
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -1,41 +1,59 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
|
3
|
-
task :default => 'spec'
|
4
|
-
|
5
1
|
# Bootstrap
|
6
2
|
#-----------------------------------------------------------------------------#
|
7
3
|
|
8
4
|
task :bootstrap do
|
9
|
-
|
5
|
+
if system('which bundle')
|
6
|
+
sh 'bundle install'
|
7
|
+
else
|
8
|
+
$stderr.puts "\033[0;31m" \
|
9
|
+
"[!] Please install the bundler gem manually:\n" \
|
10
|
+
" $ [sudo] gem install bundler" \
|
11
|
+
"\e[0m"
|
12
|
+
exit 1
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
|
-
|
13
|
-
#-----------------------------------------------------------------------------#
|
16
|
+
begin
|
14
17
|
|
15
|
-
|
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
|
18
|
+
require 'bundler/gem_tasks'
|
23
19
|
|
24
|
-
|
25
|
-
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
|
26
|
-
end
|
20
|
+
task :default => 'spec'
|
27
21
|
|
28
|
-
# Rubocop
|
29
|
-
#-----------------------------------------------------------------------------#
|
30
22
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
puts
|
23
|
+
# Spec
|
24
|
+
#-----------------------------------------------------------------------------#
|
25
|
+
|
26
|
+
desc 'Runs all the specs'
|
27
|
+
task :spec do
|
28
|
+
start_time = Time.now
|
29
|
+
sh "bundle exec bacon #{specs('**')}"
|
30
|
+
duration = Time.now - start_time
|
31
|
+
puts "Tests completed in #{duration}s"
|
32
|
+
Rake::Task['rubocop'].invoke
|
33
|
+
end
|
34
|
+
|
35
|
+
def specs(dir)
|
36
|
+
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
|
40
37
|
end
|
38
|
+
|
39
|
+
# Rubocop
|
40
|
+
#-----------------------------------------------------------------------------#
|
41
|
+
|
42
|
+
desc 'Checks code style'
|
43
|
+
task :rubocop do
|
44
|
+
if RUBY_VERSION >= '1.9.3'
|
45
|
+
require 'rubocop'
|
46
|
+
cli = Rubocop::CLI.new
|
47
|
+
result = cli.run(FileList['{spec,lib}/**/*.rb'])
|
48
|
+
abort('RuboCop failed!') unless result == 0
|
49
|
+
else
|
50
|
+
puts '[!] Ruby > 1.9 is required to run style checks'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
rescue LoadError
|
55
|
+
$stderr.puts "\033[0;31m" \
|
56
|
+
'[!] Some Rake tasks haven been disabled because the environment' \
|
57
|
+
' couldn’t be loaded. Be sure to run `rake bootstrap` first.' \
|
58
|
+
"\e[0m"
|
41
59
|
end
|
data/lib/cocoapods_plugins.rb
CHANGED
@@ -6,6 +6,8 @@ module Pod
|
|
6
6
|
# template
|
7
7
|
#
|
8
8
|
class Create < Plugins
|
9
|
+
NAME_PREFIX = 'cocoapods-'
|
10
|
+
|
9
11
|
self.summary = 'Creates a new plugin'
|
10
12
|
self.description = <<-DESC
|
11
13
|
Creates a scaffold for the development of a new plugin
|
@@ -16,10 +18,16 @@ module Pod
|
|
16
18
|
in place of the default one.
|
17
19
|
DESC
|
18
20
|
|
19
|
-
self.arguments =
|
21
|
+
self.arguments = [
|
22
|
+
['NAME', :required],
|
23
|
+
['TEMPLATE_URL', :optional]
|
24
|
+
]
|
20
25
|
|
21
26
|
def initialize(argv)
|
22
27
|
@name = argv.shift_argument
|
28
|
+
unless @name.nil? || @name.empty? || @name.index(NAME_PREFIX) == 0
|
29
|
+
@name = @name.dup.prepend(NAME_PREFIX)
|
30
|
+
end
|
23
31
|
@template_url = argv.shift_argument
|
24
32
|
super
|
25
33
|
end
|
@@ -59,7 +67,8 @@ module Pod
|
|
59
67
|
# @return [void]
|
60
68
|
#
|
61
69
|
def clone_template
|
62
|
-
UI.section("Creating `#{@name}` plugin") do
|
70
|
+
UI.section("-> Creating `#{@name}` plugin") do
|
71
|
+
UI.notice "using template '#{template_repo_url}'"
|
63
72
|
git! "clone '#{template_repo_url}' #{@name}"
|
64
73
|
end
|
65
74
|
end
|
@@ -69,7 +78,7 @@ module Pod
|
|
69
78
|
# @return [void]
|
70
79
|
#
|
71
80
|
def configure_template
|
72
|
-
UI.section('Configuring template') do
|
81
|
+
UI.section('-> Configuring template') do
|
73
82
|
Dir.chdir(@name) do
|
74
83
|
if File.file? 'configure'
|
75
84
|
system "./configure #{@name}"
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require File.expand_path('../../../spec_helper', __FILE__)
|
2
|
+
require 'tmpdir'
|
2
3
|
|
3
4
|
# The CocoaPods namespace
|
4
5
|
#
|
@@ -19,29 +20,45 @@ module Pod
|
|
19
20
|
|
20
21
|
it 'should require a name is passed in' do
|
21
22
|
@command = create_command
|
22
|
-
|
23
|
-
|
24
|
-
.should.
|
25
|
-
.message.should.match(/A name for the plugin is required./)
|
26
|
-
# rubocop:enable Lambda
|
23
|
+
should.raise(CLAide::Help) do
|
24
|
+
@command.validate!
|
25
|
+
end.message.should.match(/A name for the plugin is required./)
|
27
26
|
end
|
28
27
|
|
29
28
|
it 'should require a non-empty name is passed in' do
|
30
29
|
@command = create_command('')
|
31
|
-
|
32
|
-
|
33
|
-
.should.
|
34
|
-
.message.should.match(/A name for the plugin is required./)
|
35
|
-
# rubocop:enable Lambda
|
30
|
+
should.raise(CLAide::Help) do
|
31
|
+
@command.validate!
|
32
|
+
end.message.should.match(/A name for the plugin is required./)
|
36
33
|
end
|
37
34
|
|
38
35
|
it 'should require the name does not have spaces' do
|
39
36
|
@command = create_command('my gem')
|
40
|
-
|
41
|
-
|
42
|
-
.should.
|
43
|
-
|
44
|
-
|
37
|
+
should.raise(CLAide::Help) do
|
38
|
+
@command.validate!
|
39
|
+
end.message.should.match(/The plugin name cannot contain spaces./)
|
40
|
+
end
|
41
|
+
|
42
|
+
#--- Naming
|
43
|
+
|
44
|
+
it 'should prefix the given name if not already' do
|
45
|
+
@command = create_command('unprefixed')
|
46
|
+
Dir.mktmpdir do |tmpdir|
|
47
|
+
Dir.chdir(tmpdir) do
|
48
|
+
@command.run
|
49
|
+
end
|
50
|
+
end
|
51
|
+
UI.output.should.include('Creating `cocoapods-unprefixed` plugin')
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should not prefix the name if already prefixed' do
|
55
|
+
@command = create_command('cocoapods-prefixed')
|
56
|
+
Dir.mktmpdir do |tmpdir|
|
57
|
+
Dir.chdir(tmpdir) do
|
58
|
+
@command.run
|
59
|
+
end
|
60
|
+
end
|
61
|
+
UI.output.should.include('Creating `cocoapods-prefixed` plugin')
|
45
62
|
end
|
46
63
|
|
47
64
|
#--- Template download
|
@@ -20,20 +20,16 @@ module Pod
|
|
20
20
|
|
21
21
|
it 'should require a non-empty query' do
|
22
22
|
@command = search_command
|
23
|
-
|
24
|
-
|
25
|
-
.should.
|
26
|
-
.message.should.match(/A search query is required./)
|
27
|
-
# rubocop:enable Lambda
|
23
|
+
should.raise(CLAide::Help) do
|
24
|
+
@command.validate!
|
25
|
+
end.message.should.match(/A search query is required./)
|
28
26
|
end
|
29
27
|
|
30
28
|
it 'should require a valid RegExp as query' do
|
31
29
|
@command = search_command('[invalid')
|
32
|
-
|
33
|
-
|
34
|
-
.should.
|
35
|
-
.message.should.match(/A valid regular expression is required./)
|
36
|
-
# rubocop:enable Lambda
|
30
|
+
should.raise(CLAide::Help) do
|
31
|
+
@command.validate!
|
32
|
+
end.message.should.match(/A valid regular expression is required./)
|
37
33
|
end
|
38
34
|
|
39
35
|
#--- Output printing
|
@@ -16,21 +16,18 @@ module Pod
|
|
16
16
|
|
17
17
|
it 'handles empty/bad JSON' do
|
18
18
|
stub_plugins_json_request 'This is not JSON'
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
.message.should.match(
|
23
|
-
# rubocop:enable Lambda
|
19
|
+
expected_error = /Invalid plugins list from cocoapods.org/
|
20
|
+
should.raise(Pod::Informative) do
|
21
|
+
Command::PluginsHelper.download_json
|
22
|
+
end.message.should.match(expected_error)
|
24
23
|
end
|
25
24
|
|
26
25
|
it 'notifies the user if the download fails' do
|
27
26
|
stub_plugins_json_request '', [404, 'Not Found']
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
.message.should
|
32
|
-
.match(/Could not download plugins list from cocoapods.org/)
|
33
|
-
# rubocop:enable Lambda
|
27
|
+
expected_error = /Could not download plugins list from cocoapods.org/
|
28
|
+
should.raise(Pod::Informative) do
|
29
|
+
Command::PluginsHelper.download_json
|
30
|
+
end.message.should.match(expected_error)
|
34
31
|
end
|
35
32
|
|
36
33
|
it 'detects if a gem is installed' do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Grandinetti
|
@@ -9,48 +9,48 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nap
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: bundler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '1.3'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - ~>
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.3'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
description: |2
|
@@ -63,10 +63,10 @@ executables: []
|
|
63
63
|
extensions: []
|
64
64
|
extra_rdoc_files: []
|
65
65
|
files:
|
66
|
-
- .gitignore
|
67
|
-
- .rubocop-cocoapods.yml
|
68
|
-
- .rubocop.yml
|
69
|
-
- .travis.yml
|
66
|
+
- ".gitignore"
|
67
|
+
- ".rubocop-cocoapods.yml"
|
68
|
+
- ".rubocop.yml"
|
69
|
+
- ".travis.yml"
|
70
70
|
- CHANGELOG.md
|
71
71
|
- Gemfile
|
72
72
|
- Gemfile.lock
|
@@ -98,17 +98,17 @@ require_paths:
|
|
98
98
|
- lib
|
99
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
|
-
- -
|
106
|
+
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.2.2
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: CocoaPods plugin which shows info about available CocoaPods plugins.
|
@@ -120,3 +120,4 @@ test_files:
|
|
120
120
|
- spec/command/plugins_spec.rb
|
121
121
|
- spec/fixtures/plugins.json
|
122
122
|
- spec/spec_helper.rb
|
123
|
+
has_rdoc:
|