twog 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +0 -20
- data/VERSION.yml +3 -3
- data/bin/twog +22 -16
- data/twog.gemspec +1 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -4,26 +4,6 @@ require 'rake/gempackagetask'
|
|
4
4
|
|
5
5
|
|
6
6
|
namespace :twog do
|
7
|
-
desc "Generate .twog.yaml file"
|
8
|
-
task :conf_create do
|
9
|
-
AUTH_FILE_NAME = "#{ENV['HOME']}/.twog.yaml"
|
10
|
-
|
11
|
-
AUTH_CONFIG_FILE = <<-EOS
|
12
|
-
rss_feed: 'http://url.com/feed.rss'
|
13
|
-
consumer_key: 'consumer key'
|
14
|
-
consumer_secret: 'consumer secret'
|
15
|
-
access_token: 'access token'
|
16
|
-
access_secret: 'access secret'
|
17
|
-
bitly_username: 'username'
|
18
|
-
bitly_api_key: 'api key'
|
19
|
-
last_blog_post_tweeted:
|
20
|
-
EOS
|
21
|
-
|
22
|
-
abort "#{ENV['HOME']}/.twog.yaml already exists" if File.exists?(AUTH_FILE_NAME)
|
23
|
-
|
24
|
-
File.open(AUTH_FILE_NAME, 'w') {|f| f.write(AUTH_CONFIG_FILE) }
|
25
|
-
end
|
26
|
-
|
27
7
|
desc "Clean out the coverage and the pkg"
|
28
8
|
task :clean do
|
29
9
|
rm_rf 'coverage'
|
data/VERSION.yml
CHANGED
data/bin/twog
CHANGED
@@ -5,12 +5,19 @@ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
|
5
5
|
require 'twog'
|
6
6
|
require 'optparse'
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
options = {}
|
9
|
+
opts = OptionParser.new do |opts|
|
10
|
+
opts.banner = "Twog is a tool to tweet blog posts"
|
10
11
|
|
11
|
-
|
12
|
+
opts.on("--version", "Display current version") do
|
13
|
+
puts "Twog " + Twog.version
|
14
|
+
exit 0
|
15
|
+
end
|
12
16
|
|
13
|
-
|
17
|
+
opts.on("--conf", "Create default conf file") do
|
18
|
+
AUTH_FILE_NAME = "#{ENV['HOME']}/.twog.yaml"
|
19
|
+
|
20
|
+
AUTH_CONFIG_FILE = <<-EOS
|
14
21
|
rss_feed: 'http://url.com/feed.rss'
|
15
22
|
consumer_key: 'consumer key'
|
16
23
|
consumer_secret: 'consumer secret'
|
@@ -19,15 +26,15 @@ Twog is a tool to tweet blog posts.
|
|
19
26
|
bitly_username: 'username'
|
20
27
|
bitly_api_key: 'api key'
|
21
28
|
last_blog_post_tweeted:
|
29
|
+
EOS
|
22
30
|
|
23
|
-
|
31
|
+
if File.exists?(AUTH_FILE_NAME)
|
32
|
+
puts "#{ENV['HOME']}/.twog.yaml already exists"
|
33
|
+
exit 0
|
34
|
+
end
|
24
35
|
|
25
|
-
|
26
|
-
|
27
|
-
opts.banner = help
|
28
|
-
|
29
|
-
opts.on("--version", "Display current version") do
|
30
|
-
puts "Jekyll " + Twog.version
|
36
|
+
File.open(AUTH_FILE_NAME, 'w') {|f| f.write(AUTH_CONFIG_FILE) }
|
37
|
+
puts "Default configuration file created at ~/.twog.yaml"
|
31
38
|
exit 0
|
32
39
|
end
|
33
40
|
end
|
@@ -36,13 +43,12 @@ end
|
|
36
43
|
opts.parse!
|
37
44
|
|
38
45
|
# Get args from the command line
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
exit(1)
|
46
|
+
if ARGV.size > 1
|
47
|
+
puts "Invalid options. Run `twog --help` for assistance."
|
48
|
+
exit(1)
|
43
49
|
end
|
44
50
|
|
45
|
-
raise "please run '
|
51
|
+
raise "please run 'twog --conf' to create the ~/.twog.yaml file" unless File.exists?("#{ENV['HOME']}/.twog.yaml")
|
46
52
|
conf = YAML.load_file("#{ENV['HOME']}/.twog.yaml")
|
47
53
|
|
48
54
|
Twog.run(conf)
|
data/twog.gemspec
CHANGED