Skip to content

Commit

Permalink
Merge pull request #274 from CocoaPods/seg-tweet-pod-page
Browse files Browse the repository at this point in the history
Pod pages fer dayz
  • Loading branch information
orta committed May 30, 2015
2 parents 06490ad + bb9a9b1 commit 4ddbc4f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 11 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
@@ -1,5 +1,7 @@
language: ruby
install: rake bootstrap
branches:
only:
- master
rvm:
- 1.8.7
- 1.9.3
- 2.1.3
3 changes: 3 additions & 0 deletions Gemfile.lock
Expand Up @@ -290,3 +290,6 @@ DEPENDENCIES
terminal-table
thin
twitter

BUNDLED WITH
1.10.1
3 changes: 2 additions & 1 deletion lib/cocoapods_notifier/rss.rb
Expand Up @@ -63,7 +63,7 @@ def pods_for_feed
#
def configure_rss_item(item, pod)
item.title = pod.name
item.link = pod.homepage
item.link = "https://cocoapods.org/pods/#{pod.name}"
item.pubDate = @creation_dates[pod.name]
item.description = rss_item_description(pod)
end
Expand All @@ -84,6 +84,7 @@ def rss_item_description(pod)
s << "\n<ul>"
s << "\n <li>Latest version: #{pod.version}</li>"
s << "\n <li>Platform: #{pod.platform}</li>"
s << "\n <li>Homepage: #{pod.homepage}</li>"
s << "\n <li>License: #{pod.license}</li>" if pod.license
s << "\n <li>Stargazers: #{github_watchers}</li>" if github_watchers
s << "\n</ul>"
Expand Down
7 changes: 6 additions & 1 deletion lib/cocoapods_notifier/twitter_notifier.rb
Expand Up @@ -28,7 +28,7 @@ def tweet(pod)
#
def status_for_pod(pod)
social_media_url = pod.social_media_url
make_status(pod.name, pod.summary, pod.homepage, social_media_url)
make_status(pod.name, pod.summary, pod_page_for_pod(pod), social_media_url)
end

# Returns the body for the tweet of the given Pod taking into account
Expand Down Expand Up @@ -96,6 +96,11 @@ def message_max_length
MESSAGE_MAX_LENGTH - LINK_MAX_LENGTH - LINK_SEPARATOR_STRING.length
end

# @return [String] The pod page URL for the given pod
def pod_page_for_pod(pod)
"https://cocoapods.org/pods/#{pod.name}"
end

private

# @return [Twitter::REST::Client]
Expand Down
8 changes: 4 additions & 4 deletions spec/spec_helper.rb
@@ -1,8 +1,8 @@
require 'pathname'
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
$LOAD_PATH.unshift((ROOT + 'lib').to_s)
$LOAD_PATH.unshift((ROOT + 'spec').to_s)
$LOAD_PATH.unshift((ROOT).to_s)
SPEC_ROOT = Pathname.new(File.expand_path('../../', __FILE__))
$LOAD_PATH.unshift((SPEC_ROOT + 'lib').to_s)
$LOAD_PATH.unshift((SPEC_ROOT + 'spec').to_s)
$LOAD_PATH.unshift((SPEC_ROOT).to_s)

ENV['RACK_ENV'] = 'test'
HOOK_PATH = ENV['HOOK_PATH'] = 'secret'
Expand Down
11 changes: 8 additions & 3 deletions spec/unit/twitter_spec.rb
Expand Up @@ -5,7 +5,12 @@
describe FeedsApp::TwitterNotifier do

before do
# @pod =
@pod = Pod::Specification.new do |s|
s.name = 'AFNetworking'
s.social_media_url = 'https://twitter.com/AFNetworking'
s.homepage = 'http://afnetworking.com'
s.summary = 'A delightful iOS and OS X networking framework.'
end
@twitter_client = stub
@sut = FeedsApp::TwitterNotifier.new(@twitter_client)
end
Expand All @@ -14,8 +19,8 @@

describe 'In general' do

xit 'posts a tweet for the given Pod' do
@twitter_client.expects(:update).with('[AFNetworking by @AFNetworking] A delightful iOS and OS X networking framework. https://github.com/AFNetworking/AFNetworking')
it 'posts a tweet for the given Pod' do
@twitter_client.expects(:update).with('[AFNetworking by @AFNetworking] A delightful iOS and OS X networking framework. https://cocoapods.org/pods/AFNetworking')
@sut.tweet(@pod)
end

Expand Down

0 comments on commit 4ddbc4f

Please sign in to comment.