fuli 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 435e2aab58234ac0642665fd08c596b39485e851
4
+ data.tar.gz: e0169cf0f2c7e9037f01fe501c755afe969babf9
5
+ SHA512:
6
+ metadata.gz: 11671b49b5125c7cee541b3420d890e9d62dbead5e1ac64bd5df92bb52a30aa84ecc4686509d40fcb767eb245fa79c9e880a3c41debf08bb037d7f066bb88731
7
+ data.tar.gz: e0375fdaa24cd6cabc4b3a89b660691f502500cd7db32e6bbab9d3133b5d7e9b36126090b12174bda901b765e9565ffcb21cdc667604151f0eb0001d521a418d
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at adam_ruby@126.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fuli.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 adamshen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,16 @@
1
+ # Fuli
2
+
3
+ $ gem install fuli
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ fuli rosi 期号
9
+ ```
10
+
11
+ 比如可以试试
12
+ ```bash
13
+ ruli rosi 1600
14
+ ```
15
+
16
+ 看看会发生设么?
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fuli'
4
+ Fuli::Cli.start
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fuli/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fuli"
8
+ spec.version = Fuli::VERSION
9
+ spec.authors = ["adamshen"]
10
+ spec.email = ["adam_ruby@126.com"]
11
+
12
+ spec.summary = %q{fuli}
13
+ spec.description = %q{just a useless tool, don't care about it.}
14
+ spec.homepage = "https://github.com/adamshen/fuli"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.executables = %w[fuli]
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "thor", "~> 0.19"
22
+ spec.add_development_dependency "bundler", "~> 1.12"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "minitest", "~> 5.0"
25
+ end
@@ -0,0 +1,9 @@
1
+ require 'open-uri'
2
+ require 'thor'
3
+
4
+ require "fuli/version"
5
+ require "fuli/rosi"
6
+ require "fuli/cli"
7
+
8
+ module Fuli
9
+ end
@@ -0,0 +1,18 @@
1
+ module Fuli
2
+ class Cli < Thor
3
+
4
+ desc "rosi NUM", "download rosi pic of rosi_no"
5
+
6
+ def rosi(no)
7
+ unless no.to_i > 0 && no.to_i < 2000
8
+ puts "wrong number"
9
+ return
10
+ end
11
+
12
+ no = "%03d" % no
13
+
14
+ `mkdir ROSI_NO_#{no}`
15
+ Rosi.fetch(no)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,44 @@
1
+ require 'timeout'
2
+
3
+ module Fuli
4
+ class Rosi
5
+ class << self
6
+ def fetch(no)
7
+
8
+ begin
9
+ get_rosi_pic(no)
10
+ rescue Timeout::Error => err
11
+ puts "Timeout"
12
+ return
13
+ rescue OpenURI::HTTPError => err
14
+ puts "Finish!"
15
+ return
16
+ end
17
+ end
18
+
19
+ private
20
+ def get_rosi_pic(no)
21
+ i = 1
22
+ loop do
23
+ Timeout::timeout(60) {
24
+ n = "%03d" % i
25
+
26
+ open("http://rosi.wangyunsheng.com/rosi/tu/NO.#{no}/rosi-#{no}-#{n}.jpg") do |f|
27
+ puts "Start fetching rosi-#{no}-#{n}.jpg"
28
+
29
+ File.open("ROSI_NO_#{no}/#{n}.jpg", "wb") do |file|
30
+ file.puts f.read
31
+ end
32
+
33
+ puts "Done!"
34
+ end
35
+
36
+ i += 1
37
+ }
38
+
39
+ sleep 5
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,3 @@
1
+ module Fuli
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fuli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - adamshen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-05-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.19'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.19'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description: just a useless tool, don't care about it.
70
+ email:
71
+ - adam_ruby@126.com
72
+ executables:
73
+ - fuli
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - CODE_OF_CONDUCT.md
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - bin/fuli
84
+ - fuli.gemspec
85
+ - lib/fuli.rb
86
+ - lib/fuli/cli.rb
87
+ - lib/fuli/rosi.rb
88
+ - lib/fuli/version.rb
89
+ homepage: https://github.com/adamshen/fuli
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.5.1
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: fuli
113
+ test_files: []
114
+ has_rdoc: