etfc 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.rubocop.yml +7 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +98 -0
- data/Rakefile +15 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/etfc.gemspec +36 -0
- data/exe/etfc +11 -0
- data/fixtures/images/1.jpg +0 -0
- data/fixtures/images/10.jpg +0 -0
- data/fixtures/images/2.jpg +0 -0
- data/fixtures/images/3.jpg +0 -0
- data/fixtures/images/4.jpg +0 -0
- data/fixtures/images/5.jpg +0 -0
- data/fixtures/images/6.jpg +0 -0
- data/fixtures/images/7.jpg +0 -0
- data/fixtures/images/8.jpg +0 -0
- data/fixtures/images/9.jpg +0 -0
- data/fixtures/vcr_cassettes/collage.yml +76395 -0
- data/fixtures/vcr_cassettes/download_blank_image.yml +83 -0
- data/fixtures/vcr_cassettes/flickr_search_match.yml +121 -0
- data/fixtures/vcr_cassettes/flickr_search_no_match.yml +62 -0
- data/fixtures/vcr_cassettes/ten_images.yml +1319 -0
- data/lib/etfc/cli.rb +32 -0
- data/lib/etfc/collage.rb +35 -0
- data/lib/etfc/dictionary.rb +59 -0
- data/lib/etfc/flickr.rb +38 -0
- data/lib/etfc/image.rb +45 -0
- data/lib/etfc/runner.rb +65 -0
- data/lib/etfc/version.rb +3 -0
- data/lib/etfc.rb +15 -0
- data/sample_collage.jpg +0 -0
- metadata +223 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e9d06ef4e2f1d924cabcdaf2ce052046b677a26f
|
4
|
+
data.tar.gz: f79f45a8e4c78688bec0fafd5ed8a5854b643b16
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bc202f668ef564ce20319069c0ae3e0a11165b171839a674ece60c048305142701a76acf8ab4454ddfb16a1a91029adadf520405cad54815515d7ad0edc9d3fb
|
7
|
+
data.tar.gz: f230c7bdcba8413eebefccf790cd5584bcdf71dcf87f70246581152e0fd73ffbaeef00c2c7f3cff5553b5fd42f3d72ef5bc1b8ee1667c77ab004d0999617cc4c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at mxhaack@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Maximilian Haack
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
# ETFC
|
2
|
+
|
3
|
+
ETFC is your friendly flickr collage creator. You give it a few keywords like
|
4
|
+
'butter', 'rick sanchez' and 'purpose'; ETFC will then go and fetch the most
|
5
|
+
interesting related pictures from flickr and create a collage of 5x2 images.
|
6
|
+
|
7
|
+
![Sample Collage](sample_collage.jpg)
|
8
|
+
|
9
|
+
## Prerequisites
|
10
|
+
|
11
|
+
### Software
|
12
|
+
|
13
|
+
ImageMagick needs to be installed, check http://www.imagemagick.org/ for
|
14
|
+
instructions.
|
15
|
+
|
16
|
+
Though not strictly necessary, the user is advised to ensure a [words
|
17
|
+
file](https://en.wikipedia.org/wiki/Words_(Unix)) is present.
|
18
|
+
|
19
|
+
### Flickr API Key
|
20
|
+
|
21
|
+
Flickr requires an API Key and Shared Secret for communication with their API,
|
22
|
+
unfortunately we can't distribute these with the source code and thus you will
|
23
|
+
have to go through their simple registration process to receive these. Simply
|
24
|
+
go to [Flickr's App Garden](https://www.flickr.com/services/apps/create) and
|
25
|
+
register an application of your own.
|
26
|
+
|
27
|
+
## Installation
|
28
|
+
|
29
|
+
You probably want to use ETFC from your command line, in order to do so simply
|
30
|
+
install the gem:
|
31
|
+
|
32
|
+
$ gem install etfc
|
33
|
+
|
34
|
+
Alternatively you can use ETFC's functionality from your own application. Add
|
35
|
+
this line to your application's Gemfile:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
gem 'etfc'
|
39
|
+
```
|
40
|
+
|
41
|
+
And then execute:
|
42
|
+
|
43
|
+
$ bundle
|
44
|
+
|
45
|
+
## Usage
|
46
|
+
|
47
|
+
As mentioned under the [Prerequisites](#prerequisites), you will need an API
|
48
|
+
Key and Shared Secret. Place these as environment variables in your terminal
|
49
|
+
environment:
|
50
|
+
|
51
|
+
$ export FLICKR_API_KEY=abcdef12341abcdef
|
52
|
+
$ export FLICKR_SHARED_SECRET=fedcba321
|
53
|
+
|
54
|
+
### CLI usage
|
55
|
+
|
56
|
+
To create a collage use the following command:
|
57
|
+
|
58
|
+
$ etfc collage best_collage_ever.jpg --keywords=butter 'rick sanchez' purpose
|
59
|
+
|
60
|
+
### API usage
|
61
|
+
|
62
|
+
You can use ETFC as a gem in your application and (re-)use it's functionality
|
63
|
+
for your own purposes. ETFC consist of several modules each serving a singular
|
64
|
+
purpose:
|
65
|
+
|
66
|
+
- `ETFC::Flickr` -> Flickr search
|
67
|
+
- `ETFC::Image` -> Image download and cropping
|
68
|
+
- `ETFC::Collage` -> Collage creation
|
69
|
+
- `ETFC::Dictionary` -> Random word selection from the (system) dictionary
|
70
|
+
|
71
|
+
Refer to the individual module's documentation for usage details, or have
|
72
|
+
a look at the `ETFC::Runner` on how to tie them all together.
|
73
|
+
|
74
|
+
## Development
|
75
|
+
|
76
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
77
|
+
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
78
|
+
prompt that will allow you to experiment.
|
79
|
+
|
80
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
81
|
+
release a new version, update the version number in `version.rb`, and then run
|
82
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
83
|
+
git commits and tags, and push the `.gem` file to
|
84
|
+
[rubygems.org](https://rubygems.org).
|
85
|
+
|
86
|
+
## Contributing
|
87
|
+
|
88
|
+
Bug reports and pull requests are welcome on GitHub at
|
89
|
+
https://github.com/coffeejunk/etfc. This project is intended to be a safe,
|
90
|
+
welcoming space for collaboration, and contributors are expected to adhere to
|
91
|
+
the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
92
|
+
|
93
|
+
|
94
|
+
## License
|
95
|
+
|
96
|
+
The gem is available as open source under the terms of the [MIT
|
97
|
+
License](http://opensource.org/licenses/MIT).
|
98
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task default: :spec
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'rubocop/rake_task'
|
10
|
+
RuboCop::RakeTask.new
|
11
|
+
|
12
|
+
task default: :rubocop
|
13
|
+
rescue LoadError
|
14
|
+
warn 'RuboCop not available, quality task not provided.'
|
15
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'etfc'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/etfc.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'etfc/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'etfc'
|
8
|
+
spec.version = ETFC::VERSION
|
9
|
+
spec.authors = ['Maximilian Haack']
|
10
|
+
spec.email = ['mxhaack@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'A flickr collage maker'
|
13
|
+
spec.description = 'ETFC is a tool to create collages from flickr ' \
|
14
|
+
'images based upon user provided keywords.'
|
15
|
+
spec.homepage = 'https://www.github.com/coffeejunk/etfc'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_runtime_dependency 'flickraw', '~> 0.9.9'
|
26
|
+
spec.add_runtime_dependency 'rmagick', '~> 2.16.0'
|
27
|
+
spec.add_runtime_dependency 'thor', '~> 0.19.4'
|
28
|
+
|
29
|
+
spec.add_development_dependency 'bundler', '~> 1.13'
|
30
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
31
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
32
|
+
spec.add_development_dependency 'rubocop', '~> 0.46.0'
|
33
|
+
spec.add_development_dependency 'simplecov', '~> 0.12.0'
|
34
|
+
spec.add_development_dependency 'webmock', '~> 2.3.1'
|
35
|
+
spec.add_development_dependency 'vcr', '~> 3.0.3'
|
36
|
+
end
|
data/exe/etfc
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|