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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07073cd13a3cd3857de911e285835a9d1d5d7b9f
4
- data.tar.gz: 2f6d0760b1463a94ce0fd0afcf420f494653c2e4
3
+ metadata.gz: 1463fcf1595b6d064300d2e9ee728e37ed37b6b1
4
+ data.tar.gz: be269f5cc3455c9acc06230a86182c78ce0fe36c
5
5
  SHA512:
6
- metadata.gz: da3ab795c9b7084e96fb8d1932a7b5a6a2d823dcd4748e583d069ac849b32ef71e39d71c6ca513cf47777fa120fb34c443f47c523b3fd932b09ab3733d835308
7
- data.tar.gz: 2f1f578f0f61b8c0e124aa44ac01342e7f8daebacc0c0673d354959f3ef09d504d3dc40d8c4bd7a60af3595877b512c94395f129a6600da740dbff70921311c0
6
+ metadata.gz: a68fc8dfe147564f0e4023543c8d8ac01e7c024300cdddb62fc3e20e46848fd483d6df90fe08f888e825df6efd79b14c2ad1b42b38c939786ea94377f0cee331
7
+ data.tar.gz: 5f2bc784fd27b57b2009810fe4a0e455eb41970de0ca3864b481ad754a116a16c50622c33a28d301221486085573eb7537830c57bf278170c78714da7b16fce5
data/README.md CHANGED
@@ -1,39 +1,14 @@
1
1
  # Cheatsheet
2
2
 
3
- 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/cheatsheet`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ A terminal client for the best cheatsheet site in the planet devhints.io
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
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
- And then execute:
16
-
17
- $ bundle
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
@@ -1,3 +1,3 @@
1
1
  module Cheatsheet
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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: