cocoapods-browser 0.0.3 → 0.0.4

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: 06dad5bcafffbbadae493ace59e7bee4c5aabe54
4
- data.tar.gz: ea671c8ae65e18eb7c252cfd11ec0e9f6b96649b
3
+ metadata.gz: 9745b0e108aa38280fd465c71ccf39af8bfcbccd
4
+ data.tar.gz: ff82d2040bf511284bbd194b22acb9ea1ed71b1f
5
5
  SHA512:
6
- metadata.gz: 36e0025638a3918eea8322b55faba7b3b88ddbc9bfaf865eec319360c250be5b3a1e76d36a8867b39c7df3b6650b9e23c2fa968f78b04d9f0150786745365020
7
- data.tar.gz: 99046fd26b523b663889ffcad0830e5690dbc8541a87cb882ed9ad96c0fed02427905b9b4597a72533efa770b707a07dc8f3af6ed9478b71f271d22f409cc9c1
6
+ metadata.gz: 70811835dbf4a7d347e96fb96da5e29b97754f3ec712f93c9db6ac64e78153fa4c7aa44bac996b989810ad19fd28f4cea88f84993dc06da98a1110adb37f11b5
7
+ data.tar.gz: 72ffd1877ce2ccb773a1171813c44bee44b281215c6c8c1d743e7f888ad61d7f23909cd1c3577c3ae705cb7fc9ed4782e36dd68ca904f87204a751744d4c00ba
data/.travis.yml ADDED
@@ -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=dealforest GIT_AUTHOR_EMAIL=dealforest.net@gmail.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=dealforest GIT_AUTHOR_EMAIL=dealforest@gmail.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 spec:ci
data/Gemfile CHANGED
@@ -1,4 +1,12 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in cocoapods-browser.gemspec
4
3
  gemspec
4
+
5
+ group :development do
6
+ gem 'cocoapods'
7
+ gem 'bacon'
8
+ gem 'mocha-on-bacon'
9
+ gem 'mocha', '~> 0.11.4'
10
+ gem 'rake'
11
+ gem 'prettybacon', :git => 'https://github.com/irrationalfab/PrettyBacon.git', :branch => 'master'
12
+ end
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Cocoapods::Browser
2
2
 
3
- CocoaPods plugin to open a pod's homepage on the browser.
3
+ CocoaPods plugin to open a pods homepage in the browser.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
7
+ Add this line to your applications Gemfile:
8
8
 
9
9
  gem 'cocoapods-browser'
10
10
 
@@ -12,13 +12,13 @@ And then execute:
12
12
 
13
13
  $ bundle
14
14
 
15
- Or install it yourself as:
15
+ Or install it yourself:
16
16
 
17
17
  $ gem install cocoapods-browser
18
18
 
19
19
  ## Usage
20
20
 
21
- Open the pod in browser
21
+ Open the pod website in a browser like this:
22
22
 
23
23
  pod browser iOS-FakeWeb
24
24
 
data/Rakefile CHANGED
@@ -1 +1,22 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ def specs(dir)
4
+ FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
5
+ end
6
+
7
+ task :bootstrap, :use_bundle_dir? do |t, args|
8
+ if args[:use_bundle_dir?]
9
+ sh "bundle install --path ./travis_bundle_dir"
10
+ else
11
+ sh "bundle install"
12
+ end
13
+ end
14
+
15
+ namespace :spec do
16
+ desc "Runs all the specs"
17
+ task :ci do
18
+ sh "bundle exec bacon #{specs('**')}"
19
+ end
20
+ end
21
+
22
+ task :default => "spec:ci"
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Cocoapods::Browser::VERSION
9
9
  spec.authors = ["Toshihiro Morimoto"]
10
10
  spec.email = ["dealforest.net@gmail.com"]
11
- spec.description = %q{CocoaPods plugin to open a pod's homepage on the browser.}
12
- spec.summary = %q{Open a pod's homepage on brwoser}
11
+ spec.description = %q{CocoaPods plugin to open the homepage of a pod in the browser.}
12
+ spec.summary = %q{Open a pods homepage in the browser}
13
13
  spec.homepage = "https://github.com/dealforest/cocoapods-browser"
14
14
  spec.license = "MIT"
15
15
 
@@ -1,5 +1,5 @@
1
1
  module Cocoapods
2
2
  module Browser
3
- VERSION = "0.0.3"
3
+ VERSION = '0.0.4'
4
4
  end
5
5
  end
@@ -4,61 +4,69 @@ module Pod
4
4
  self.summary = 'Open the homepage'
5
5
 
6
6
  self.description = <<-DESC
7
- Opens the homepage on browser.
7
+ Opens the homepage of a pod in the browser.
8
8
  DESC
9
9
 
10
- self.arguments = '[QUERY]'
10
+ self.arguments = '[NAME]'
11
11
 
12
12
  def self.options
13
13
  [
14
- '--spec', 'Open the podspec on the browser. github.com/tree/master/[PODNAME].podspec',
14
+ [ '--spec', 'Open the podspec in the browser. github.com/tree/master/[NAME].podspec' ],
15
15
  ].concat(super)
16
16
  end
17
17
 
18
18
  def initialize(argv)
19
19
  @spec = argv.flag?('spec')
20
- @query = argv.arguments! unless argv.arguments.empty?
20
+ @names = argv.arguments! unless argv.arguments.empty?
21
21
  super
22
22
  end
23
23
 
24
24
  def validate!
25
25
  super
26
- help! "A search query is required." unless @query
26
+ help! 'A Pod name is required' unless @names
27
27
  end
28
28
 
29
29
  extend Executable
30
30
  executable :open
31
31
 
32
32
  def run
33
- @query.each do |query|
34
- opened = false
35
- sets = SourcesManager.search_by_name(query.strip, false)
36
- statistics_provider = Config.instance.spec_statistics_provider
37
- sets.each do |set|
38
- begin
39
- pod = Specification::Set::Presenter.new(set, statistics_provider)
40
- next if query != pod.name
41
-
42
- if url = pod.homepage
43
- if @spec && url =~ %r|^https?://github.com/|
44
- url << "/tree/master/#{pod.name}.podspec"
45
- else
46
- UI.warn "Skipping `#{pod.name}` because the homgepage is only `github.com`."
47
- next
48
- end
49
- UI.puts("Opening #{url}")
50
- open!(url)
51
- opened = true
52
- else
53
- UI.warn "Skipping `#{pod.name}` because the homepage not found."
54
- end
55
- rescue DSLError
56
- UI.warn "Skipping `#{pod.name}` because the podspec contains errors."
33
+ # update_specs_repos
34
+ @names.each do |name|
35
+ if spec = spec_with_name(name)
36
+ UI.title "Opening #{spec.name}" do
37
+ url = pick_open_url(spec)
38
+ UI.puts(">>> #{url}")
39
+ open!(url)
57
40
  end
58
41
  end
59
- UI.warn "The query(`#{query}`) not found pod." unless opened
60
42
  end
61
43
  end
44
+
45
+ def update_specs_repos
46
+ unless config.skip_repo_update?
47
+ UI.section 'Updating spec repositories' do
48
+ SourcesManager.update
49
+ end
50
+ end
51
+ end
52
+
53
+ def spec_with_name(name)
54
+ if set = SourcesManager.search(Dependency.new(name))
55
+ set.specification.root
56
+ else
57
+ raise Informative, "Unable to find a podspec named `#{name}`"
58
+ end
59
+ end
60
+
61
+ def pick_open_url(spec)
62
+ url = spec.homepage
63
+ if @spec && url =~ %r|^https?://github.com/|
64
+ "%s/tree/master/%s.podspec" % [ url, spec.name ]
65
+ else
66
+ url
67
+ end
68
+ end
69
+
62
70
  end
63
71
  end
64
72
  end
@@ -0,0 +1,31 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+
5
+ describe Command::Browser do
6
+
7
+ describe "CLAide" do
8
+ it "registers it self" do
9
+ Command.parse(%w{ browser }).should.be.instance_of Command::Browser
10
+ end
11
+
12
+ it "presents the help if no name is provided" do
13
+ command = Pod::Command.parse(['browser'])
14
+ should.raise CLAide::Help do
15
+ command.validate!
16
+ end.message.should.match /A Pod name is required/
17
+ end
18
+
19
+ it "runs" do
20
+ Config.instance.skip_repo_update = false
21
+ command = Pod::Command.parse(['browser', 'iOS-FakeWeb'])
22
+ # command.expects(:update_specs_repos)
23
+ command.expects(:spec_with_name)
24
+ command.run
25
+ end
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+
@@ -0,0 +1,44 @@
1
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
2
+ $:.unshift((ROOT + 'lib').to_s)
3
+ $:.unshift((ROOT + 'spec').to_s)
4
+
5
+ require 'bundler/setup'
6
+ require 'bacon'
7
+ require 'mocha-on-bacon'
8
+ require 'pretty_bacon'
9
+ require 'cocoapods'
10
+
11
+ require 'cocoapods_plugin'
12
+
13
+ #-----------------------------------------------------------------------------#
14
+
15
+ module Pod
16
+
17
+ # Disable the wrapping so the output is deterministic in the tests.
18
+ #
19
+ UI.disable_wrap = true
20
+
21
+ # Redirects the messages to an internal store.
22
+ #
23
+ module UI
24
+ @output = ''
25
+ @warnings = ''
26
+
27
+ class << self
28
+ attr_accessor :output
29
+ attr_accessor :warnings
30
+
31
+ def puts(message = '')
32
+ @output << "#{message}\n"
33
+ end
34
+
35
+ def warn(message = '', actions = [])
36
+ @warnings << "#{message}\n" end
37
+ def print(message)
38
+ @output << message
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ #-----------------------------------------------------------------------------#
metadata CHANGED
@@ -1,65 +1,66 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-browser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toshihiro Morimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-28 00:00:00.000000000 Z
11
+ date: 2014-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: cocoapods
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: CocoaPods plugin to open a pod's homepage on the browser.
55
+ description: CocoaPods plugin to open the homepage of a pod in the browser.
56
56
  email:
57
57
  - dealforest.net@gmail.com
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
62
+ - ".gitignore"
63
+ - ".travis.yml"
63
64
  - Gemfile
64
65
  - LICENSE.txt
65
66
  - README.md
@@ -69,6 +70,8 @@ files:
69
70
  - lib/cocoapods/browser/version.rb
70
71
  - lib/cocoapods_plugin.rb
71
72
  - lib/pod/command/browser.rb
73
+ - spec/command/browser_spec.rb
74
+ - spec/spec_helper.rb
72
75
  homepage: https://github.com/dealforest/cocoapods-browser
73
76
  licenses:
74
77
  - MIT
@@ -79,19 +82,20 @@ require_paths:
79
82
  - lib
80
83
  required_ruby_version: !ruby/object:Gem::Requirement
81
84
  requirements:
82
- - - '>='
85
+ - - ">="
83
86
  - !ruby/object:Gem::Version
84
87
  version: '0'
85
88
  required_rubygems_version: !ruby/object:Gem::Requirement
86
89
  requirements:
87
- - - '>='
90
+ - - ">="
88
91
  - !ruby/object:Gem::Version
89
92
  version: '0'
90
93
  requirements: []
91
94
  rubyforge_project:
92
- rubygems_version: 2.0.3
95
+ rubygems_version: 2.2.0
93
96
  signing_key:
94
97
  specification_version: 4
95
- summary: Open a pod's homepage on brwoser
96
- test_files: []
97
- has_rdoc:
98
+ summary: Open a pods homepage in the browser
99
+ test_files:
100
+ - spec/command/browser_spec.rb
101
+ - spec/spec_helper.rb