trick_or_treat 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed86961933ba9a05df61eb97550f1b839d397cd04a64ebcc9b20eefe7ec244ad
4
- data.tar.gz: 50d25bf88e0dfb2a11b1dee7d3cd1fad963a51fc9125d5d3be5a06a9393528b2
3
+ metadata.gz: ca2c51007c9777a57ded38b76528db6b36fc14d7607e201759af8c3584bebdf9
4
+ data.tar.gz: cb1c39d913be395a62460a20f3b84052611dbe770b2255fb789d4927a2bd0526
5
5
  SHA512:
6
- metadata.gz: e8348696eceffeb7f59dcdf5af9a4783ef79e2399bfe74b154621a42ae95d2251e5123d1bb3c7d324943e90189a87febcd001ed2e572bd9a841a2bb6dabc3874
7
- data.tar.gz: 4866e875336fcbc86015344fc778e93045418bc88d0a3e613bb2c58d9a76d03a3b3e0442adedabb252cbbf1f467738e2f502c5d4c25f42e4f9ad2b146791325e
6
+ metadata.gz: d17a231d5e82ef79320c4ed3d48fb33d23abeee20e5d9fe3cf285ef6fad68032e79873eb4cb7bdaef176c910e376fb8b8fc51689b24d570799b136e534116044
7
+ data.tar.gz: 2f50a57efcfcd6caae0573e8cb7211f83aaac101816f7a6e22a1764024b421113b7eeb7450ea660381e37ddce460ec219dba031134ef7d2a704b3fb3e494e9ac
data/Gemfile CHANGED
@@ -6,4 +6,3 @@ gemspec
6
6
  gem "rake", "~> 10.0"
7
7
  gem "safe_yaml", "~> 1.0.5"
8
8
  gem "nokogiri", "~> 1.10.4"
9
- gem "pager", "~> 1.0.1"
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
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 sergioro
3
+ Copyright (c) 2019 Sergio Romero
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,58 +1,34 @@
1
- ## TOC<a href="toc"><a>
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
- Add this line to your application's Gemfile:
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
- TODO: Write usage instructions here
35
-
36
- ## Development<a href="development"><a>
12
+ ```bash
13
+ $ trick
14
+ # displays some mysteriously awesome message
15
+ ```
37
16
 
38
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
17
+ or:
39
18
 
40
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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 on GitHub at https://github.com/[USERNAME]/trick_or_treat.
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
- ## References<a href="references"><a>
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
@@ -2,4 +2,4 @@
2
2
 
3
3
  require "trick_or_treat"
4
4
 
5
- puts TrickOrTreat.ask ["trick"]
5
+ IO.popen("less", "w") { |f| f.puts TrickOrTreat.ask(["trick"]) }
data/exe/trick_or_treat CHANGED
@@ -4,4 +4,10 @@ require "trick_or_treat"
4
4
 
5
5
  print "Trick or treat? "
6
6
 
7
- puts TrickOrTreat.ask [gets.chomp]
7
+ a=gets.chomp
8
+
9
+ if a=='trick'
10
+ IO.popen("less", "w") { |f| f.puts TrickOrTreat.ask([a]) }
11
+ else
12
+ puts TrickOrTreat.ask([a])
13
+ end
@@ -1,3 +1,3 @@
1
1
  module TrickOrTreat
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -1,14 +1,12 @@
1
- require "trick_or_treat/version"
1
+ require 'trick_or_treat/version'
2
+ require 'nokogiri'
2
3
  require 'open-uri'
3
- require 'yaml'
4
4
  require 'tempfile'
5
- require 'nokogiri'
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('/'))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trick_or_treat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Romero