twitter_images 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/twitter_images +4 -3
- data/lib/twitter_images/cli.rb +15 -0
- data/lib/twitter_images/configuration.rb +96 -0
- data/lib/twitter_images/downloader.rb +36 -0
- data/lib/twitter_images/version.rb +1 -1
- data/lib/twitter_images.rb +5 -165
- metadata +49 -21
- data/.gitignore +0 -9
- data/.rspec +0 -2
- data/.ruby-version +0 -1
- data/.travis.yml +0 -12
- data/Gemfile +0 -4
- data/README.md +0 -49
- data/Rakefile +0 -10
- data/twitter_images.gemspec +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5396eb2858c323b0b9bc1b102349c954538adc4
|
4
|
+
data.tar.gz: 5fddbe2b1d551eae8e85debc0f723303fe4c36e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95f5b0fbbc333e7edd30091f9f34d45f2f642a4f513faa71f638fc03e87283b2e0cb426af4ea00232ec13bc45f6f89193cb114ca9ff53ba23fb16eaa292ff002
|
7
|
+
data.tar.gz: ca4e23a17947b2f7d3718127cbd64a0e48f37059b9a98112df8e19c824066137eab412c2d92a8afb990c64e328dbd9464d33d93f6e9d4fb9202e84894d07c5fe
|
data/bin/twitter_images
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
$LOAD_PATH.unshift(File.expand_path("../lib", __FILE__))
|
3
4
|
require "twitter_images"
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
TwitterImages::
|
6
|
+
configuration = TwitterImages::Configuration.new
|
7
|
+
downloader = TwitterImages::Downloader.new(configuration)
|
8
|
+
TwitterImages::CLI.new(configuration, downloader).run
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module TwitterImages
|
2
|
+
class CLI
|
3
|
+
attr_accessor :downloader, :configuration
|
4
|
+
|
5
|
+
def initialize(configuration, downloader)
|
6
|
+
@configuration = configuration
|
7
|
+
@downloader = downloader
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
configuration.prepare
|
12
|
+
downloader.download
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module TwitterImages
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :search, :directory, :output, :consumer_key, :access_token,
|
4
|
+
:address, :request, :http, :response
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
@search = search
|
8
|
+
@directory = directory
|
9
|
+
@output = output
|
10
|
+
@consumer_key = consumer_key
|
11
|
+
@access_token = access_token
|
12
|
+
@address = address
|
13
|
+
@request = request
|
14
|
+
@http = http
|
15
|
+
@response = response
|
16
|
+
end
|
17
|
+
|
18
|
+
def prepare
|
19
|
+
setup_credentials
|
20
|
+
get_directory
|
21
|
+
change_directory
|
22
|
+
get_search
|
23
|
+
establish_connection
|
24
|
+
end
|
25
|
+
|
26
|
+
def establish_connection
|
27
|
+
setup_address
|
28
|
+
setup_http
|
29
|
+
build_request
|
30
|
+
issue_request
|
31
|
+
get_output
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def setup_credentials
|
37
|
+
check_env
|
38
|
+
@consumer_key = OAuth::Consumer.new(ENV["CONSUMER_KEY"], ENV["CONSUMER_SECRET"])
|
39
|
+
@access_token = OAuth::Token.new(ENV["ACCESS_TOKEN"], ENV["ACCESS_SECRET"])
|
40
|
+
end
|
41
|
+
|
42
|
+
def check_env
|
43
|
+
if ENV.key?("CONSUMER_KEY") &&
|
44
|
+
ENV.key?("CONSUMER_SECRET") &&
|
45
|
+
ENV.key?("ACCESS_TOKEN") &&
|
46
|
+
ENV.key?("ACCESS_SECRET")
|
47
|
+
return true
|
48
|
+
else
|
49
|
+
return "The credentials have not been correctly set up in your ENV"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def setup_http
|
54
|
+
# Set up Net::HTTP to use SSL, which is required by Twitter.
|
55
|
+
@http = Net::HTTP.new(address.host, address.port)
|
56
|
+
http.use_ssl = true
|
57
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
58
|
+
end
|
59
|
+
|
60
|
+
def build_request
|
61
|
+
# Build the request and authorize it with OAuth.
|
62
|
+
@request = Net::HTTP::Get.new(address.request_uri)
|
63
|
+
request.oauth!(http, consumer_key, access_token)
|
64
|
+
end
|
65
|
+
|
66
|
+
def issue_request
|
67
|
+
# Issue the request and return the response.
|
68
|
+
http.start
|
69
|
+
@response = http.request(request)
|
70
|
+
end
|
71
|
+
|
72
|
+
def get_output
|
73
|
+
@output = JSON.parse(response.body)
|
74
|
+
end
|
75
|
+
|
76
|
+
def setup_address
|
77
|
+
@address = URI("https://api.twitter.com/1.1/search/tweets.json?q=%23#{search}&mode=photos&count=100")
|
78
|
+
end
|
79
|
+
|
80
|
+
def get_directory
|
81
|
+
puts "Please enter the absolute path to the directory to save the images in: "
|
82
|
+
@directory = gets.chomp
|
83
|
+
raise StandardError, "Directory doesn't exist" unless Dir.exists?(@directory)
|
84
|
+
end
|
85
|
+
|
86
|
+
def change_directory
|
87
|
+
Dir.chdir(@directory)
|
88
|
+
end
|
89
|
+
|
90
|
+
def get_search
|
91
|
+
puts "Please enter the search terms: "
|
92
|
+
@search = gets.chomp.gsub(/\s/, "%20")
|
93
|
+
raise StandardError, "The search string is empty" if @search.empty?
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module TwitterImages
|
2
|
+
class Downloader
|
3
|
+
attr_accessor :images
|
4
|
+
attr_reader :configuration
|
5
|
+
|
6
|
+
def initialize(configuration)
|
7
|
+
@images = images
|
8
|
+
@configuration = configuration
|
9
|
+
end
|
10
|
+
|
11
|
+
def download
|
12
|
+
get_images
|
13
|
+
save_images
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def get_images
|
19
|
+
@images = configuration.output.inspect.scan(/http:\/\/pbs.twimg.com\/media\/\w+\.(?:jpg|png|gif)/)
|
20
|
+
raise StandardError, "Couldn't find any images" unless (@images.count > 0)
|
21
|
+
end
|
22
|
+
|
23
|
+
def make_absolute(href, root)
|
24
|
+
URI.parse(root).merge(URI.parse(href)).to_s
|
25
|
+
end
|
26
|
+
|
27
|
+
def save_images
|
28
|
+
progressbar = ProgressBar.create(:total => images.count)
|
29
|
+
images.each do |src|
|
30
|
+
uri = make_absolute(src, configuration.search)
|
31
|
+
File.open(File.basename(uri), 'wb'){ |f| f.write(open(uri).read) }
|
32
|
+
progressbar.increment
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/twitter_images.rb
CHANGED
@@ -1,171 +1,11 @@
|
|
1
|
-
require "
|
2
|
-
require 'rubygems'
|
1
|
+
require "rubygems"
|
3
2
|
require "open-uri"
|
4
3
|
require "fileutils"
|
5
4
|
require "json"
|
6
5
|
require "oauth"
|
7
6
|
require "ruby-progressbar"
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def initialize(settings, images)
|
15
|
-
@settings = settings
|
16
|
-
@images = images
|
17
|
-
end
|
18
|
-
|
19
|
-
def download
|
20
|
-
settings.prepare
|
21
|
-
images.search
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class Images
|
26
|
-
attr_accessor :images
|
27
|
-
attr_reader :settings
|
28
|
-
|
29
|
-
def initialize(settings)
|
30
|
-
@images = images
|
31
|
-
@settings = settings
|
32
|
-
end
|
33
|
-
|
34
|
-
def search
|
35
|
-
get_images
|
36
|
-
save_images
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def get_images
|
42
|
-
@images = settings.output.inspect.scan(/http:\/\/pbs.twimg.com\/media\/\w+\.(?:jpg|png|gif)/)
|
43
|
-
raise StandardError, "Couldn't find any images" unless @images
|
44
|
-
end
|
45
|
-
|
46
|
-
def make_absolute(href, root)
|
47
|
-
URI.parse(root).merge(URI.parse(href)).to_s
|
48
|
-
end
|
49
|
-
|
50
|
-
def save_images
|
51
|
-
progressbar = ProgressBar.create(:total => images.count)
|
52
|
-
images.each do |src|
|
53
|
-
uri = make_absolute(src, settings.search)
|
54
|
-
File.open(File.basename(uri), 'wb'){ |f| f.write(open(uri).read) }
|
55
|
-
progressbar.increment
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
class Settings
|
61
|
-
attr_accessor :search, :directory, :output, :consumer_key, :access_token,
|
62
|
-
:address, :request, :http, :response
|
63
|
-
|
64
|
-
def initialize()
|
65
|
-
@search = search
|
66
|
-
@directory = directory
|
67
|
-
@output = output
|
68
|
-
@consumer_key = consumer_key
|
69
|
-
@access_token = access_token
|
70
|
-
@address = address
|
71
|
-
@request = request
|
72
|
-
@http = http
|
73
|
-
@response = response
|
74
|
-
end
|
75
|
-
|
76
|
-
def prepare
|
77
|
-
setup_credentials
|
78
|
-
get_directory
|
79
|
-
change_dir
|
80
|
-
get_search
|
81
|
-
establish_connection
|
82
|
-
end
|
83
|
-
|
84
|
-
def establish_connection
|
85
|
-
setup_address
|
86
|
-
setup_http
|
87
|
-
build_request
|
88
|
-
issue_request
|
89
|
-
get_output
|
90
|
-
end
|
91
|
-
|
92
|
-
private
|
93
|
-
|
94
|
-
def setup_credentials
|
95
|
-
decide
|
96
|
-
|
97
|
-
@consumer_key = OAuth::Consumer.new(ENV["CONSUMER_KEY"], ENV["CONSUMER_SECRET"])
|
98
|
-
|
99
|
-
@access_token = OAuth::Token.new(ENV["ACCESS_TOKEN"], ENV["ACCESS_SECRET"])
|
100
|
-
end
|
101
|
-
|
102
|
-
def decide
|
103
|
-
puts "Would your like to update your Twitter credentials now? [y/n]"
|
104
|
-
decision = gets.chomp
|
105
|
-
|
106
|
-
if decision == "y"
|
107
|
-
puts "Please enter your Consumer Key: "
|
108
|
-
ENV["CONSUMER_KEY"] = gets.chomp
|
109
|
-
puts "Please enter your Consumer Secret: "
|
110
|
-
ENV["CONSUMER_SECRET"] = gets.chomp
|
111
|
-
|
112
|
-
puts "Please enter your Access Token: "
|
113
|
-
ENV["ACCESS_TOKEN"] = gets.chomp
|
114
|
-
puts "Please enter your Access Secret: "
|
115
|
-
ENV["ACCESS_SECRET"] = gets.chomp
|
116
|
-
elsif decision == "n"
|
117
|
-
else
|
118
|
-
puts "Wrong answer, please select [y/n]"
|
119
|
-
decide
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def setup_http
|
124
|
-
# Set up Net::HTTP to use SSL, which is required by Twitter.
|
125
|
-
@http = Net::HTTP.new(address.host, address.port)
|
126
|
-
http.use_ssl = true
|
127
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
128
|
-
end
|
129
|
-
|
130
|
-
def build_request
|
131
|
-
# Build the request and authorize it with OAuth.
|
132
|
-
@request = Net::HTTP::Get.new(address.request_uri)
|
133
|
-
request.oauth!(http, consumer_key, access_token)
|
134
|
-
end
|
135
|
-
|
136
|
-
def issue_request
|
137
|
-
# Issue the request and return the response.
|
138
|
-
http.start
|
139
|
-
@response = http.request(request)
|
140
|
-
end
|
141
|
-
|
142
|
-
def get_output
|
143
|
-
@output = JSON.parse(response.body)
|
144
|
-
end
|
145
|
-
|
146
|
-
def setup_address
|
147
|
-
@address = URI("https://api.twitter.com/1.1/search/tweets.json?q=%23#{search}&mode=photos&count=100")
|
148
|
-
end
|
149
|
-
|
150
|
-
def get_directory
|
151
|
-
puts "Please enter the absolute path to the directory to save the images in: "
|
152
|
-
@directory = gets.chomp
|
153
|
-
raise StandardError, "Directory doesn't exist" unless Dir.exists?(@directory)
|
154
|
-
end
|
155
|
-
|
156
|
-
def change_dir
|
157
|
-
Dir.chdir(@directory)
|
158
|
-
end
|
159
|
-
|
160
|
-
def get_search
|
161
|
-
puts "Please enter the search terms: "
|
162
|
-
@search = gets.chomp.gsub(/\s/, "%20")
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
if $0 == __FILE__
|
167
|
-
settings = Settings.new
|
168
|
-
images = Images.new(settings)
|
169
|
-
ImageDownloader.new(settings, images).download
|
170
|
-
end
|
171
|
-
end
|
8
|
+
require "twitter_images/configuration"
|
9
|
+
require "twitter_images/downloader"
|
10
|
+
require "twitter_images/cli"
|
11
|
+
require "twitter_images/version"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter_images
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Zabelin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fileutils
|
@@ -31,6 +31,9 @@ dependencies:
|
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.8.2
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.8.2
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -38,11 +41,17 @@ dependencies:
|
|
38
41
|
- - "~>"
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: 1.8.2
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.8.2
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: oauth
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.4'
|
54
|
+
- - ">="
|
46
55
|
- !ruby/object:Gem::Version
|
47
56
|
version: 0.4.7
|
48
57
|
type: :runtime
|
@@ -50,6 +59,9 @@ dependencies:
|
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
61
|
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0.4'
|
64
|
+
- - ">="
|
53
65
|
- !ruby/object:Gem::Version
|
54
66
|
version: 0.4.7
|
55
67
|
- !ruby/object:Gem::Dependency
|
@@ -57,6 +69,9 @@ dependencies:
|
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
58
70
|
requirements:
|
59
71
|
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '1.7'
|
74
|
+
- - ">="
|
60
75
|
- !ruby/object:Gem::Version
|
61
76
|
version: 1.7.5
|
62
77
|
type: :runtime
|
@@ -64,6 +79,9 @@ dependencies:
|
|
64
79
|
version_requirements: !ruby/object:Gem::Requirement
|
65
80
|
requirements:
|
66
81
|
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.7'
|
84
|
+
- - ">="
|
67
85
|
- !ruby/object:Gem::Version
|
68
86
|
version: 1.7.5
|
69
87
|
- !ruby/object:Gem::Dependency
|
@@ -98,30 +116,44 @@ dependencies:
|
|
98
116
|
name: rspec
|
99
117
|
requirement: !ruby/object:Gem::Requirement
|
100
118
|
requirements:
|
101
|
-
- - "
|
119
|
+
- - "~>"
|
102
120
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
121
|
+
version: '3.4'
|
104
122
|
type: :development
|
105
123
|
prerelease: false
|
106
124
|
version_requirements: !ruby/object:Gem::Requirement
|
107
125
|
requirements:
|
108
|
-
- - "
|
126
|
+
- - "~>"
|
109
127
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
128
|
+
version: '3.4'
|
111
129
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
130
|
+
name: codeclimate-test-reporter
|
113
131
|
requirement: !ruby/object:Gem::Requirement
|
114
132
|
requirements:
|
115
133
|
- - "~>"
|
116
134
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0
|
135
|
+
version: '0'
|
118
136
|
type: :development
|
119
137
|
prerelease: false
|
120
138
|
version_requirements: !ruby/object:Gem::Requirement
|
121
139
|
requirements:
|
122
140
|
- - "~>"
|
123
141
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0
|
142
|
+
version: '0'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: rspec_junit_formatter
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - '='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 0.2.2
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - '='
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: 0.2.2
|
125
157
|
description: |-
|
126
158
|
A CLI tool that downloads the most recent images from twitter based on the search terms provided. Please remember that you need to provide your own
|
127
159
|
consumer key and consumer secret as well as the access token and access token secret. You
|
@@ -134,19 +166,15 @@ executables:
|
|
134
166
|
extensions: []
|
135
167
|
extra_rdoc_files: []
|
136
168
|
files:
|
137
|
-
- ".gitignore"
|
138
|
-
- ".rspec"
|
139
|
-
- ".ruby-version"
|
140
|
-
- ".travis.yml"
|
141
|
-
- Gemfile
|
142
|
-
- README.md
|
143
|
-
- Rakefile
|
144
169
|
- bin/twitter_images
|
145
170
|
- lib/twitter_images.rb
|
171
|
+
- lib/twitter_images/cli.rb
|
172
|
+
- lib/twitter_images/configuration.rb
|
173
|
+
- lib/twitter_images/downloader.rb
|
146
174
|
- lib/twitter_images/version.rb
|
147
|
-
|
148
|
-
|
149
|
-
|
175
|
+
homepage: https://github.com/alexeyzab/twitter_images
|
176
|
+
licenses:
|
177
|
+
- MIT
|
150
178
|
metadata:
|
151
179
|
allowed_push_host: https://rubygems.org
|
152
180
|
post_install_message:
|
@@ -155,9 +183,9 @@ require_paths:
|
|
155
183
|
- lib
|
156
184
|
required_ruby_version: !ruby/object:Gem::Requirement
|
157
185
|
requirements:
|
158
|
-
- - "
|
186
|
+
- - "~>"
|
159
187
|
- !ruby/object:Gem::Version
|
160
|
-
version: '0'
|
188
|
+
version: '2.0'
|
161
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
190
|
requirements:
|
163
191
|
- - ">="
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.2.1
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# TwitterImages
|
2
|
-
|
3
|
-
[![Build Status](https://travis-ci.org/Alehanz/twitter_images.svg?branch=master)](https://travis-ci.org/Alehanz/twitter_images) [![Coverage Status](https://coveralls.io/repos/Alehanz/twitter_images/badge.svg)](https://coveralls.io/r/Alehanz/twitter_images) [![Gem Version](https://badge.fury.io/rb/twitter_images.svg)](http://badge.fury.io/rb/twitter_images)
|
4
|
-
|
5
|
-
This is a CLI tool for downloading the most recent images off of twitter based
|
6
|
-
on the search terms you provide.
|
7
|
-
|
8
|
-
## Installation
|
9
|
-
|
10
|
-
Execute this in the terminal:
|
11
|
-
|
12
|
-
$ gem install twitter_images
|
13
|
-
|
14
|
-
## Usage
|
15
|
-
|
16
|
-
In order to use this gem you have to set up your Twitter credentials.
|
17
|
-
You can get those at [Twitter app management page](https://apps.twitter.com/).
|
18
|
-
Create a new app, go to Keys and Access Tokens, generate your Access Token.
|
19
|
-
|
20
|
-
Then you can either set up
|
21
|
-
|
22
|
-
CONSUMER_KEY
|
23
|
-
CONSUMER_SECRET
|
24
|
-
ACCESS_TOKEN
|
25
|
-
ACCESS_SECRET
|
26
|
-
|
27
|
-
in your .bashrc, .bash_profile, .zshenv or whichever shell config you normally
|
28
|
-
use or you can just run
|
29
|
-
|
30
|
-
$ twitter_images
|
31
|
-
|
32
|
-
and set those up through the command prompts.
|
33
|
-
|
34
|
-
After that you'll need to specify an absolute path to the folder you want to
|
35
|
-
save your images to and specify search terms.
|
36
|
-
|
37
|
-
## Development
|
38
|
-
|
39
|
-
After checking out the repo, run `bundle` to install dependencies.
|
40
|
-
|
41
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
42
|
-
|
43
|
-
## Contributing
|
44
|
-
|
45
|
-
1. Fork it ( https://github.com/[my-github-username]/twitter_images/fork )
|
46
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
47
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
48
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
49
|
-
5. Create a new Pull Request
|
data/Rakefile
DELETED
data/twitter_images.gemspec
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'twitter_images/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "twitter_images"
|
8
|
-
spec.version = TwitterImages::VERSION
|
9
|
-
spec.authors = ["Alexey Zabelin"]
|
10
|
-
spec.email = ["zabelin.alex@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{A CLI tool that downloads the most recent images from twitter based on the search terms provided}
|
13
|
-
spec.description = %q{A CLI tool that downloads the most recent images from twitter based on the search terms provided. Please remember that you need to provide your own
|
14
|
-
consumer key and consumer secret as well as the access token and access token secret. You
|
15
|
-
can find those over here: https://apps.twitter.com Just create a placeholder app
|
16
|
-
and generate the required credentials.}
|
17
|
-
spec.homepage = "https://github.com/Alehanz/twitter_images"
|
18
|
-
|
19
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
|
-
spec.require_paths = ["lib"]
|
22
|
-
|
23
|
-
if spec.respond_to?(:metadata)
|
24
|
-
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
25
|
-
end
|
26
|
-
|
27
|
-
spec.add_dependency "fileutils", "~> 0.7"
|
28
|
-
spec.add_dependency "json", "~> 1.8.2"
|
29
|
-
spec.add_dependency "oauth", "~> 0.4.7"
|
30
|
-
spec.add_dependency "ruby-progressbar", "~> 1.7.5"
|
31
|
-
|
32
|
-
spec.add_development_dependency "bundler", "~> 1.8"
|
33
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
-
spec.add_development_dependency "rspec"
|
35
|
-
spec.add_development_dependency "coveralls", "~> 0.8.1"
|
36
|
-
end
|