trick_or_treat 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/Gemfile.lock +0 -2
- data/LICENSE.txt +1 -1
- data/README.md +16 -40
- data/exe/trick +1 -1
- data/exe/trick_or_treat +7 -1
- data/lib/trick_or_treat/version.rb +1 -1
- data/lib/trick_or_treat.rb +3 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca2c51007c9777a57ded38b76528db6b36fc14d7607e201759af8c3584bebdf9
|
4
|
+
data.tar.gz: cb1c39d913be395a62460a20f3b84052611dbe770b2255fb789d4927a2bd0526
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d17a231d5e82ef79320c4ed3d48fb33d23abeee20e5d9fe3cf285ef6fad68032e79873eb4cb7bdaef176c910e376fb8b8fc51689b24d570799b136e534116044
|
7
|
+
data.tar.gz: 2f50a57efcfcd6caae0573e8cb7211f83aaac101816f7a6e22a1764024b421113b7eeb7450ea660381e37ddce460ec219dba031134ef7d2a704b3fb3e494e9ac
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -18,7 +18,6 @@ GEM
|
|
18
18
|
ruby-progressbar
|
19
19
|
nokogiri (1.10.4)
|
20
20
|
mini_portile2 (~> 2.4.0)
|
21
|
-
pager (1.0.1)
|
22
21
|
rake (10.5.0)
|
23
22
|
ruby-progressbar (1.10.1)
|
24
23
|
safe_yaml (1.0.5)
|
@@ -32,7 +31,6 @@ DEPENDENCIES
|
|
32
31
|
minitest (~> 5.12.0)
|
33
32
|
minitest-reporters (~> 1.3.8)
|
34
33
|
nokogiri (~> 1.10.4)
|
35
|
-
pager (~> 1.0.1)
|
36
34
|
rake (~> 10.0)
|
37
35
|
safe_yaml (~> 1.0.5)
|
38
36
|
trick_or_treat!
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,58 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
* [Installation](#installation)
|
4
|
-
* [Usage](#usage)
|
5
|
-
* [Development](#development)
|
6
|
-
* [Contributing](#contributing)
|
7
|
-
* [License](#license)
|
8
|
-
* [References](#references)
|
9
|
-
|
10
|
-
# TrickOrTreat
|
11
|
-
|
12
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/trick_or_treat`. To experiment with that code, run `bin/console` for an interactive prompt.
|
13
|
-
|
14
|
-
TODO: Delete this and the text above, and describe your gem
|
1
|
+
Trick or Treat
|
2
|
+
==============
|
15
3
|
|
16
4
|
## Installation<a href="installation"><a>
|
17
5
|
|
18
|
-
|
19
|
-
|
20
|
-
```ruby
|
21
|
-
gem 'trick_or_treat'
|
6
|
+
```bash
|
7
|
+
$ gem install trick_or_treat
|
22
8
|
```
|
23
9
|
|
24
|
-
And then execute:
|
25
|
-
|
26
|
-
$ bundle
|
27
|
-
|
28
|
-
Or install it yourself as:
|
29
|
-
|
30
|
-
$ gem install trick_or_treat
|
31
|
-
|
32
10
|
## Usage<a href="usage"><a>
|
33
11
|
|
34
|
-
|
35
|
-
|
36
|
-
|
12
|
+
```bash
|
13
|
+
$ trick
|
14
|
+
# displays some mysteriously awesome message
|
15
|
+
```
|
37
16
|
|
38
|
-
|
17
|
+
or:
|
39
18
|
|
40
|
-
|
19
|
+
```bash
|
20
|
+
$ treat
|
21
|
+
# displays some mysteriously awesome message
|
22
|
+
```
|
41
23
|
|
42
24
|
## Contributing<a href="contributing"><a>
|
43
25
|
|
44
|
-
Bug reports and pull requests are welcome
|
26
|
+
Bug reports and pull requests are welcome at [GitHub](https://github.com/sergioro9/trick_or_treat)
|
45
27
|
|
46
28
|
## License<a href="license"><a>
|
47
29
|
|
48
30
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
49
31
|
|
50
|
-
|
51
|
-
|
52
|
-
1. [open() returns StringIO instead of Tempfile](https://stackoverflow.com/questions/31527154/rails-open-returns-stringio-instead-of-tempfile/31527533)
|
53
|
-
2. [Remove a node with nokogiri](https://stackoverflow.com/questions/1708504/how-do-i-remove-a-node-with-nokogiri)
|
54
|
-
3. [How to handle 500 erros with openuri?](https://stackoverflow.com/questions/18634684/how-can-i-handle-503-errors-with-open-uri)
|
55
|
-
4. [How do I pick randomly from an array?](https://stackoverflow.com/questions/3482149/how-do-i-pick-randomly-from-an-array)
|
56
|
-
5. [Advantage of tap method in ruby](https://stackoverflow.com/questions/17493080/advantage-of-tap-method-in-ruby)
|
57
|
-
6. []()
|
32
|
+
---
|
58
33
|
|
34
|
+
Happy Hacking
|
data/exe/trick
CHANGED
data/exe/trick_or_treat
CHANGED
data/lib/trick_or_treat.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
|
-
require
|
1
|
+
require 'trick_or_treat/version'
|
2
|
+
require 'nokogiri'
|
2
3
|
require 'open-uri'
|
3
|
-
require 'yaml'
|
4
4
|
require 'tempfile'
|
5
|
-
require '
|
6
|
-
require 'pager'
|
5
|
+
require 'yaml'
|
7
6
|
|
8
7
|
module TrickOrTreat
|
9
8
|
class Error < StandardError; end
|
10
9
|
|
11
|
-
include Pager
|
12
10
|
extend self
|
13
11
|
|
14
12
|
def ask(args)
|
@@ -40,7 +38,6 @@ module TrickOrTreat
|
|
40
38
|
|
41
39
|
def trick
|
42
40
|
printf "\e[1;38;05;165m Trick\e[0m\n"
|
43
|
-
page
|
44
41
|
links=get_links
|
45
42
|
link=links.sample
|
46
43
|
f=open([@uri,link].join('/'))
|