aviary 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +13 -0
- data/README.md +5 -13
- data/aviary.gemspec +1 -1
- data/bin/aviary +9 -9
- data/generator/template.erb +3 -3
- data/lib/aviary/configuration.rb +1 -1
- data/lib/aviary/generator.rb +3 -3
- data/lib/aviary/search.rb +1 -1
- data/lib/aviary/version.rb +1 -1
- data/test/aviary/configuration_test.rb +2 -2
- data/test/aviary/generator_test.rb +1 -1
- data/test/aviary/search_test.rb +7 -7
- metadata +5 -4
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Aviary
|
2
2
|
|
3
|
-
Aviary generates a static photo gallery using Twitter
|
3
|
+
Aviary generates a static photo gallery using Twitter.
|
4
4
|
|
5
|
-
Twitter is a fantastic resource for discovering photos of events as they unfold. Searching
|
5
|
+
Twitter is a fantastic resource for discovering photos of events as they unfold. Searching using your preferred client means you have to do the filtering. Commentary and relinking drown new and interesting photos. In the days the water rose during the 2011 Brisbane floods I wished there was a way to see all the photos without the noise. Now there is.
|
6
6
|
|
7
7
|
See the wiki for a [listing of galleries](https://github.com/tatey/aviary/wiki/galleries).
|
8
8
|
|
@@ -37,18 +37,10 @@ Preview
|
|
37
37
|
* Ruby 1.8.7, 1.9.2
|
38
38
|
* SQLite3
|
39
39
|
|
40
|
-
|
40
|
+
If you're interested in extending Aviary, you can get all the gem dependancies using Bundler.
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
* Nokoigir
|
45
|
-
* Twitter
|
46
|
-
|
47
|
-
### Development
|
48
|
-
|
49
|
-
* Bundler
|
50
|
-
* MiniTest
|
51
|
-
* Webmock
|
42
|
+
gem install bundler
|
43
|
+
bundle install
|
52
44
|
|
53
45
|
## Customising the Template
|
54
46
|
|
data/aviary.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.email = ['tate@tatey.com']
|
10
10
|
s.homepage = 'https://github.com/tatey/aviary'
|
11
11
|
s.summary = %q{A static photo gallery generator for Twitter}
|
12
|
-
s.description = %q{Aviary generates a static photo gallery using Twitter
|
12
|
+
s.description = %q{Aviary generates a static photo gallery using Twitter}
|
13
13
|
|
14
14
|
s.rubyforge_project = s.name
|
15
15
|
|
data/bin/aviary
CHANGED
@@ -8,12 +8,12 @@ require 'aviary'
|
|
8
8
|
command = nil
|
9
9
|
options = {}
|
10
10
|
help = <<-HELP
|
11
|
-
Aviary generates a static photo gallery from Twitter
|
11
|
+
Aviary generates a static photo gallery from Twitter.
|
12
12
|
|
13
13
|
Usage:
|
14
|
-
aviary new
|
15
|
-
aviary search
|
16
|
-
aviary build [options...]
|
14
|
+
aviary new QUERY # Setup files and directories
|
15
|
+
aviary search QUERY [options...] # Search tweets with photos
|
16
|
+
aviary build [options...] # Build gallery
|
17
17
|
|
18
18
|
Help:
|
19
19
|
aviary <command> --help
|
@@ -24,15 +24,15 @@ case ARGV[0]
|
|
24
24
|
when 'new'
|
25
25
|
if ARGV.size == 2 && ARGV[1] != "--help"
|
26
26
|
options[:source] = File.join(Dir.pwd, ARGV[1])
|
27
|
-
options[:
|
27
|
+
options[:query] = ARGV[1]
|
28
28
|
command = proc { |config| Aviary::Generator.new(config) }
|
29
29
|
else
|
30
|
-
puts "Invalid argument. Try `aviary new
|
30
|
+
puts "Invalid argument. Try `aviary new QUERY`"
|
31
31
|
exit 1
|
32
32
|
end
|
33
33
|
when 'search'
|
34
34
|
OptionParser.new do |o|
|
35
|
-
o.banner = 'Usage: aviary search
|
35
|
+
o.banner = 'Usage: aviary search QUERY [options...]'
|
36
36
|
|
37
37
|
o.on('--source DIR', 'Path to source') do |arg|
|
38
38
|
options[:source] = arg
|
@@ -50,8 +50,8 @@ when 'search'
|
|
50
50
|
end
|
51
51
|
|
52
52
|
if ARGV.size == 2
|
53
|
-
options[:
|
54
|
-
command
|
53
|
+
options[:query] = ARGV[1]
|
54
|
+
command = proc { |config| Aviary::Search.new(config) }
|
55
55
|
else
|
56
56
|
puts "Invalid argument. Run `aviary search --help` for assistance."
|
57
57
|
exit 1
|
data/generator/template.erb
CHANGED
@@ -3,15 +3,15 @@
|
|
3
3
|
<head>
|
4
4
|
<meta name="generator" content="Aviary <%= Aviary::VERSION %> - https://github.com/tatey/aviary">
|
5
5
|
<meta charset="utf-8">
|
6
|
-
<title>#{{
|
6
|
+
<title>#{{query}}</title>
|
7
7
|
<link type="text/css" rel="stylesheet" href="/aviary.css">
|
8
8
|
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
|
9
9
|
<script type="text/javascript" src="/aviary.js"></script>
|
10
10
|
</head>
|
11
11
|
<body>
|
12
|
-
<h1><a href="/">#{{
|
12
|
+
<h1><a href="/">#{{query}}</a></h1>
|
13
13
|
<p>
|
14
|
-
A raw collection of photos tweeted with <a href="http://twitter.com/search/%23{{
|
14
|
+
A raw collection of photos tweeted with <a href="http://twitter.com/search/%23{{query}}">#{{query}}</a>
|
15
15
|
</p>
|
16
16
|
<ul>
|
17
17
|
<% image_hosts.each do |image_host| %>
|
data/lib/aviary/configuration.rb
CHANGED
@@ -4,7 +4,7 @@ module Aviary
|
|
4
4
|
@config = {}
|
5
5
|
@config[:source] = config[:source] || Dir.pwd
|
6
6
|
@config[:dest] = config[:dest] || File.join(@config[:source], '_site')
|
7
|
-
@config[:
|
7
|
+
@config[:query] = config[:query]
|
8
8
|
@config[:per_page] = config[:per_page]
|
9
9
|
@config[:limit] = config[:limit]
|
10
10
|
|
data/lib/aviary/generator.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Aviary
|
2
2
|
class Generator
|
3
|
-
attr_reader :source, :
|
3
|
+
attr_reader :source, :query
|
4
4
|
|
5
5
|
def initialize(config)
|
6
6
|
@source = config[:source]
|
7
|
-
@
|
7
|
+
@query = config[:query]
|
8
8
|
end
|
9
9
|
|
10
10
|
def process
|
@@ -27,7 +27,7 @@ module Aviary
|
|
27
27
|
FileUtils.mkdir_p(self.source) unless File.exists?(self.source)
|
28
28
|
File.open(File.join(self.source, 'template.erb'), 'w') do |file|
|
29
29
|
erb = File.read(File.join(generator_path, 'template.erb'))
|
30
|
-
erb.gsub!('{{
|
30
|
+
erb.gsub!('{{query}}', self.query) if self.query
|
31
31
|
file.write(erb)
|
32
32
|
end
|
33
33
|
FileUtils.cp_r File.join(generator_path, '_assets'), self.source
|
data/lib/aviary/search.rb
CHANGED
@@ -3,7 +3,7 @@ module Aviary
|
|
3
3
|
attr_reader :twitter, :limit, :current_page
|
4
4
|
|
5
5
|
def initialize(config)
|
6
|
-
@twitter = Twitter::Search.new.filter('links').no_retweets.per_page(100).
|
6
|
+
@twitter = Twitter::Search.new.filter('links').no_retweets.per_page(100).containing(config[:query])
|
7
7
|
@limit = config[:limit] || 50
|
8
8
|
@current_page = 1
|
9
9
|
end
|
data/lib/aviary/version.rb
CHANGED
@@ -19,8 +19,8 @@ class ConfigurationTest < MiniTest::Unit::TestCase
|
|
19
19
|
assert_equal 100, Configuration.new(:test, {:limit => 100})[:limit]
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
23
|
-
assert_equal 'cat', Configuration.new(:test, {:
|
22
|
+
def test_configuration_with_query_sets_query
|
23
|
+
assert_equal 'cat', Configuration.new(:test, {:query => 'cat'})[:query]
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_configuration_with_flickr_api_key_sets_api_key
|
@@ -3,7 +3,7 @@ require File.expand_path('../../helper', __FILE__)
|
|
3
3
|
class GeneratorTest < MiniTest::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
config = Aviary::Configuration.new(:default, :source => source_dir)
|
6
|
-
@generator = Generator.new(:source => config[:source], :
|
6
|
+
@generator = Generator.new(:source => config[:source], :query => "cat")
|
7
7
|
end
|
8
8
|
|
9
9
|
def teardown
|
data/test/aviary/search_test.rb
CHANGED
@@ -3,9 +3,9 @@ require File.expand_path('../../helper', __FILE__)
|
|
3
3
|
class SearchTest < MiniTest::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
Aviary::Configuration.new(:test)
|
6
|
-
stub_get("https://search.twitter.com/search.json?q=filter:links%20-rt%
|
7
|
-
stub_get("https://search.twitter.com/search.json?max_id=34911824591724544&page=2&q=filter:links%20-rt%
|
8
|
-
stub_get("https://search.twitter.com/search.json?max_id=34911824591724544&page=3&q=filter:links%20-rt%
|
6
|
+
stub_get("https://search.twitter.com/search.json?q=filter:links%20-rt%20cat&rpp=100")
|
7
|
+
stub_get("https://search.twitter.com/search.json?max_id=34911824591724544&page=2&q=filter:links%20-rt%20cat&rpp=100")
|
8
|
+
stub_get("https://search.twitter.com/search.json?max_id=34911824591724544&page=3&q=filter:links%20-rt%20cat&rpp=100")
|
9
9
|
end
|
10
10
|
|
11
11
|
def teardown
|
@@ -18,23 +18,23 @@ class SearchTest < MiniTest::Unit::TestCase
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_process_should_match_and_create_records
|
21
|
-
Search.new(:
|
21
|
+
Search.new(:query => 'cat', :limit => 3).process
|
22
22
|
assert_equal 2, ImageHost::Yfrog.count
|
23
23
|
assert_equal 13, ImageHost::Twitpic.count
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_process_should_finish_at_page_3
|
27
|
-
search = Search.new(:
|
27
|
+
search = Search.new(:query => 'cat', :limit => 3)
|
28
28
|
search.process
|
29
29
|
assert_equal 3, search.current_page
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_next_page_boolean_should_be_false_when_at_limit
|
33
|
-
assert !Search.new(:
|
33
|
+
assert !Search.new(:query => 'cat', :limit => 1).next_page?
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_next_page_bang_should_increment_current_page
|
37
|
-
search = Search.new(:
|
37
|
+
search = Search.new(:query => 'cat')
|
38
38
|
assert_equal 1, search.current_page
|
39
39
|
|
40
40
|
search.next_page!
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tate Johnson
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-02-
|
17
|
+
date: 2011-02-22 00:00:00 +10:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -166,7 +166,7 @@ dependencies:
|
|
166
166
|
version: 1.1.2
|
167
167
|
type: :runtime
|
168
168
|
version_requirements: *id010
|
169
|
-
description: Aviary generates a static photo gallery using Twitter
|
169
|
+
description: Aviary generates a static photo gallery using Twitter
|
170
170
|
email:
|
171
171
|
- tate@tatey.com
|
172
172
|
executables:
|
@@ -177,6 +177,7 @@ extra_rdoc_files: []
|
|
177
177
|
|
178
178
|
files:
|
179
179
|
- .gitignore
|
180
|
+
- CHANGELOG.md
|
180
181
|
- Gemfile
|
181
182
|
- LICENSE
|
182
183
|
- README.md
|