commons_upload 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/lib/commons_upload.rb +8 -4
- data/lib/commons_upload/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec4c4489abecc8ff21164e7dbe44b616bca91f15
|
4
|
+
data.tar.gz: 286fbc7b885b0477bdd56c253836f1177289d750
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c24fe067e0e7a51f74bc37a969c6d3d3722e13cf4d421f8a6c7db23036eb516d9dd67a099a31e825c3e64490cac44ba0c70d460e27f4edbe3d90aaddfecebf8
|
7
|
+
data.tar.gz: 111b64c829ac4f7b1bc5cc6bf472ef569a9baace915c67da5c53b92eea6f7b3f8c52ac4b7e9dfca97774f5e7375b054603c875bd86d986c09d72284d6ac1b938
|
data/lib/commons_upload.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
require 'commons_upload/version'
|
2
2
|
|
3
3
|
module CommonsUpload
|
4
|
-
def self.license(
|
4
|
+
def self.license(file_name)
|
5
5
|
require 'date'
|
6
|
+
|
6
7
|
date = Date.today.to_s
|
8
|
+
|
9
|
+
category = ENV['LANGUAGE_SCREENSHOT_CATEGORY']
|
10
|
+
language_code = ENV['LANGUAGE_SCREENSHOT_CODE']
|
11
|
+
|
7
12
|
"=={{int:filedesc}}==
|
8
13
|
{{Information
|
9
14
|
|description={{en|1=#{file_name}}}
|
@@ -18,13 +23,12 @@ module CommonsUpload
|
|
18
23
|
=={{int:license-header}}==
|
19
24
|
{{Wikipedia-screenshot}}
|
20
25
|
|
21
|
-
[[Category
|
26
|
+
[[Category:#{category}/#{language_code}]]"
|
22
27
|
end
|
23
28
|
|
24
29
|
def self.image(file_path, client)
|
25
|
-
language_code = ENV['LANGUAGE_SCREENSHOT_CODE']
|
26
30
|
file_name = File.basename(file_path, '')
|
27
|
-
file_license = license(
|
31
|
+
file_license = license(file_name)
|
28
32
|
|
29
33
|
client.upload_image(file_name, file_path, file_license, true)
|
30
34
|
sleep 5 # Restriction in bot speed: https://commons.wikimedia.org/wiki/Commons:Bots#Bot_speed
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commons_upload
|
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
|
- Vikas Yaligar
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-06-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mediawiki_api
|