cheatsheet 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/README.md +6 -31
- data/lib/cheatsheet/client.rb +34 -0
- data/lib/cheatsheet/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1463fcf1595b6d064300d2e9ee728e37ed37b6b1
|
4
|
+
data.tar.gz: be269f5cc3455c9acc06230a86182c78ce0fe36c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a68fc8dfe147564f0e4023543c8d8ac01e7c024300cdddb62fc3e20e46848fd483d6df90fe08f888e825df6efd79b14c2ad1b42b38c939786ea94377f0cee331
|
7
|
+
data.tar.gz: 5f2bc784fd27b57b2009810fe4a0e455eb41970de0ca3864b481ad754a116a16c50622c33a28d301221486085573eb7537830c57bf278170c78714da7b16fce5
|
data/README.md
CHANGED
@@ -1,39 +1,14 @@
|
|
1
1
|
# Cheatsheet
|
2
2
|
|
3
|
-
|
3
|
+
A terminal client for the best cheatsheet site in the planet devhints.io
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'cheatsheet'
|
5
|
+
```
|
6
|
+
gem install cheatsheet
|
13
7
|
```
|
14
8
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install cheatsheet
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
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.
|
30
|
-
|
31
|
-
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).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cheatsheet. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
-
|
9
|
+
```
|
10
|
+
cheatsheet webpack
|
11
|
+
```
|
37
12
|
|
38
13
|
## License
|
39
14
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Cheatsheet
|
2
|
+
class Client
|
3
|
+
|
4
|
+
SOURCE = "https://raw.githubusercontent.com/rstacruz/cheatsheets/gh-pages/"
|
5
|
+
|
6
|
+
def self.fetch(*args)
|
7
|
+
key = args[0].first
|
8
|
+
uri = URI(SOURCE + key + ".md")
|
9
|
+
|
10
|
+
begin
|
11
|
+
puts self.fetch_raw(uri)
|
12
|
+
rescue CheatSheetClientException => e
|
13
|
+
puts e.message
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.fetch_raw(uri)
|
18
|
+
response = Net::HTTP.get_response(uri)
|
19
|
+
|
20
|
+
case response
|
21
|
+
when Net::HTTPSuccess then
|
22
|
+
Net::HTTP.get(uri)
|
23
|
+
when Net::HTTPNotFound then
|
24
|
+
raise CheatSheetClientException.new "We don't have that cheatsheet yet. Feel free to contribute here: https://github.com/rstacruz/cheatsheets"
|
25
|
+
else
|
26
|
+
response.value
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class CheatSheetClientException < Exception
|
34
|
+
end
|
data/lib/cheatsheet/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cheatsheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Torres
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- bin/setup
|
73
73
|
- cheatsheet.gemspec
|
74
74
|
- lib/cheatsheet.rb
|
75
|
+
- lib/cheatsheet/client.rb
|
75
76
|
- lib/cheatsheet/version.rb
|
76
77
|
homepage: http://devhints.io
|
77
78
|
licenses:
|