curate_tumblr 1.0.6 → 1.0.7
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/README.md +6 -3
- data/curate_tumblr.gemspec +1 -1
- data/lib/curate_tumblr/curator.rb +20 -18
- data/spec/factories.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -225,13 +225,16 @@ and *reblog_post_key* to reblog it in CurateTumblr::Publish::Reblog
|
|
225
225
|
|
226
226
|
## Versions ##
|
227
227
|
|
228
|
-
|
228
|
+
v1.0.7
|
229
|
+
* Better check config file
|
230
|
+
|
231
|
+
v1.0.6
|
229
232
|
* Better error messages if no oauth in config file
|
230
233
|
|
231
|
-
|
234
|
+
v1.0.5
|
232
235
|
* Stop if Tumblr error "Not Authorized" (bad oauth)
|
233
236
|
|
234
|
-
|
237
|
+
v1.0.4
|
235
238
|
* Better error messages if problem with directories or config file
|
236
239
|
|
237
240
|
|
data/curate_tumblr.gemspec
CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |gem|
|
|
2
2
|
gem.add_dependency 'tumblr_client'
|
3
3
|
gem.add_dependency 'logger'
|
4
4
|
gem.name = 'curate_tumblr'
|
5
|
-
gem.version = '1.0.
|
5
|
+
gem.version = '1.0.7'
|
6
6
|
gem.authors = ['David Tysman']
|
7
7
|
gem.description = 'CurateTumblr - reblog and follow Tumblr links, extract infos from the posts, add tags and links'
|
8
8
|
gem.summary = 'Reblog and follow Tumblr'
|
@@ -88,24 +88,12 @@ module CurateTumblr
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def check_config_files
|
91
|
-
if !
|
92
|
-
|
93
|
-
|
94
|
-
if !
|
95
|
-
|
96
|
-
|
97
|
-
if !Dir.exists?( get_path_links )
|
98
|
-
return error_config( "The directory #{get_path_links} doesn't exist", "You need it for set the links to follow and reblog. \nPlease create it or change the path." )
|
99
|
-
end
|
100
|
-
if !Dir.exists?( get_path_logs )
|
101
|
-
return error_config( "The directory #{get_path_logs} doesn't exist", "The application needs it for write logs. \nPlease create it or change the path." )
|
102
|
-
end
|
103
|
-
if !File.exists?( get_filename_config )
|
104
|
-
return error_config( "The config file #{get_filename_config} doesn't exist", "You need it for set oauth tokens. \nPlease create it or change the path." )
|
105
|
-
end
|
106
|
-
if !File.exists?( get_filename_links )
|
107
|
-
return error_config( "The file #{get_filename_links} doesn't exist", "You need it for set the links to reblog. \nPlease create it or change the path." )
|
108
|
-
end
|
91
|
+
return false if !check_config_dir( @directory, "You need it for your tumblrs subdirectories." )
|
92
|
+
return false if !check_config_dir( get_path_tumblr, "You need it for your tumblr links and config." )
|
93
|
+
return false if !check_config_dir( get_path_links, "You need it for set the links to follow and reblog." )
|
94
|
+
return false if !check_config_dir( get_path_logs, "The application needs it for write logs." )
|
95
|
+
return false if !check_config_file( get_filename_config, "You need it for set oauth tokens." )
|
96
|
+
return false if !check_config_file( get_filename_links, "You need it for set the links to reblog." )
|
109
97
|
return false if !check_config_key( Tumblr::Client::HASH_CONFIG_CLIENT_OAUTH, "you need to write it in config file to write inside the oauth tokens to send requests to Tumblr", false )
|
110
98
|
return false if !check_config_key( Tumblr::Client::HASH_CONFIG_CLIENT_OAUTH_CONSUMER_KEY, "you need to write it inside '#{Tumblr::Client::HASH_CONFIG_CLIENT_OAUTH}' in config file to send requests to Tumblr" )
|
111
99
|
return false if !check_config_key( Tumblr::Client::HASH_CONFIG_CLIENT_OAUTH_CONSUMER_SECRET, "you need to write it inside '#{Tumblr::Client::HASH_CONFIG_CLIENT_OAUTH}' in config file to send requests to Tumblr" )
|
@@ -114,6 +102,20 @@ module CurateTumblr
|
|
114
102
|
true
|
115
103
|
end
|
116
104
|
|
105
|
+
def check_config_dir( dir, about )
|
106
|
+
if !Dir.exists?( dir )
|
107
|
+
return error_config( "The directory #{dir} doesn't exist", about + "\nPlease create it or change the path." )
|
108
|
+
end
|
109
|
+
true
|
110
|
+
end
|
111
|
+
|
112
|
+
def check_config_file( file, about )
|
113
|
+
if !File.exists?( file )
|
114
|
+
return error_config( "The file #{file} doesn't exist", about + "\nPlease create it or change the path." )
|
115
|
+
end
|
116
|
+
true
|
117
|
+
end
|
118
|
+
|
117
119
|
def check_config_key( key, about, is_check_empty=true )
|
118
120
|
ar_key = []
|
119
121
|
File.open( get_filename_config, "r" ) do |file_config|
|
data/spec/factories.rb
CHANGED