wwdc 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +20 -8
- data/README.md +10 -1
- data/lib/wwdc/commands/info.rb +7 -6
- data/lib/wwdc/commands/open.rb +4 -3
- data/lib/wwdc/commands/search.rb +7 -7
- data/lib/wwdc/helpers.rb +30 -4
- data/lib/wwdc/version.rb +1 -1
- data/wwdc.gemspec +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dab8a45020b09a2a93acb97277986b6b75e80d87
|
4
|
+
data.tar.gz: e1633fb111cc84e14c951154e9ef26e0aeecbcf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1877692cd9aa8b4f2896a81806b9e1909c07d72d2d70e697994b0d73068ad546467bbdeddcaaf74dc31799308e8cc908465438f859b90509fd071c9596209fdc
|
7
|
+
data.tar.gz: 0460a78b999f50d1780c4fc8e7ef4bb84af8a504997909370da65b419404940e0b4090bda74617319fd083c6aaa73e6bf324c9c52eaa43c2941e7a59466435d2
|
data/Gemfile.lock
CHANGED
@@ -1,19 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wwdc (0.0
|
5
|
-
commander (~> 4.1
|
6
|
-
excon (~> 0.25
|
4
|
+
wwdc (1.0.0)
|
5
|
+
commander (~> 4.1)
|
6
|
+
excon (~> 0.25)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
commander (4.
|
11
|
+
commander (4.2.0)
|
12
12
|
highline (~> 1.6.11)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
diff-lcs (1.2.5)
|
14
|
+
excon (0.38.0)
|
15
|
+
highline (1.6.21)
|
16
|
+
rake (10.3.2)
|
17
|
+
rspec (3.0.0)
|
18
|
+
rspec-core (~> 3.0.0)
|
19
|
+
rspec-expectations (~> 3.0.0)
|
20
|
+
rspec-mocks (~> 3.0.0)
|
21
|
+
rspec-core (3.0.3)
|
22
|
+
rspec-support (~> 3.0.0)
|
23
|
+
rspec-expectations (3.0.3)
|
24
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
+
rspec-support (~> 3.0.0)
|
26
|
+
rspec-mocks (3.0.3)
|
27
|
+
rspec-support (~> 3.0.0)
|
28
|
+
rspec-support (3.0.3)
|
17
29
|
|
18
30
|
PLATFORMS
|
19
31
|
ruby
|
data/README.md
CHANGED
@@ -16,12 +16,21 @@ $ gem install wwdc
|
|
16
16
|
```bash
|
17
17
|
$ wwdc info 228
|
18
18
|
|
19
|
+
228: "A Look Inside Presentation Controllers"
|
20
|
+
iOS 8 brings you powerful new means of presenting content within your apps. Hear how presentation controllers were leveraged by UIKit to give you fine grain control using new alert and searching APIs. Dive deep into how presentation controllers work and how you can use them to present content within your app in exciting new ways.
|
21
|
+
|
22
|
+
$ wwdc info 228 2013
|
23
|
+
|
19
24
|
228: "Hidden Gems in Cocoa and Cocoa Touch"
|
20
25
|
Learn from the experts about the Cocoa and Cocoa Touch classes you may not even know exist, as well as some very obscure but extremely valuable classes that are favorites of the presenters.
|
21
26
|
|
22
27
|
$ wwdc open 228
|
23
28
|
|
24
|
-
# Opens browser to Apple Developer page with links to slides and video
|
29
|
+
# Opens browser to Apple Developer page with links to slides and video for this year
|
30
|
+
|
31
|
+
$ wwdc open 228 2013
|
32
|
+
|
33
|
+
# Opens browser to Apple Developer page with links to slides and video for 2013
|
25
34
|
|
26
35
|
$ wwdc search UIView
|
27
36
|
|
data/lib/wwdc/commands/info.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
command :info do |c|
|
2
|
-
c.syntax = 'wwdc info
|
3
|
-
c.summary = 'Get information about a session by its number'
|
4
|
-
c.
|
2
|
+
c.syntax = 'wwdc info SESSION'
|
3
|
+
c.summary = 'Get information about a session by its number and year'
|
4
|
+
c.option '-y', '--year YEAR', 'WWDC Year'
|
5
5
|
|
6
6
|
c.action do |args, options|
|
7
|
-
|
7
|
+
determine_session!(args, options)
|
8
|
+
determine_year!(args, options)
|
8
9
|
|
9
|
-
session = get(path: "/
|
10
|
+
@session = get(path: "/#{@year}/sessions/#{@number}")
|
10
11
|
|
11
|
-
describe session
|
12
|
+
describe @session
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
data/lib/wwdc/commands/open.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
command :open do |c|
|
2
2
|
c.syntax = 'wwdc open [SESSION]'
|
3
3
|
c.summary = 'Open your browser to the Apple Developer Center to view session slides and video'
|
4
|
-
c.
|
4
|
+
c.option '-y', '--year YEAR', 'WWDC Year'
|
5
5
|
|
6
6
|
c.action do |args, options|
|
7
|
-
|
7
|
+
determine_session!(args, options)
|
8
|
+
determine_year!(args, options)
|
8
9
|
|
9
|
-
session = get(path: "/
|
10
|
+
@session = get(path: "/#{@year}/sessions/#{@number}") do |response|
|
10
11
|
url = response.headers['Link'].scan(/\<(.+)\>/).flatten.first
|
11
12
|
`open "#{url}"`
|
12
13
|
end
|
data/lib/wwdc/commands/search.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
command :search do |c|
|
2
2
|
c.syntax = 'wwdc search [QUERY]'
|
3
3
|
c.summary = 'Find sessions containing the specified search terms'
|
4
|
-
c.
|
4
|
+
c.option '-y', '--year YEAR', 'WWDC Year'
|
5
5
|
|
6
6
|
c.action do |args, options|
|
7
|
-
|
8
|
-
|
7
|
+
determine_query!(args, options)
|
8
|
+
determine_year!(args, options) if options.year
|
9
9
|
|
10
|
-
|
10
|
+
@results = get(path: "search", query: {q: @query, year: @year})['results']
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
say_warning "No results" and abort if @results.empty?
|
13
|
+
|
14
|
+
describe *@results
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
data/lib/wwdc/helpers.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
require 'excon'
|
2
2
|
require 'json'
|
3
|
+
require 'rubygems/text'
|
3
4
|
|
4
5
|
module WWDC
|
6
|
+
YEARS = (2010..2014)
|
7
|
+
|
5
8
|
module Helpers
|
9
|
+
include Gem::Text
|
10
|
+
|
6
11
|
def get(options = {}, &block)
|
7
12
|
response = client.get(options)
|
8
13
|
say_error "Error #{response.status}" and abort unless response.status == 200
|
@@ -12,14 +17,35 @@ module WWDC
|
|
12
17
|
JSON.parse(response.body)
|
13
18
|
end
|
14
19
|
|
15
|
-
def describe(
|
16
|
-
|
17
|
-
|
18
|
-
|
20
|
+
def describe(*sessions)
|
21
|
+
enable_paging if sessions.length > 5
|
22
|
+
|
23
|
+
sessions.each do |session|
|
24
|
+
puts %{\033[1mWWDC #{session['year']}\033[0m}
|
25
|
+
puts %{\033[1mSession #{session['number']}: "#{session['title']}"\033[0m}
|
26
|
+
puts
|
27
|
+
puts format_text(session['description'], 80)
|
28
|
+
puts
|
29
|
+
end
|
19
30
|
end
|
20
31
|
|
21
32
|
private
|
22
33
|
|
34
|
+
def determine_session!(args = [], options = {})
|
35
|
+
@number = (Integer(args.first).nonzero? rescue nil)
|
36
|
+
say_error "Missing session number" and abort unless @number
|
37
|
+
end
|
38
|
+
|
39
|
+
def determine_year!(args = [], options = {})
|
40
|
+
@year = (Integer(options.year).nonzero? rescue nil) || YEARS.last
|
41
|
+
say_error "Invalid year: #{@year}" and abort unless YEARS.include?(@year)
|
42
|
+
end
|
43
|
+
|
44
|
+
def determine_query!(args = [], options = {})
|
45
|
+
@query = args.join(" ")
|
46
|
+
say_error "Missing query" and abort if @query.empty?
|
47
|
+
end
|
48
|
+
|
23
49
|
def client
|
24
50
|
@client ||= Excon.new('http://asciiwwdc.com', headers: {'Accept' => "application/json"})
|
25
51
|
end
|
data/lib/wwdc/version.rb
CHANGED
data/wwdc.gemspec
CHANGED
@@ -14,8 +14,8 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.summary = "WWDC"
|
15
15
|
s.description = "A command-line interface for accessing WWDC session content"
|
16
16
|
|
17
|
-
s.add_dependency "commander", "~> 4.1
|
18
|
-
s.add_dependency "excon", "~> 0.25
|
17
|
+
s.add_dependency "commander", "~> 4.1"
|
18
|
+
s.add_dependency "excon", "~> 0.25"
|
19
19
|
|
20
20
|
s.add_development_dependency "rspec"
|
21
21
|
s.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wwdc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattt Thompson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.1
|
19
|
+
version: '4.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.1
|
26
|
+
version: '4.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: excon
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.25
|
33
|
+
version: '0.25'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.25
|
40
|
+
version: '0.25'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.1.11
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: WWDC
|