commons_upload 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 220a6d880d7f599d5877448ba6c416f08c0369fe
4
- data.tar.gz: 88f620a259a641a37fb363d6f4cdd9babcaab523
3
+ metadata.gz: 59c6cb690c3ebe17b0d6f122911e921aaf90b362
4
+ data.tar.gz: def47ee87cada35f47213d33a1731c2d0d30f249
5
5
  SHA512:
6
- metadata.gz: 9909f9dfb1cad5278f26cc76b7f54a51469021e73da21dc51de7d21d76961046c9fc3cbf79cb36c6cd792df27392e34d8d826d52004b2751ffb6915bba5e87e5
7
- data.tar.gz: 01896a1ef00eff52e15544f1e6207b721ad0fd2880b621b3e67504796834bad12c8c332d257840b2f3ce71af0e05a4fe23175a7b376f1d3fd7e744af0579bb7e
6
+ metadata.gz: e91615fdf0aab49da3c954bcc3d680e12a707bff5c4521e2a95a92236a1aec927d5cc81a5f609e53bc6b0c6ce82a40dce665c5e4bd8af4449d2d2cae640527e3
7
+ data.tar.gz: d5db3566d2270c4bb5c4d6b5c5cffe0a1a4d37db41e5d7c24e296b199cbffd3bedcbb9aa8f46443da7dae409f4ac994ee4290e5763bcc1c4aad6bd4698c95348
data/.gitignore CHANGED
@@ -11,6 +11,7 @@ doc/
11
11
  lib/bundler/man
12
12
  pkg
13
13
  rdoc
14
+ screenshots
14
15
  spec/reports
15
16
  test/tmp
16
17
  test/version_tmp
data/.rubocop.yml CHANGED
@@ -1,5 +1,9 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ # Needed for ignoring leading whitespace in heredoc
4
+ AllCops:
5
+ TargetRubyVersion: 2.3
6
+
3
7
  # The default is 15, which is too tight
4
8
  Metrics/AbcSize:
5
9
  Max: 30
data/.rubocop_todo.yml CHANGED
@@ -1,19 +1,35 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2015-02-19 13:40:14 +0200 using RuboCop version 0.29.1.
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-08-22 17:24:35 +0200 using RuboCop version 0.42.0.
3
4
  # The point is for the user to remove these configuration records
4
5
  # one by one as the offenses are removed from the code base.
5
6
  # Note that changes in the inspected code, or installation of new
6
7
  # versions of RuboCop, may require this file to be generated again.
7
8
 
8
- # Offense count: 2
9
+ # Offense count: 1
9
10
  Style/Documentation:
10
- Enabled: false
11
+ Exclude:
12
+ - 'spec/**/*'
13
+ - 'test/**/*'
14
+ - 'lib/commons_upload.rb'
11
15
 
12
- # Offense count: 2
13
- Style/RegexpLiteral:
14
- MaxSlashes: 0
16
+ # Offense count: 6
17
+ # Cop supports --auto-correct.
18
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
19
+ # SupportedStyles: when_needed, always
20
+ Style/FrozenStringLiteralComment:
21
+ Exclude:
22
+ - 'Gemfile'
23
+ - 'Rakefile'
24
+ - 'bin/upload'
25
+ - 'commons_upload.gemspec'
26
+ - 'lib/commons_upload.rb'
27
+ - 'lib/commons_upload/version.rb'
15
28
 
16
29
  # Offense count: 1
17
30
  # Cop supports --auto-correct.
31
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
32
+ # SupportedStyles: use_perl_names, use_english_names
18
33
  Style/SpecialGlobalVars:
19
- Enabled: false
34
+ Exclude:
35
+ - 'commons_upload.gemspec'
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.0
3
+ - 2.3.0
4
4
  install: bundle install
5
5
  script:
6
6
  - bundle exec rubocop
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2015 Vikas Yaligar, Željko Filipin and Amir E. Aharoni
1
+ Copyright (c) 2014-2016 Vikas Yaligar, Željko Filipin and Amir E. Aharoni
2
2
  under the terms of The MIT License (MIT), as follows:
3
3
 
4
4
  This software consists of voluntary contributions made by many
data/README.md CHANGED
@@ -23,7 +23,18 @@ Or install it yourself as:
23
23
  ## Usage
24
24
 
25
25
  To run the upload, do
26
- ```bundle exec upload```
26
+
27
+ # optional, the default is ./screenshots
28
+ export LANGUAGE_SCREENSHOT_PATH=./screenshots
29
+
30
+ # testing: https://commons.wikimedia.beta.wmflabs.org/w/api.php
31
+ # production: https://commons.wikimedia.org/w/api.php
32
+ export MEDIAWIKI_API_UPLOAD_URL=https://commons.wikimedia.beta.wmflabs.org/w/api.php
33
+
34
+ export MEDIAWIKI_USER=LanguageScreenshotBot
35
+ export MEDIAWIKI_PASSWORD=not-the-real-one
36
+
37
+ bundle exec upload
27
38
 
28
39
  ## Contributing
29
40
 
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ['lib']
21
21
  spec.required_ruby_version = '~> 2.0'
22
22
 
23
- spec.add_runtime_dependency 'mediawiki_api', '~> 0.4', '>= 0.4.1'
23
+ spec.add_runtime_dependency 'mediawiki_api', '~> 0.7.0'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.3'
26
26
  spec.add_development_dependency 'rake', '~> 10.1'
27
- spec.add_development_dependency 'rubocop', '~> 0.33'
27
+ spec.add_development_dependency 'rubocop', '~> 0.42.0'
28
28
  end
@@ -1,29 +1,30 @@
1
- require 'commons_upload/version'
2
-
3
1
  module CommonsUpload
4
2
  def self.license(file_name)
5
3
  require 'date'
6
-
7
4
  date = Date.today.to_s
8
5
 
9
- category = ENV['LANGUAGE_SCREENSHOT_CATEGORY']
10
- language_code = ENV['LANGUAGE_SCREENSHOT_CODE']
11
-
12
- "=={{int:filedesc}}==
13
- {{Information
14
- |description={{en|1=#{file_name}}}
15
- |date=#{date}
16
- |source=[[User:LanguageScreenshotBot|Automatically created by LanguageScreenshotBot]]
17
- |author=[[User:LanguageScreenshotBot|Automatically created by LanguageScreenshotBot]]
18
- |permission=
19
- |other_versions=
20
- |other_fields=
21
- }}
22
-
23
- =={{int:license-header}}==
24
- {{Wikipedia-screenshot}}
25
-
26
- [[Category:#{category}/#{language_code}]]"
6
+ # file_name example: VisualEditor_category_item-en.png
7
+ # language_code is the portion of the string between dash (-) and dot (.)
8
+ # in this case it is: en
9
+ language_code = file_name.split('-')[1].split('.')[0]
10
+
11
+ <<~eos
12
+ =={{int:filedesc}}==
13
+ {{Information
14
+ |description={{en|1=#{file_name}}}
15
+ |date=#{date}
16
+ |source=[[User:LanguageScreenshotBot|Automatically created by LanguageScreenshotBot]]
17
+ |author=[[User:LanguageScreenshotBot|Automatically created by LanguageScreenshotBot]]
18
+ |permission=
19
+ |other_versions=
20
+ |other_fields=
21
+ }}
22
+
23
+ =={{int:license-header}}==
24
+ {{Wikipedia-screenshot}}
25
+
26
+ [[Category:VisualEditor-#{language_code}]]
27
+ eos
27
28
  end
28
29
 
29
30
  def self.image(file_path, client)
@@ -1,3 +1,3 @@
1
1
  module CommonsUpload
2
- VERSION = '0.0.4'
2
+ VERSION = '1.0.0'.freeze
3
3
  end
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
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vikas Yaligar
@@ -10,70 +10,64 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-08-10 00:00:00.000000000 Z
13
+ date: 2016-08-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mediawiki_api
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '0.4'
22
- - - '>='
23
- - !ruby/object:Gem::Version
24
- version: 0.4.1
21
+ version: 0.7.0
25
22
  type: :runtime
26
23
  prerelease: false
27
24
  version_requirements: !ruby/object:Gem::Requirement
28
25
  requirements:
29
- - - ~>
30
- - !ruby/object:Gem::Version
31
- version: '0.4'
32
- - - '>='
26
+ - - "~>"
33
27
  - !ruby/object:Gem::Version
34
- version: 0.4.1
28
+ version: 0.7.0
35
29
  - !ruby/object:Gem::Dependency
36
30
  name: bundler
37
31
  requirement: !ruby/object:Gem::Requirement
38
32
  requirements:
39
- - - ~>
33
+ - - "~>"
40
34
  - !ruby/object:Gem::Version
41
35
  version: '1.3'
42
36
  type: :development
43
37
  prerelease: false
44
38
  version_requirements: !ruby/object:Gem::Requirement
45
39
  requirements:
46
- - - ~>
40
+ - - "~>"
47
41
  - !ruby/object:Gem::Version
48
42
  version: '1.3'
49
43
  - !ruby/object:Gem::Dependency
50
44
  name: rake
51
45
  requirement: !ruby/object:Gem::Requirement
52
46
  requirements:
53
- - - ~>
47
+ - - "~>"
54
48
  - !ruby/object:Gem::Version
55
49
  version: '10.1'
56
50
  type: :development
57
51
  prerelease: false
58
52
  version_requirements: !ruby/object:Gem::Requirement
59
53
  requirements:
60
- - - ~>
54
+ - - "~>"
61
55
  - !ruby/object:Gem::Version
62
56
  version: '10.1'
63
57
  - !ruby/object:Gem::Dependency
64
58
  name: rubocop
65
59
  requirement: !ruby/object:Gem::Requirement
66
60
  requirements:
67
- - - ~>
61
+ - - "~>"
68
62
  - !ruby/object:Gem::Version
69
- version: '0.33'
63
+ version: 0.42.0
70
64
  type: :development
71
65
  prerelease: false
72
66
  version_requirements: !ruby/object:Gem::Requirement
73
67
  requirements:
74
- - - ~>
68
+ - - "~>"
75
69
  - !ruby/object:Gem::Version
76
- version: '0.33'
70
+ version: 0.42.0
77
71
  description: Upload images to Wikimedia Commons. This is intended for uploading auto-translated
78
72
  screenshots for MediaWiki documentation.
79
73
  email:
@@ -83,10 +77,10 @@ executables:
83
77
  extensions: []
84
78
  extra_rdoc_files: []
85
79
  files:
86
- - .gitignore
87
- - .rubocop.yml
88
- - .rubocop_todo.yml
89
- - .travis.yml
80
+ - ".gitignore"
81
+ - ".rubocop.yml"
82
+ - ".rubocop_todo.yml"
83
+ - ".travis.yml"
90
84
  - Gemfile
91
85
  - LICENSE.txt
92
86
  - README.md
@@ -105,17 +99,17 @@ require_paths:
105
99
  - lib
106
100
  required_ruby_version: !ruby/object:Gem::Requirement
107
101
  requirements:
108
- - - ~>
102
+ - - "~>"
109
103
  - !ruby/object:Gem::Version
110
104
  version: '2.0'
111
105
  required_rubygems_version: !ruby/object:Gem::Requirement
112
106
  requirements:
113
- - - '>='
107
+ - - ">="
114
108
  - !ruby/object:Gem::Version
115
109
  version: '0'
116
110
  requirements: []
117
111
  rubyforge_project:
118
- rubygems_version: 2.0.3
112
+ rubygems_version: 2.5.1
119
113
  signing_key:
120
114
  specification_version: 4
121
115
  summary: Upload images to Wikimedia Commons.