sunflower 0.3 → 0.4

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/scripts/wanted.rb CHANGED
@@ -1,72 +1,72 @@
1
- # coding: utf-8
2
-
3
- require 'sunflower.rb'
4
- require 'pp'
5
-
6
- s=Sunflower.new('pl.wikipedia.org')
7
- print "Logging in to #{s.wikiURL}... "
8
- #s.login
9
- print "done!\n"
10
-
11
- # EDIT SUMMARY BELOW
12
- $summary='aktualizacja'
13
-
14
-
15
-
16
-
17
- $all=File.open('wantedpages-20110211.txt', 'rb'){|f| f.read.force_encoding 'UTF-8'}.split(/\r?\n/).map{|ln| a=ln.split("\t"); a[1]=a[1].to_i; a}
18
-
19
- puts "Lock'd and loaded"
20
-
21
- def get a, b
22
- a,b=a.to_i, b.to_i
23
- $all.select{|name, count| count.between? a,b}.map{|name, count| "* [[#{name}]] - #{count}"}.join "\n"
24
- end
25
-
26
-
27
- ranges=[
28
- 100..9999,
29
- 50..99,
30
- 40..49,
31
- 30..39,
32
- 25..29,
33
- 22..24,
34
- 20..21,
35
- 18..19,
36
- 16..17,
37
- 15, 14, 13, 12, 11, 10,
38
- 9, 8, 7, 6, 5
39
- ]
40
-
41
- kat='A'
42
-
43
- ranges.each do |rng|
44
- if rng.is_a?(Range)
45
- a,b = rng.begin, rng.end
46
- else
47
- a,b = rng, rng
48
- end
49
-
50
- n="#{a}-#{b}"
51
- n="#{a}+" if b==9999
52
- n="#{a}" if b==a
53
-
54
- intro=<<EOF
55
- Na tej stronie znajdują się najbardziej potrzebne strony, do których linki pojawiają się na #{n} stronach. Bazę utworzył Saper w lutym 2011 roku ([http://toolserver.org/~saper/wantedpages-20110211.txt pełna lista, ok. 37 MB]).
56
-
57
- ''Po prawej podana jest liczba dolinkowanych. Niebieskie linki do wycięcia. Czerwone do ewentualnego przenoszenia na podstrony [[Wikipedia:Brakujące hasła|brakujących haseł]].''
58
-
59
- [[Kategoria:Najbardziej potrzebne strony| #{kat}]]
60
- EOF
61
-
62
- title="Wikipedia:Propozycje tematów/Najbardziej potrzebne #{n} #{b==24 ? 'linki' : 'linków'}"
63
-
64
- File.open(n+'.txt', 'wb'){|f| f.write "#{intro}\n\n#{get a,b}"}
65
-
66
-
67
- kat=kat.succ
68
-
69
-
70
- puts n
71
- end
72
-
1
+ # coding: utf-8
2
+
3
+ require 'sunflower.rb'
4
+ require 'pp'
5
+
6
+ s=Sunflower.new('pl.wikipedia.org')
7
+ print "Logging in to #{s.wikiURL}... "
8
+ #s.login
9
+ print "done!\n"
10
+
11
+ # EDIT SUMMARY BELOW
12
+ $summary='aktualizacja'
13
+
14
+
15
+
16
+
17
+ $all=File.open('wantedpages-20110211.txt', 'rb'){|f| f.read.force_encoding 'UTF-8'}.split(/\r?\n/).map{|ln| a=ln.split("\t"); a[1]=a[1].to_i; a}
18
+
19
+ puts "Lock'd and loaded"
20
+
21
+ def get a, b
22
+ a,b=a.to_i, b.to_i
23
+ $all.select{|name, count| count.between? a,b}.map{|name, count| "* [[#{name}]] - #{count}"}.join "\n"
24
+ end
25
+
26
+
27
+ ranges=[
28
+ 100..9999,
29
+ 50..99,
30
+ 40..49,
31
+ 30..39,
32
+ 25..29,
33
+ 22..24,
34
+ 20..21,
35
+ 18..19,
36
+ 16..17,
37
+ 15, 14, 13, 12, 11, 10,
38
+ 9, 8, 7, 6, 5
39
+ ]
40
+
41
+ kat='A'
42
+
43
+ ranges.each do |rng|
44
+ if rng.is_a?(Range)
45
+ a,b = rng.begin, rng.end
46
+ else
47
+ a,b = rng, rng
48
+ end
49
+
50
+ n="#{a}-#{b}"
51
+ n="#{a}+" if b==9999
52
+ n="#{a}" if b==a
53
+
54
+ intro=<<EOF
55
+ Na tej stronie znajdują się najbardziej potrzebne strony, do których linki pojawiają się na #{n} stronach. Bazę utworzył Saper w lutym 2011 roku ([http://toolserver.org/~saper/wantedpages-20110211.txt pełna lista, ok. 37 MB]).
56
+
57
+ ''Po prawej podana jest liczba dolinkowanych. Niebieskie linki do wycięcia. Czerwone do ewentualnego przenoszenia na podstrony [[Wikipedia:Brakujące hasła|brakujących haseł]].''
58
+
59
+ [[Kategoria:Najbardziej potrzebne strony| #{kat}]]
60
+ EOF
61
+
62
+ title="Wikipedia:Propozycje tematów/Najbardziej potrzebne #{n} #{b==24 ? 'linki' : 'linków'}"
63
+
64
+ File.open(n+'.txt', 'wb'){|f| f.write "#{intro}\n\n#{get a,b}"}
65
+
66
+
67
+ kat=kat.succ
68
+
69
+
70
+ puts n
71
+ end
72
+
metadata CHANGED
@@ -1,58 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sunflower
3
- version: !ruby/object:Gem::Version
4
- hash: 13
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.4'
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- version: "0.3"
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Matma Rex
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-05-12 00:00:00 Z
18
- dependencies:
19
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
20
15
  name: json
21
- prerelease: false
22
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &8696940 !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 3
28
- segments:
29
- - 0
30
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
31
22
  type: :runtime
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: rest-client
35
23
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *8696940
25
+ - !ruby/object:Gem::Dependency
26
+ name: rest-client
27
+ requirement: &8696460 !ruby/object:Gem::Requirement
37
28
  none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- hash: 3
42
- segments:
43
- - 0
44
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
45
33
  type: :runtime
46
- version_requirements: *id002
47
- description: Sunflower is a lightweight library to provide access to MediaWiki API from Ruby.
34
+ prerelease: false
35
+ version_requirements: *8696460
36
+ description: Sunflower is a lightweight library to provide access to MediaWiki API
37
+ from Ruby.
48
38
  email: matma.rex@gmail.com
49
- executables:
39
+ executables:
50
40
  - sunflower-setup
51
41
  extensions: []
52
-
53
42
  extra_rdoc_files: []
54
-
55
- files:
43
+ files:
56
44
  - README
57
45
  - LICENSE
58
46
  - bin/sunflower-setup
@@ -79,37 +67,27 @@ files:
79
67
  - scripts/wanted.rb
80
68
  homepage: http://github.com/MatmaRex/Sunflower
81
69
  licenses: []
82
-
83
70
  post_install_message:
84
71
  rdoc_options: []
85
-
86
- require_paths:
72
+ require_paths:
87
73
  - lib
88
- required_ruby_version: !ruby/object:Gem::Requirement
74
+ required_ruby_version: !ruby/object:Gem::Requirement
89
75
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
97
- required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
81
  none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
104
- - 0
105
- version: "0"
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
106
86
  requirements: []
107
-
108
87
  rubyforge_project:
109
- rubygems_version: 1.7.1
88
+ rubygems_version: 1.8.15
110
89
  signing_key:
111
90
  specification_version: 3
112
- summary: Sunflower is a lightweight library to provide access to MediaWiki API from Ruby.
91
+ summary: Sunflower is a lightweight library to provide access to MediaWiki API from
92
+ Ruby.
113
93
  test_files: []
114
-
115
- has_rdoc: