cocoapods-try 0.2.0 → 0.3.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 +75 -0
- data/.rubocop.yml +3 -51
- data/.travis.yml +30 -5
- data/CHANGELOG.md +7 -0
- data/Gemfile +7 -1
- data/README.md +3 -2
- data/Rakefile +49 -31
- data/lib/cocoapods_try.rb +1 -1
- data/lib/pod/command/try.rb +8 -10
- data/rubocop-todo.yml +24 -0
- data/spec/command/try_spec.rb +39 -51
- data/spec/spec_helper.rb +5 -9
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96c77d593882a43d42a31cbeb6cb8db6ea234cd7
|
4
|
+
data.tar.gz: 18062853945e64715d58e9b1e1facf3b3128f678
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57ef162b36fdd68ee2d7ccfe8465a6814ba3de6a265c51a9b625c624bd0658b40b523648629c5d6464938c4310fd60d89cc663c82b9ee379b0bea479379b6b44
|
7
|
+
data.tar.gz: 2cdc4f983a001547e7b22dafd072a24a830c588717b0f1e9c3bfbd6d6209a734a7cb334e3bbe77699181a7200510a35a8c87ad0eae70642f95c1a0fc37a5dd79
|
@@ -0,0 +1,75 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- Rakefile
|
4
|
+
- Gemfile
|
5
|
+
- ./*.gemspec
|
6
|
+
Exclude:
|
7
|
+
- spec/fixtures/**/*
|
8
|
+
|
9
|
+
# At the moment not ready to be used
|
10
|
+
# https://github.com/bbatsov/rubocop/issues/947
|
11
|
+
Documentation:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
#- CocoaPods -----------------------------------------------------------------#
|
15
|
+
|
16
|
+
# We adopted raise instead of fail.
|
17
|
+
SignalException:
|
18
|
+
EnforcedStyle: only_raise
|
19
|
+
|
20
|
+
# They are idiomatic
|
21
|
+
AssignmentInCondition:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
# Allow backticks
|
25
|
+
AsciiComments:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
# Indentation clarifies logic branches in implementations
|
29
|
+
IfUnlessModifier:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
# No enforced convention here.
|
33
|
+
SingleLineBlockParams:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
# We only add the comment when needed.
|
37
|
+
Encoding:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
# Having these make it easier to *not* forget to add one when adding a new
|
41
|
+
# value and you can simply copy the previous line.
|
42
|
+
TrailingComma:
|
43
|
+
EnforcedStyleForMultiline: comma
|
44
|
+
|
45
|
+
#- CocoaPods support for Ruby 1.8.7 ------------------------------------------#
|
46
|
+
|
47
|
+
HashSyntax:
|
48
|
+
EnforcedStyle: hash_rockets
|
49
|
+
|
50
|
+
Lambda:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
DotPosition:
|
54
|
+
EnforcedStyle: trailing
|
55
|
+
|
56
|
+
#- CocoaPods specs -----------------------------------------------------------#
|
57
|
+
|
58
|
+
# Allow for `should.match /regexp/`.
|
59
|
+
AmbiguousRegexpLiteral:
|
60
|
+
Exclude:
|
61
|
+
- spec/**/*
|
62
|
+
|
63
|
+
# Allow `object.should == object` syntax.
|
64
|
+
Void:
|
65
|
+
Exclude:
|
66
|
+
- spec/**/*
|
67
|
+
|
68
|
+
ClassAndModuleChildren:
|
69
|
+
Exclude:
|
70
|
+
- spec/**/*
|
71
|
+
|
72
|
+
UselessComparison:
|
73
|
+
Exclude:
|
74
|
+
- spec/**/*
|
75
|
+
|
data/.rubocop.yml
CHANGED
@@ -1,51 +1,3 @@
|
|
1
|
-
|
2
|
-
|
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
|
-
|
1
|
+
inherit_from:
|
2
|
+
- rubocop-todo.yml
|
3
|
+
- .rubocop-cocoapods.yml
|
data/.travis.yml
CHANGED
@@ -1,10 +1,35 @@
|
|
1
|
+
|
2
|
+
# Sets Travis to run the Ruby specs on OS X machines which are required to
|
3
|
+
# build the native extensions of Xcodeproj.
|
4
|
+
#
|
1
5
|
language: objective-c
|
6
|
+
|
2
7
|
env:
|
3
|
-
|
4
|
-
- RVM_RUBY_VERSION=
|
5
|
-
|
8
|
+
- RVM_RUBY_VERSION=system
|
9
|
+
- RVM_RUBY_VERSION=1.8.7-p358
|
10
|
+
|
11
|
+
addons:
|
12
|
+
code_climate:
|
13
|
+
repo_token: e8abdb417b7d86d7427d8861e85209c7b194820bb372a1c05f0529835eac9c7c
|
14
|
+
|
6
15
|
before_install:
|
16
|
+
- export LANG=en_US.UTF-8
|
7
17
|
- curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
|
8
|
-
- source ~/.rvm/scripts/rvm
|
9
|
-
|
18
|
+
- source ~/.rvm/scripts/rvm
|
19
|
+
- if [[ $RVM_RUBY_VERSION != 'system' ]]; then rvm install $RVM_RUBY_VERSION; fi
|
20
|
+
- rvm use $RVM_RUBY_VERSION
|
21
|
+
- if [[ $RVM_RUBY_VERSION == 'system' ]]; then export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future; fi
|
22
|
+
- if [[ $RVM_RUBY_VERSION == 'system' ]]; then sudo gem install bundler --no-ri --no-rdoc; else gem install bundler --no-ri --no-rdoc; fi
|
23
|
+
|
24
|
+
install:
|
25
|
+
- bundle install --without=debugging documentation --path ./travis_bundle_dir
|
26
|
+
|
10
27
|
script: bundle exec rake spec
|
28
|
+
|
29
|
+
notifications:
|
30
|
+
campfire:
|
31
|
+
on_success: change
|
32
|
+
on_failure: always
|
33
|
+
rooms:
|
34
|
+
- secure: "qOE5zmgaHe/qQu3W9rmj7wygA5Ivl+cx50fqWGag2bdRl8ly5yj1NVoOKk/O\nZmQc4Lze+301uvTXi+r5v8A/tF6W1kUZw7yBiKuXoYFUGmDiVR9o2I/FPwkL\ngSzPJttrXTQfkQ4PbnrkX+JO+5bLWrKaO0hKXT4B2yUu4UXLVk0="
|
35
|
+
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -3,11 +3,17 @@ source 'https://rubygems.org'
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem 'cocoapods'
|
6
|
+
gem 'cocoapods', :git => "https://github.com/CocoaPods/Cocoapods.git", :branch => 'master'
|
7
7
|
gem 'bacon'
|
8
8
|
gem 'mocha-on-bacon'
|
9
|
+
gem 'mocha'
|
9
10
|
gem 'prettybacon'
|
11
|
+
|
10
12
|
if RUBY_VERSION >= '1.9.3'
|
11
13
|
gem 'rubocop'
|
14
|
+
|
15
|
+
gem 'codeclimate-test-reporter', :require => nil
|
16
|
+
# Bug: https://github.com/colszowka/simplecov/issues/281
|
17
|
+
gem 'simplecov', '0.7.1'
|
12
18
|
end
|
13
19
|
end
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# Cocoapods try
|
2
2
|
|
3
|
-
[![Build Status](https://
|
4
|
-
[![
|
3
|
+
[![Build Status](https://img.shields.io/travis/CocoaPods/cocoapods-try/master.svg?style=flat)](https://travis-ci.org/CocoaPods/cocoapods-try)
|
4
|
+
[![Coverage](https://img.shields.io/codeclimate/coverage/github/CocoaPods/cocoapods-try.svg?style=flat)](https://codeclimate.com/github/CocoaPods/cocoapods-try)
|
5
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/CocoaPods/cocoapods-try.svg?style=flat)](https://codeclimate.com/github/CocoaPods/cocoapods-try)
|
5
6
|
|
6
7
|
CocoaPods plugin which allows to quickly try the demo project of a Pod.
|
7
8
|
|
data/Rakefile
CHANGED
@@ -1,45 +1,63 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
|
3
|
-
task :default => "spec"
|
4
|
-
|
5
1
|
# Bootstrap
|
6
2
|
#-----------------------------------------------------------------------------#
|
7
3
|
|
8
4
|
task :bootstrap, :use_bundle_dir? do |t, args|
|
9
|
-
if
|
10
|
-
|
5
|
+
if system('which bundle')
|
6
|
+
if args[:use_bundle_dir?]
|
7
|
+
sh 'bundle install --path ./travis_bundle_dir'
|
8
|
+
else
|
9
|
+
sh 'bundle install'
|
10
|
+
end
|
11
11
|
else
|
12
|
-
|
12
|
+
$stderr.puts "\033[0;31m" \
|
13
|
+
"[!] Please install the bundler gem manually:\n" \
|
14
|
+
' $ [sudo] gem install bundler' \
|
15
|
+
"\e[0m"
|
16
|
+
exit 1
|
13
17
|
end
|
14
18
|
end
|
15
19
|
|
16
|
-
|
17
|
-
#-----------------------------------------------------------------------------#
|
20
|
+
begin
|
18
21
|
|
19
|
-
|
20
|
-
task :spec do
|
21
|
-
start_time = Time.now
|
22
|
-
sh "bundle exec bacon #{specs('**')}"
|
23
|
-
duration = Time.now - start_time
|
24
|
-
puts "Tests completed in #{duration}s"
|
25
|
-
Rake::Task["rubocop"].invoke
|
26
|
-
end
|
22
|
+
require 'bundler/gem_tasks'
|
27
23
|
|
28
|
-
|
29
|
-
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
|
30
|
-
end
|
24
|
+
task :default => 'spec'
|
31
25
|
|
32
|
-
#
|
33
|
-
#-----------------------------------------------------------------------------#
|
26
|
+
# Spec
|
27
|
+
#-----------------------------------------------------------------------------#
|
34
28
|
|
35
|
-
desc '
|
36
|
-
task :
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
29
|
+
desc 'Runs all the specs'
|
30
|
+
task :spec do
|
31
|
+
puts "\033[0;32mUsing #{`ruby --version`}\033[0m"
|
32
|
+
start_time = Time.now
|
33
|
+
sh "bundle exec bacon #{specs('**')}"
|
34
|
+
duration = Time.now - start_time
|
35
|
+
puts "Tests completed in #{duration}s"
|
36
|
+
Rake::Task['rubocop'].invoke
|
37
|
+
end
|
38
|
+
|
39
|
+
def specs(dir)
|
40
|
+
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
|
44
41
|
end
|
42
|
+
|
43
|
+
# Rubocop
|
44
|
+
#-----------------------------------------------------------------------------#
|
45
|
+
|
46
|
+
desc 'Checks code style'
|
47
|
+
task :rubocop do
|
48
|
+
if RUBY_VERSION >= '1.9.3'
|
49
|
+
require 'rubocop'
|
50
|
+
cli = Rubocop::CLI.new
|
51
|
+
result = cli.run(FileList['{spec,lib}/**/*.rb'])
|
52
|
+
abort('RuboCop failed!') unless result == 0
|
53
|
+
else
|
54
|
+
puts '[!] Ruby > 1.9 is required to run style checks'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
rescue LoadError
|
59
|
+
$stderr.puts "\033[0;31m" \
|
60
|
+
'[!] Some Rake tasks haven been disabled because the environment' \
|
61
|
+
' couldn’t be loaded. Be sure to run `rake bootstrap` first.' \
|
62
|
+
"\e[0m"
|
45
63
|
end
|
data/lib/cocoapods_try.rb
CHANGED
data/lib/pod/command/try.rb
CHANGED
@@ -3,19 +3,18 @@
|
|
3
3
|
#
|
4
4
|
module Pod
|
5
5
|
class Command
|
6
|
-
|
7
6
|
# The pod try command.
|
8
7
|
#
|
9
8
|
class Try < Command
|
10
|
-
self.summary =
|
9
|
+
self.summary = 'Try a Pod!'
|
11
10
|
|
12
11
|
self.description = <<-DESC
|
13
12
|
Downloads the Pod with the given NAME (or Git URL), install its
|
14
|
-
|
13
|
+
dependencies if needed and opens its demo project. If a Git URL is
|
15
14
|
provided the head of the repo is used.
|
16
15
|
DESC
|
17
16
|
|
18
|
-
self.arguments = 'NAME_OR_URL'
|
17
|
+
self.arguments = [['NAME_OR_URL', :required]]
|
19
18
|
|
20
19
|
def initialize(argv)
|
21
20
|
@name = argv.shift_argument
|
@@ -24,7 +23,7 @@ module Pod
|
|
24
23
|
|
25
24
|
def validate!
|
26
25
|
super
|
27
|
-
help!
|
26
|
+
help! 'A Pod name or URL is required.' unless @name
|
28
27
|
end
|
29
28
|
|
30
29
|
def run
|
@@ -85,12 +84,12 @@ module Pod
|
|
85
84
|
#
|
86
85
|
def spec_with_url(url)
|
87
86
|
name = url.split('/').last
|
88
|
-
name = name.chomp(
|
87
|
+
name = name.chomp('.git') if name.end_with?('.git')
|
89
88
|
|
90
89
|
target_dir = TRY_TMP_DIR + name
|
91
90
|
target_dir.rmtree if target_dir.exist?
|
92
91
|
|
93
|
-
downloader = Pod::Downloader.for_target(target_dir,
|
92
|
+
downloader = Pod::Downloader.for_target(target_dir, :git => url)
|
94
93
|
downloader.download
|
95
94
|
|
96
95
|
spec_file = target_dir + "#{name}.podspec"
|
@@ -128,7 +127,7 @@ module Pod
|
|
128
127
|
def pick_demo_project(dir)
|
129
128
|
projs = projects_in_dir(dir)
|
130
129
|
if projs.count == 0
|
131
|
-
raise Informative,
|
130
|
+
raise Informative, 'Unable to find any project in the source files' \
|
132
131
|
" of the Pod: `#{dir}`"
|
133
132
|
elsif projs.count == 1
|
134
133
|
projs.first
|
@@ -137,7 +136,7 @@ module Pod
|
|
137
136
|
elsif (projects = projs.grep(/demo|example/i)).count == 1
|
138
137
|
projects.first
|
139
138
|
else
|
140
|
-
message =
|
139
|
+
message = 'Which project would you like to open'
|
141
140
|
selection_array = projs.map do |p|
|
142
141
|
Pathname.new(p).relative_path_from(dir).to_s
|
143
142
|
end
|
@@ -264,7 +263,6 @@ module Pod
|
|
264
263
|
end
|
265
264
|
|
266
265
|
#-------------------------------------------------------------------#
|
267
|
-
|
268
266
|
end
|
269
267
|
end
|
270
268
|
end
|
data/rubocop-todo.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-05-19 20:21:03 +0200 using RuboCop version 0.21.0.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 1
|
9
|
+
# Configuration parameters: CountComments.
|
10
|
+
ClassLength:
|
11
|
+
Max: 144
|
12
|
+
|
13
|
+
# Offense count: 11
|
14
|
+
LineLength:
|
15
|
+
Max: 108
|
16
|
+
|
17
|
+
# Offense count: 3
|
18
|
+
# Configuration parameters: CountComments.
|
19
|
+
MethodLength:
|
20
|
+
Max: 18
|
21
|
+
|
22
|
+
# Offense count: 1
|
23
|
+
UnusedBlockArgument:
|
24
|
+
Enabled: false
|
data/spec/command/try_spec.rb
CHANGED
@@ -4,32 +4,29 @@ require File.expand_path('../../spec_helper', __FILE__)
|
|
4
4
|
#
|
5
5
|
module Pod
|
6
6
|
describe Command::Try do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
describe "Try" do
|
11
|
-
it "registers it self" do
|
7
|
+
describe 'Try' do
|
8
|
+
it 'registers it self' do
|
12
9
|
Command.parse(%w(try)).should.be.instance_of Command::Try
|
13
10
|
end
|
14
11
|
|
15
|
-
it
|
12
|
+
it 'presents the help if no name is provided' do
|
16
13
|
command = Pod::Command.parse(['try'])
|
17
14
|
should.raise CLAide::Help do
|
18
15
|
command.validate!
|
19
16
|
end.message.should.match(/A Pod name or URL is required/)
|
20
17
|
end
|
21
18
|
|
22
|
-
it
|
19
|
+
it 'allows the user to try the Pod with the given name' do
|
23
20
|
Config.instance.skip_repo_update = false
|
24
21
|
command = Pod::Command.parse(%w(try ARAnalytics))
|
25
22
|
Installer::PodSourceInstaller.any_instance.expects(:install!)
|
26
23
|
command.expects(:update_specs_repos)
|
27
|
-
command.expects(:pick_demo_project).returns(
|
24
|
+
command.expects(:pick_demo_project).returns('/tmp/Proj.xcodeproj')
|
28
25
|
command.expects(:open_project).with('/tmp/Proj.xcodeproj')
|
29
26
|
command.run
|
30
27
|
end
|
31
28
|
|
32
|
-
it
|
29
|
+
it 'allows the user to try the Pod with the given Git URL' do
|
33
30
|
require 'cocoapods-downloader/git'
|
34
31
|
Pod::Downloader::GitHub.any_instance.expects(:download)
|
35
32
|
spec_file = '/tmp/CocoaPods/Try/ARAnalytics/ARAnalytics.podspec'
|
@@ -40,29 +37,24 @@ module Pod
|
|
40
37
|
command = Pod::Command.parse(['try', 'https://github.com/orta/ARAnalytics.git'])
|
41
38
|
Installer::PodSourceInstaller.any_instance.expects(:install!)
|
42
39
|
command.expects(:update_specs_repos).never
|
43
|
-
command.expects(:pick_demo_project).returns(
|
40
|
+
command.expects(:pick_demo_project).returns('/tmp/Proj.xcodeproj')
|
44
41
|
command.expects(:open_project).with('/tmp/Proj.xcodeproj')
|
45
42
|
command.run
|
46
43
|
end
|
47
|
-
|
48
44
|
end
|
49
45
|
|
50
|
-
|
51
|
-
|
52
|
-
describe "Helpers" do
|
53
|
-
|
46
|
+
describe 'Helpers' do
|
54
47
|
before do
|
55
48
|
@sut = Pod::Command.parse(['try'])
|
56
49
|
end
|
57
50
|
|
58
|
-
it
|
51
|
+
it 'returns the spec with the given name' do
|
59
52
|
spec = @sut.spec_with_name('ARAnalytics')
|
60
|
-
spec.name.should ==
|
53
|
+
spec.name.should == 'ARAnalytics'
|
61
54
|
end
|
62
55
|
|
63
|
-
describe
|
64
|
-
|
65
|
-
it "returns a spec for an https git repo" do
|
56
|
+
describe '#spec_at_url' do
|
57
|
+
it 'returns a spec for an https git repo' do
|
66
58
|
require 'cocoapods-downloader/git'
|
67
59
|
Pod::Downloader::GitHub.any_instance.expects(:download)
|
68
60
|
spec_file = '/tmp/CocoaPods/Try/ARAnalytics/ARAnalytics.podspec'
|
@@ -71,20 +63,19 @@ module Pod
|
|
71
63
|
spec = @sut.spec_with_url('https://github.com/orta/ARAnalytics.git')
|
72
64
|
spec.should == stub_spec
|
73
65
|
end
|
74
|
-
|
75
66
|
end
|
76
67
|
|
77
|
-
it
|
68
|
+
it 'installs the pod' do
|
78
69
|
Installer::PodSourceInstaller.any_instance.expects(:install!)
|
79
70
|
spec = stub(:name => 'ARAnalytics')
|
80
71
|
sandbox_root = Pathname.new('/tmp/CocoaPods/Try')
|
81
72
|
sandbox = Sandbox.new(sandbox_root)
|
82
73
|
path = @sut.install_pod(spec, sandbox)
|
83
|
-
path.should == sandbox.root +
|
74
|
+
path.should == sandbox.root + 'ARAnalytics'
|
84
75
|
end
|
85
76
|
|
86
|
-
describe
|
87
|
-
it
|
77
|
+
describe '#pick_demo_project' do
|
78
|
+
it 'raises if no demo project could be found' do
|
88
79
|
projects = []
|
89
80
|
Dir.stubs(:glob).returns(projects)
|
90
81
|
should.raise Informative do
|
@@ -92,89 +83,86 @@ module Pod
|
|
92
83
|
end.message.should.match(/Unable to find any project/)
|
93
84
|
end
|
94
85
|
|
95
|
-
it
|
86
|
+
it 'picks a demo project' do
|
96
87
|
projects = ['Demo.xcodeproj']
|
97
88
|
Dir.stubs(:glob).returns(projects)
|
98
89
|
path = @sut.pick_demo_project(stub)
|
99
|
-
path.should ==
|
90
|
+
path.should == 'Demo.xcodeproj'
|
100
91
|
end
|
101
92
|
|
102
|
-
it
|
93
|
+
it 'is not case sensitive' do
|
103
94
|
projects = ['demo.xcodeproj']
|
104
95
|
Dir.stubs(:glob).returns(projects)
|
105
96
|
path = @sut.pick_demo_project(stub)
|
106
|
-
path.should ==
|
97
|
+
path.should == 'demo.xcodeproj'
|
107
98
|
end
|
108
99
|
|
109
|
-
it
|
100
|
+
it 'considers also projects named example' do
|
110
101
|
projects = ['Example.xcodeproj']
|
111
102
|
Dir.stubs(:glob).returns(projects)
|
112
103
|
path = @sut.pick_demo_project(stub)
|
113
|
-
path.should ==
|
104
|
+
path.should == 'Example.xcodeproj'
|
114
105
|
end
|
115
106
|
|
116
|
-
it
|
107
|
+
it 'returns the project if only one is found' do
|
117
108
|
projects = ['Lib.xcodeproj']
|
118
109
|
Dir.stubs(:glob).returns(projects)
|
119
110
|
path = @sut.pick_demo_project(stub)
|
120
|
-
path.should ==
|
111
|
+
path.should == 'Lib.xcodeproj'
|
121
112
|
end
|
122
113
|
|
123
|
-
it
|
114
|
+
it 'asks the user which project would like to open if not a single suitable one is found' do
|
124
115
|
projects = ['Lib_1.xcodeproj', 'Lib_2.xcodeproj']
|
125
116
|
Dir.stubs(:glob).returns(projects)
|
126
117
|
@sut.stubs(:choose_from_array).returns(0)
|
127
118
|
path = @sut.pick_demo_project(stub(:cleanpath => ''))
|
128
|
-
path.should ==
|
119
|
+
path.should == 'Lib_1.xcodeproj'
|
129
120
|
end
|
130
121
|
|
131
|
-
it
|
122
|
+
it 'should prefer demo or example workspaces' do
|
132
123
|
Dir.stubs(:glob).returns(['Project Demo.xcodeproj', 'Project Demo.xcworkspace'])
|
133
124
|
path = @sut.pick_demo_project(stub(:cleanpath => ''))
|
134
125
|
path.should == 'Project Demo.xcworkspace'
|
135
126
|
end
|
136
127
|
|
137
|
-
it
|
128
|
+
it 'should not show workspaces inside a project' do
|
138
129
|
Dir.stubs(:glob).returns(['Project Demo.xcodeproj', 'Project Demo.xcodeproj/project.xcworkspace'])
|
139
130
|
path = @sut.pick_demo_project(stub(:cleanpath => ''))
|
140
131
|
path.should == 'Project Demo.xcodeproj'
|
141
132
|
end
|
142
133
|
|
143
|
-
it
|
134
|
+
it 'should prefer workspaces over projects with the same name' do
|
144
135
|
Dir.stubs(:glob).returns(['Project Demo.xcodeproj', 'Project Demo.xcworkspace'])
|
145
136
|
path = @sut.pick_demo_project(stub(:cleanpath => ''))
|
146
137
|
path.should == 'Project Demo.xcworkspace'
|
147
138
|
end
|
148
139
|
end
|
149
140
|
|
150
|
-
describe
|
151
|
-
it
|
141
|
+
describe '#install_podfile' do
|
142
|
+
it 'returns the original project if no Podfile could be found' do
|
152
143
|
Pathname.any_instance.stubs(:exist?).returns(false)
|
153
|
-
proj =
|
144
|
+
proj = '/tmp/Project.xcodeproj'
|
154
145
|
path = @sut.install_podfile(proj)
|
155
146
|
path.should == proj
|
156
147
|
end
|
157
148
|
|
158
|
-
it
|
149
|
+
it 'performs an installation and returns the path of the workspace' do
|
159
150
|
Pathname.any_instance.stubs(:exist?).returns(true)
|
160
|
-
proj =
|
151
|
+
proj = '/tmp/Project.xcodeproj'
|
161
152
|
@sut.expects(:perform_cocoapods_installation)
|
162
|
-
Podfile.stubs(:from_file).returns(stub(:workspace_path =>
|
153
|
+
Podfile.stubs(:from_file).returns(stub(:workspace_path => '/tmp/Project.xcworkspace'))
|
163
154
|
path = @sut.install_podfile(proj)
|
164
|
-
path.should ==
|
155
|
+
path.should == '/tmp/Project.xcworkspace'
|
165
156
|
end
|
166
157
|
|
167
|
-
it
|
158
|
+
it 'returns the default workspace if one is not set' do
|
168
159
|
Pathname.any_instance.stubs(:exist?).returns(true)
|
169
|
-
proj =
|
160
|
+
proj = '/tmp/Project.xcodeproj'
|
170
161
|
Podfile.stubs(:from_file).returns(stub(:workspace_path => nil))
|
171
162
|
path = @sut.install_podfile(proj)
|
172
|
-
path.should ==
|
163
|
+
path.should == '/tmp/Project.xcworkspace'
|
173
164
|
end
|
174
165
|
end
|
175
166
|
end
|
176
|
-
|
177
|
-
#-------------------------------------------------------------------------#
|
178
|
-
|
179
167
|
end
|
180
168
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,22 +1,18 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
3
|
-
$LOAD_PATH.unshift((ROOT + 'lib').to_s)
|
4
|
-
$LOAD_PATH.unshift((ROOT + 'spec').to_s)
|
5
|
-
|
6
1
|
require 'bundler/setup'
|
2
|
+
require 'pathname'
|
7
3
|
require 'bacon'
|
8
4
|
require 'mocha-on-bacon'
|
9
5
|
require 'pretty_bacon'
|
10
6
|
require 'cocoapods'
|
11
7
|
|
8
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
9
|
+
$LOAD_PATH.unshift((ROOT + 'lib').to_s)
|
10
|
+
$LOAD_PATH.unshift((ROOT + 'spec').to_s)
|
12
11
|
require 'cocoapods_plugin'
|
13
12
|
|
14
13
|
#-----------------------------------------------------------------------------#
|
15
14
|
|
16
|
-
# The CocoaPods namespace
|
17
|
-
#
|
18
15
|
module Pod
|
19
|
-
|
20
16
|
# Disable the wrapping so the output is deterministic in the tests.
|
21
17
|
#
|
22
18
|
UI.disable_wrap = true
|
@@ -35,7 +31,7 @@ module Pod
|
|
35
31
|
@output << "#{message}\n"
|
36
32
|
end
|
37
33
|
|
38
|
-
def warn(message = '',
|
34
|
+
def warn(message = '', _actions = [])
|
39
35
|
@warnings << "#{message}\n"
|
40
36
|
end
|
41
37
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-try
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabio Pelosin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -45,6 +45,7 @@ extensions: []
|
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
47
|
- ".gitignore"
|
48
|
+
- ".rubocop-cocoapods.yml"
|
48
49
|
- ".rubocop.yml"
|
49
50
|
- ".travis.yml"
|
50
51
|
- CHANGELOG.md
|
@@ -56,6 +57,7 @@ files:
|
|
56
57
|
- lib/cocoapods_plugin.rb
|
57
58
|
- lib/cocoapods_try.rb
|
58
59
|
- lib/pod/command/try.rb
|
60
|
+
- rubocop-todo.yml
|
59
61
|
- spec/command/try_spec.rb
|
60
62
|
- spec/spec_helper.rb
|
61
63
|
homepage: https://github.com/cocoapods/cocoapods-try
|