-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
62 lines (53 loc) · 1.5 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
require 'rubygems'
require 'rake'
namespace :server do
desc "Start the server in a rack process"
task :start do
sh "rackup config.ru"
end
desc "Start an irb session with the server models loaded"
task :console do
sh "irb -I lib -r allofthestars/server"
end
end
desc "Start an irb session with the HTTP client loaded"
task :console do
sh "irb -I lib -r allofthestars/client"
end
namespace :import do
desc "Import a single Tweet. Needs CLUSTER_ID= and TWEET={status-id}"
task :tweet => :init do
ENV['TWEET'].to_s.split(',').each do |tweet|
tweet.strip!
import_tweet tweet.to_i
end
end
task :twitter_favorites => :init do
ENV['USER'].to_s.split(',').each do |user|
user.strip!
import_twitter_favorites user
end
end
task :instagram => :init do
#import_instagram
end
# STARS_URL - String URL to AllOfTheStars instance. Defaults to
# http://allofthestars.com
# CLUSTER_ID - String Cluster ID
# DEBUG - Add this to see what's about to be posted without
# actually importing the star.
task :init do
require 'bundler'
Bundler.setup :default, :client, :importers
$:.unshift File.expand_path("../lib", __FILE__)
require 'redis'
require 'allofthestars/client/importer'
if url = ENV['STARS_URL']
AllOfTheStars::Client.default_url = url
end
extend AllOfTheStars::Importer
self.redis = Redis.new
self.cluster_id = ENV['CLUSTER_ID']
debug! if ENV['DEBUG']
end
end