consadole_aggregator 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.rspec +2 -1
- data/.rvmrc +1 -0
- data/.travis.yml +1 -0
- data/Gemfile +3 -9
- data/Gemfile.lock +52 -27
- data/Guardfile +19 -0
- data/Rakefile +3 -49
- data/bin/consadole_aggregator +29 -49
- data/consadole_aggregator.gemspec +22 -210
- data/lib/consadole_aggregator/helper.rb +8 -4
- data/lib/consadole_aggregator/live.rb +74 -67
- data/lib/consadole_aggregator/news.rb +165 -100
- data/lib/consadole_aggregator/version.rb +3 -0
- data/lib/consadole_aggregator.rb +26 -4
- data/spec/consadole_aggregator/helper_spec.rb +13 -8
- data/spec/consadole_aggregator/live_spec.rb +68 -124
- data/spec/consadole_aggregator/news_spec.rb +70 -148
- data/spec/consadole_aggregator_spec.rb +5 -0
- data/spec/ext/clubconsadole.txt +262 -315
- data/spec/ext/jsgoalphotos.txt +321 -321
- data/spec/spec_helper.rb +13 -9
- metadata +233 -58
- data/.document +0 -5
- data/LICENSE.txt +0 -20
- data/README.rdoc +0 -33
- data/VERSION +0 -1
- data/account.yaml +0 -6
- data/db/.gitignore +0 -0
- data/lib/consadole_aggregator/aggregatable.rb +0 -62
- data/lib/consadole_aggregator/live/timeline.rb +0 -13
- data/log/.gitignore +0 -0
- data/spec/consadole_aggregator/aggregatable_spec.rb +0 -87
- data/spec/consadole_aggregator/live/timeline_spec.rb +0 -53
- data/spec/spec.opts +0 -1
data/.gitignore
ADDED
data/.rspec
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
--color
|
1
|
+
--color
|
2
|
+
--format progress
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm 1.9.3
|
data/.travis.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm: 1.9.3
|
data/Gemfile
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem
|
4
|
-
|
5
|
-
gem "rubytter"
|
3
|
+
# Specify your gem's dependencies in consadole_aggregator.gemspec
|
4
|
+
gemspec
|
6
5
|
|
7
|
-
|
8
|
-
gem "bundler"
|
9
|
-
gem "rcov"
|
10
|
-
gem "rspec"
|
11
|
-
gem "jeweler"
|
12
|
-
end
|
6
|
+
gem "rake"
|
data/Gemfile.lock
CHANGED
@@ -1,37 +1,62 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
consadole_aggregator (0.0.1)
|
5
|
+
|
1
6
|
GEM
|
2
7
|
remote: http://rubygems.org/
|
3
8
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
9
|
+
activesupport (3.2.3)
|
10
|
+
i18n (~> 0.6)
|
11
|
+
multi_json (~> 1.0)
|
12
|
+
addressable (2.2.7)
|
13
|
+
diff-lcs (1.1.3)
|
14
|
+
eventmachine (0.12.10)
|
15
|
+
faraday (0.7.6)
|
16
|
+
addressable (~> 2.2)
|
17
|
+
multipart-post (~> 1.1)
|
18
|
+
rack (~> 1.1)
|
19
|
+
ffi (1.0.11)
|
20
|
+
guard (1.0.1)
|
21
|
+
ffi (>= 0.5.0)
|
22
|
+
thor (~> 0.14.6)
|
23
|
+
guard-rspec (0.7.0)
|
24
|
+
guard (>= 0.10.0)
|
25
|
+
httpclient (2.2.4)
|
26
|
+
i18n (0.6.0)
|
27
|
+
multi_json (1.2.0)
|
28
|
+
multipart-post (1.1.5)
|
29
|
+
nokogiri (1.5.2)
|
30
|
+
rack (1.4.1)
|
31
|
+
rake (0.9.2.2)
|
32
|
+
rspec (2.9.0)
|
33
|
+
rspec-core (~> 2.9.0)
|
34
|
+
rspec-expectations (~> 2.9.0)
|
35
|
+
rspec-mocks (~> 2.9.0)
|
36
|
+
rspec-core (2.9.0)
|
37
|
+
rspec-expectations (2.9.1)
|
38
|
+
diff-lcs (~> 1.1.3)
|
39
|
+
rspec-mocks (2.9.0)
|
40
|
+
ruby_gntp (0.3.4)
|
41
|
+
simple_oauth (0.1.5)
|
42
|
+
thor (0.14.6)
|
43
|
+
twitter (2.2.0)
|
44
|
+
activesupport (>= 2.3.9, < 4)
|
45
|
+
faraday (~> 0.7)
|
46
|
+
multi_json (~> 1.0)
|
47
|
+
simple_oauth (~> 0.1)
|
26
48
|
|
27
49
|
PLATFORMS
|
28
50
|
ruby
|
29
51
|
|
30
52
|
DEPENDENCIES
|
31
|
-
|
32
|
-
|
53
|
+
consadole_aggregator!
|
54
|
+
eventmachine
|
55
|
+
guard
|
56
|
+
guard-rspec
|
57
|
+
httpclient
|
33
58
|
nokogiri
|
34
|
-
|
35
|
-
rcov
|
59
|
+
rake
|
36
60
|
rspec
|
37
|
-
|
61
|
+
ruby_gntp
|
62
|
+
twitter
|
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2 do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
# Capybara request specs
|
17
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
18
|
+
end
|
19
|
+
|
data/Rakefile
CHANGED
@@ -1,51 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'rake'
|
11
|
-
|
12
|
-
require 'jeweler'
|
13
|
-
Jeweler::Tasks.new do |gem|
|
14
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
-
gem.name = "consadole_aggregator"
|
16
|
-
gem.homepage = "http://github.com/niku/consadole_aggregator"
|
17
|
-
gem.license = "MIT"
|
18
|
-
gem.summary = %Q{ It aggregates infomation of 'Consadole Sapporo' }
|
19
|
-
gem.description = %Q{ It aggregates infomation of 'Consadole Sapporo' }
|
20
|
-
gem.email = "niku@niku.name"
|
21
|
-
gem.authors = ["niku"]
|
22
|
-
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
-
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
-
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
25
|
-
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
-
end
|
27
|
-
Jeweler::RubygemsDotOrgTasks.new
|
28
|
-
|
29
|
-
require 'rspec/core'
|
30
|
-
require 'rspec/core/rake_task'
|
31
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
33
|
-
spec.rspec_opts = '--format documentation'
|
34
|
-
end
|
35
|
-
|
36
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
37
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
38
|
-
spec.rcov = true
|
39
|
-
end
|
1
|
+
require "bundler/gem_tasks"
|
40
2
|
|
3
|
+
require "rspec/core/rake_task"
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
41
5
|
task :default => :spec
|
42
|
-
|
43
|
-
require 'rake/rdoctask'
|
44
|
-
Rake::RDocTask.new do |rdoc|
|
45
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
-
|
47
|
-
rdoc.rdoc_dir = 'rdoc'
|
48
|
-
rdoc.title = "consadole_aggregator #{version}"
|
49
|
-
rdoc.rdoc_files.include('README*')
|
50
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
-
end
|
data/bin/consadole_aggregator
CHANGED
@@ -1,56 +1,36 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
require 'consadole_aggregator'
|
3
|
+
require 'time'
|
2
4
|
require 'optparse'
|
3
|
-
|
4
|
-
|
5
|
-
$:.unshift(File.expand_path('../../lib', __FILE__)) if $0 == __FILE__
|
5
|
+
require 'twitter'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
module ConsadoleAggregator
|
8
|
+
opt = OptionParser.new
|
9
|
+
output = ->(post) { puts post }
|
10
|
+
opt.on('-o output', '--output output') { |o|
|
11
|
+
case o
|
12
|
+
when 'twitter'
|
13
|
+
Twitter.configure do |config|
|
14
|
+
config.consumer_key = ENV['CONSUMER_KEY']
|
15
|
+
config.consumer_secret = ENV['CONSUMER_SECRET']
|
16
|
+
config.oauth_token = ENV['OAUTH_TOKEN']
|
17
|
+
config.oauth_token_secret = ENV['OAUTH_TOKEN_SECRET']
|
18
|
+
end
|
19
|
+
output = ->(post) { Twitter.update Helper.truncate_for_twitter(post[:title], { url: post[:url], hashtag: '#consadole' }) }
|
20
|
+
end
|
21
|
+
}
|
11
22
|
|
12
|
-
|
13
|
-
when 'log'
|
14
|
-
puts "output to #{path}"
|
15
|
-
->(element){
|
16
|
-
if element.kind_of?(ConsadoleAggregator::Live::Timeline)
|
17
|
-
log.debug ConsadoleAggregator::Helper.concat(element.to_s, hashtag:'#consadole')
|
18
|
-
else
|
19
|
-
title, url = element[:title], element[:url]
|
20
|
-
log.debug ConsadoleAggregator::Helper.concat(title, url:url, hashtag:'#consadole')
|
21
|
-
end
|
22
|
-
}
|
23
|
-
when 'twitter'
|
24
|
-
require 'oauth'
|
25
|
-
require 'rubytter'
|
26
|
-
path = File.expand_path('../../', __FILE__) + '/account.yaml'
|
27
|
-
ACCOUNT = YAML.load_file(path)
|
28
|
-
oauth = Rubytter::OAuth.new(ACCOUNT['consumer']['key'], ACCOUNT['consumer']['secret'])
|
29
|
-
access_token = OAuth::AccessToken.new(oauth.create_consumer, ACCOUNT['access']['key'], ACCOUNT['access']['secret'])
|
30
|
-
t = OAuthRubytter.new(access_token)
|
31
|
-
->(element){
|
32
|
-
if element.kind_of?(ConsadoleAggregator::Live::Timeline)
|
33
|
-
t.update ConsadoleAggregator::Helper.concat(element.to_s, hashtag:'#consadole')
|
34
|
-
else
|
35
|
-
title, url = element[:title], element[:url]
|
36
|
-
t.update ConsadoleAggregator::Helper.concat(title, url:url, hashtag:'#consadole')
|
37
|
-
end
|
38
|
-
}
|
39
|
-
end
|
23
|
+
subcommand = ARGV.shift
|
40
24
|
|
41
|
-
case
|
42
|
-
when 'news'
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
log.info "end #{m}"
|
25
|
+
case subcommand
|
26
|
+
when 'news'
|
27
|
+
opt.parse!(ARGV)
|
28
|
+
News.run &output
|
29
|
+
when 'live'
|
30
|
+
starting_time = Time.parse(ARGV.shift)
|
31
|
+
opt.parse!(ARGV)
|
32
|
+
Live.run starting_time, { writer: output }
|
33
|
+
else
|
34
|
+
raise 'first argument must be "news" or "live"'
|
52
35
|
end
|
53
|
-
when 'live'
|
54
|
-
reservation_time = params['date'] ? Time.parse(params['date']) : nil
|
55
|
-
ConsadoleAggregator::Live.reserve(reservation_time).execute &output
|
56
36
|
end
|
@@ -1,217 +1,29 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "consadole_aggregator/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
6
|
+
s.name = "consadole_aggregator"
|
7
|
+
s.version = ConsadoleAggregator::VERSION
|
8
|
+
s.authors = ["niku"]
|
9
|
+
s.email = ["niku@niku.name"]
|
10
|
+
s.homepage = "https://github.com/niku/consadole_aggregator"
|
11
|
+
s.summary = %q{aggregates infomation of 'Consadole Sapporo'}
|
12
|
+
#s.description = %q{TODO: Write a gem description}
|
9
13
|
|
10
|
-
s.
|
11
|
-
s.authors = ["niku"]
|
12
|
-
s.date = %q{2011-06-24}
|
13
|
-
s.default_executable = %q{consadole_aggregator}
|
14
|
-
s.description = %q{ It aggregates infomation of 'Consadole Sapporo' }
|
15
|
-
s.email = %q{niku@niku.name}
|
16
|
-
s.executables = ["consadole_aggregator"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE.txt",
|
19
|
-
"README.rdoc"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".document",
|
23
|
-
".rspec",
|
24
|
-
"Gemfile",
|
25
|
-
"Gemfile.lock",
|
26
|
-
"LICENSE.txt",
|
27
|
-
"README.rdoc",
|
28
|
-
"Rakefile",
|
29
|
-
"VERSION",
|
30
|
-
"account.yaml",
|
31
|
-
"bin/consadole_aggregator",
|
32
|
-
"consadole_aggregator.gemspec",
|
33
|
-
"db/.gitignore",
|
34
|
-
"lib/consadole_aggregator.rb",
|
35
|
-
"lib/consadole_aggregator/aggregatable.rb",
|
36
|
-
"lib/consadole_aggregator/helper.rb",
|
37
|
-
"lib/consadole_aggregator/live.rb",
|
38
|
-
"lib/consadole_aggregator/live/timeline.rb",
|
39
|
-
"lib/consadole_aggregator/news.rb",
|
40
|
-
"log/.gitignore",
|
41
|
-
"spec/consadole_aggregator/aggregatable_spec.rb",
|
42
|
-
"spec/consadole_aggregator/helper_spec.rb",
|
43
|
-
"spec/consadole_aggregator/live/timeline_spec.rb",
|
44
|
-
"spec/consadole_aggregator/live_spec.rb",
|
45
|
-
"spec/consadole_aggregator/news_spec.rb",
|
46
|
-
"spec/ext/asahi.txt",
|
47
|
-
"spec/ext/clubconsadole.txt",
|
48
|
-
"spec/ext/consaburn.txt",
|
49
|
-
"spec/ext/consaclub.txt",
|
50
|
-
"spec/ext/consadolenews.txt",
|
51
|
-
"spec/ext/consadolephotos.txt",
|
52
|
-
"spec/ext/forzaconsadole.txt",
|
53
|
-
"spec/ext/hochiyomiuri.txt",
|
54
|
-
"spec/ext/jsgoalnews.txt",
|
55
|
-
"spec/ext/jsgoalphotos.txt",
|
56
|
-
"spec/ext/live/s674.html",
|
57
|
-
"spec/ext/live/s674.html.1",
|
58
|
-
"spec/ext/live/s674.html.10",
|
59
|
-
"spec/ext/live/s674.html.100",
|
60
|
-
"spec/ext/live/s674.html.101",
|
61
|
-
"spec/ext/live/s674.html.102",
|
62
|
-
"spec/ext/live/s674.html.103",
|
63
|
-
"spec/ext/live/s674.html.104",
|
64
|
-
"spec/ext/live/s674.html.105",
|
65
|
-
"spec/ext/live/s674.html.106",
|
66
|
-
"spec/ext/live/s674.html.107",
|
67
|
-
"spec/ext/live/s674.html.108",
|
68
|
-
"spec/ext/live/s674.html.109",
|
69
|
-
"spec/ext/live/s674.html.11",
|
70
|
-
"spec/ext/live/s674.html.110",
|
71
|
-
"spec/ext/live/s674.html.111",
|
72
|
-
"spec/ext/live/s674.html.112",
|
73
|
-
"spec/ext/live/s674.html.113",
|
74
|
-
"spec/ext/live/s674.html.114",
|
75
|
-
"spec/ext/live/s674.html.115",
|
76
|
-
"spec/ext/live/s674.html.116",
|
77
|
-
"spec/ext/live/s674.html.117",
|
78
|
-
"spec/ext/live/s674.html.118",
|
79
|
-
"spec/ext/live/s674.html.119",
|
80
|
-
"spec/ext/live/s674.html.12",
|
81
|
-
"spec/ext/live/s674.html.120",
|
82
|
-
"spec/ext/live/s674.html.13",
|
83
|
-
"spec/ext/live/s674.html.14",
|
84
|
-
"spec/ext/live/s674.html.15",
|
85
|
-
"spec/ext/live/s674.html.16",
|
86
|
-
"spec/ext/live/s674.html.17",
|
87
|
-
"spec/ext/live/s674.html.18",
|
88
|
-
"spec/ext/live/s674.html.19",
|
89
|
-
"spec/ext/live/s674.html.2",
|
90
|
-
"spec/ext/live/s674.html.20",
|
91
|
-
"spec/ext/live/s674.html.21",
|
92
|
-
"spec/ext/live/s674.html.22",
|
93
|
-
"spec/ext/live/s674.html.23",
|
94
|
-
"spec/ext/live/s674.html.24",
|
95
|
-
"spec/ext/live/s674.html.25",
|
96
|
-
"spec/ext/live/s674.html.26",
|
97
|
-
"spec/ext/live/s674.html.27",
|
98
|
-
"spec/ext/live/s674.html.28",
|
99
|
-
"spec/ext/live/s674.html.29",
|
100
|
-
"spec/ext/live/s674.html.3",
|
101
|
-
"spec/ext/live/s674.html.30",
|
102
|
-
"spec/ext/live/s674.html.31",
|
103
|
-
"spec/ext/live/s674.html.32",
|
104
|
-
"spec/ext/live/s674.html.33",
|
105
|
-
"spec/ext/live/s674.html.34",
|
106
|
-
"spec/ext/live/s674.html.35",
|
107
|
-
"spec/ext/live/s674.html.36",
|
108
|
-
"spec/ext/live/s674.html.37",
|
109
|
-
"spec/ext/live/s674.html.38",
|
110
|
-
"spec/ext/live/s674.html.39",
|
111
|
-
"spec/ext/live/s674.html.4",
|
112
|
-
"spec/ext/live/s674.html.40",
|
113
|
-
"spec/ext/live/s674.html.41",
|
114
|
-
"spec/ext/live/s674.html.42",
|
115
|
-
"spec/ext/live/s674.html.43",
|
116
|
-
"spec/ext/live/s674.html.44",
|
117
|
-
"spec/ext/live/s674.html.45",
|
118
|
-
"spec/ext/live/s674.html.46",
|
119
|
-
"spec/ext/live/s674.html.47",
|
120
|
-
"spec/ext/live/s674.html.48",
|
121
|
-
"spec/ext/live/s674.html.49",
|
122
|
-
"spec/ext/live/s674.html.5",
|
123
|
-
"spec/ext/live/s674.html.50",
|
124
|
-
"spec/ext/live/s674.html.51",
|
125
|
-
"spec/ext/live/s674.html.52",
|
126
|
-
"spec/ext/live/s674.html.53",
|
127
|
-
"spec/ext/live/s674.html.54",
|
128
|
-
"spec/ext/live/s674.html.55",
|
129
|
-
"spec/ext/live/s674.html.56",
|
130
|
-
"spec/ext/live/s674.html.57",
|
131
|
-
"spec/ext/live/s674.html.58",
|
132
|
-
"spec/ext/live/s674.html.59",
|
133
|
-
"spec/ext/live/s674.html.6",
|
134
|
-
"spec/ext/live/s674.html.60",
|
135
|
-
"spec/ext/live/s674.html.61",
|
136
|
-
"spec/ext/live/s674.html.62",
|
137
|
-
"spec/ext/live/s674.html.63",
|
138
|
-
"spec/ext/live/s674.html.64",
|
139
|
-
"spec/ext/live/s674.html.65",
|
140
|
-
"spec/ext/live/s674.html.66",
|
141
|
-
"spec/ext/live/s674.html.67",
|
142
|
-
"spec/ext/live/s674.html.68",
|
143
|
-
"spec/ext/live/s674.html.69",
|
144
|
-
"spec/ext/live/s674.html.7",
|
145
|
-
"spec/ext/live/s674.html.70",
|
146
|
-
"spec/ext/live/s674.html.71",
|
147
|
-
"spec/ext/live/s674.html.72",
|
148
|
-
"spec/ext/live/s674.html.73",
|
149
|
-
"spec/ext/live/s674.html.74",
|
150
|
-
"spec/ext/live/s674.html.75",
|
151
|
-
"spec/ext/live/s674.html.76",
|
152
|
-
"spec/ext/live/s674.html.77",
|
153
|
-
"spec/ext/live/s674.html.78",
|
154
|
-
"spec/ext/live/s674.html.79",
|
155
|
-
"spec/ext/live/s674.html.8",
|
156
|
-
"spec/ext/live/s674.html.80",
|
157
|
-
"spec/ext/live/s674.html.81",
|
158
|
-
"spec/ext/live/s674.html.82",
|
159
|
-
"spec/ext/live/s674.html.83",
|
160
|
-
"spec/ext/live/s674.html.84",
|
161
|
-
"spec/ext/live/s674.html.85",
|
162
|
-
"spec/ext/live/s674.html.86",
|
163
|
-
"spec/ext/live/s674.html.87",
|
164
|
-
"spec/ext/live/s674.html.88",
|
165
|
-
"spec/ext/live/s674.html.89",
|
166
|
-
"spec/ext/live/s674.html.9",
|
167
|
-
"spec/ext/live/s674.html.90",
|
168
|
-
"spec/ext/live/s674.html.91",
|
169
|
-
"spec/ext/live/s674.html.92",
|
170
|
-
"spec/ext/live/s674.html.93",
|
171
|
-
"spec/ext/live/s674.html.94",
|
172
|
-
"spec/ext/live/s674.html.95",
|
173
|
-
"spec/ext/live/s674.html.96",
|
174
|
-
"spec/ext/live/s674.html.97",
|
175
|
-
"spec/ext/live/s674.html.98",
|
176
|
-
"spec/ext/live/s674.html.99",
|
177
|
-
"spec/ext/nikkansports.txt",
|
178
|
-
"spec/spec.opts",
|
179
|
-
"spec/spec_helper.rb"
|
180
|
-
]
|
181
|
-
s.homepage = %q{http://github.com/niku/consadole_aggregator}
|
182
|
-
s.licenses = ["MIT"]
|
183
|
-
s.require_paths = ["lib"]
|
184
|
-
s.rubygems_version = %q{1.6.2}
|
185
|
-
s.summary = %q{It aggregates infomation of 'Consadole Sapporo'}
|
14
|
+
s.rubyforge_project = "consadole_aggregator"
|
186
15
|
|
187
|
-
|
188
|
-
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
189
20
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
else
|
199
|
-
s.add_dependency(%q<nokogiri>, [">= 0"])
|
200
|
-
s.add_dependency(%q<oauth>, [">= 0"])
|
201
|
-
s.add_dependency(%q<rubytter>, [">= 0"])
|
202
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
203
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
204
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
205
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
206
|
-
end
|
207
|
-
else
|
208
|
-
s.add_dependency(%q<nokogiri>, [">= 0"])
|
209
|
-
s.add_dependency(%q<oauth>, [">= 0"])
|
210
|
-
s.add_dependency(%q<rubytter>, [">= 0"])
|
211
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
212
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
213
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
214
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
215
|
-
end
|
21
|
+
s.add_development_dependency "rspec"
|
22
|
+
s.add_development_dependency "guard"
|
23
|
+
s.add_development_dependency "guard-rspec"
|
24
|
+
s.add_development_dependency "ruby_gntp"
|
25
|
+
s.add_runtime_dependency "nokogiri"
|
26
|
+
s.add_runtime_dependency "eventmachine"
|
27
|
+
s.add_runtime_dependency "twitter"
|
28
|
+
s.add_runtime_dependency "httpclient"
|
216
29
|
end
|
217
|
-
|
@@ -1,12 +1,16 @@
|
|
1
1
|
module ConsadoleAggregator
|
2
2
|
class Helper
|
3
|
-
|
4
|
-
|
3
|
+
PLACE_HOLDER = '@'
|
4
|
+
PLACE_HOLD_MATCHER = Regexp.compile("#{PLACE_HOLDER}{20}")
|
5
|
+
|
6
|
+
def self.truncate_for_twitter text, opt={}
|
7
|
+
url_place_holder = opt[:url] && PLACE_HOLDER*20 # twitter compress url to t.co as length 20 characters.
|
8
|
+
base = "#{text} #{url_place_holder} #{opt[:hashtag]}".squeeze(' ').rstrip
|
5
9
|
if base.size > 140
|
6
10
|
over_size = base.size - 140
|
7
|
-
|
11
|
+
self.truncate_for_twitter(omit(text, over_size), opt)
|
8
12
|
else
|
9
|
-
base
|
13
|
+
base.gsub(PLACE_HOLD_MATCHER) { opt[:url] } # revert place holder to url
|
10
14
|
end
|
11
15
|
end
|
12
16
|
|