bashim 1.0.5

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,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bashim.gemspec
4
+ gemspec
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2013 TODO: Write your name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ Thx.
@@ -0,0 +1,29 @@
1
+ # Bashim
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'bashim'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install bashim
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bashim/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "bashim"
8
+ gem.version = Bashim::VERSION
9
+ gem.authors = ["link0ln"]
10
+ gem.email = ["g.link0ln@gmail.com"]
11
+ gem.description = %q{Read bash.im citation}
12
+ gem.summary = %q{Just use it}
13
+ gem.homepage = "http://idone.su"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ gem.executables << 'bashim'
20
+ end
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'net/http'
4
+ require 'iconv'
5
+
6
+ html = Net::HTTP.get('bash.im', '/random')
7
+ html = Iconv.conv("UTF8//IGNORE//TRANSLIT", "CP1251", html)
8
+ text = /\<div class=\"text\"\>.*?\<\/div\>/.match(html)
9
+ cit = text.to_s
10
+ cit.gsub!(/\<br.*?\>/,"\n")
11
+ cit.gsub!(/&quot;/,"\"")
12
+ cit.gsub!(/&lt;/,"<")
13
+ cit.gsub!(/&gt;/,">")
14
+ puts "\033[33m"
15
+ puts cit.gsub(/\<.+?\>/,"")
16
+ puts "\033[37m"
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby
2
+ # encoding: utf-8
3
+
4
+ require 'bashim'
5
+
6
+ include Bashim
7
+ puts Bashim::random
File without changes
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+ require "bashim/version"
3
+ require 'net/http'
4
+
5
+ module Bashim
6
+ def random
7
+ html = Net::HTTP.get('bash.im', '/random')
8
+ html.encode!('UTF-8', 'CP1251', :invalid => :replace, :replace => '')
9
+ text = /\<div class=\"text\"\>.*?\<\/div\>/.match(html)
10
+ cit = text.to_s
11
+ cit.gsub!(/\<br.*?\>/,"\n")
12
+ cit.gsub!(/&quot;/,"\"")
13
+ cit.gsub!(/&lt;/,"<")
14
+ cit.gsub!(/&gt;/,">")
15
+ return cit.gsub(/\<.+?\>/,"")
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Bashim
2
+ VERSION = "1.0.5"
3
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bashim
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 5
10
+ version: 1.0.5
11
+ platform: ruby
12
+ authors:
13
+ - link0ln
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2013-01-24 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: Read bash.im citation
22
+ email:
23
+ - g.link0ln@gmail.com
24
+ executables:
25
+ - bashim
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - LICENSE.txt
34
+ - README.md
35
+ - Rakefile
36
+ - bashim.gemspec
37
+ - bashim.rb
38
+ - bin/bashim
39
+ - bundler/gem_tasks
40
+ - lib/bashim.rb
41
+ - lib/bashim/version.rb
42
+ homepage: http://idone.su
43
+ licenses: []
44
+
45
+ post_install_message:
46
+ rdoc_options: []
47
+
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.8.24
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: Just use it
75
+ test_files: []
76
+