chat_by_rznvls 0.0.0

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/chat_by_rznvls.rb +41 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8e923f144513fa2cb911d43934705aafeb32a9ea
4
+ data.tar.gz: 8b04e23d7107efcaccfe66e769604d61d09d3833
5
+ SHA512:
6
+ metadata.gz: c58880cd8e687468d8c515fecbee52246faa5116b5a9f9b25f6098e1f247368d42ade4971b7947bec74001baa754844def1b6ca601f4fa3665e3107f149d79be
7
+ data.tar.gz: 2041be499973958f5350ef6bc0ed7605d5f9df5d5fa34fdbb9e4a3a14b6fbef3582d91fd7360615d5e78c3de2e2dd15ab85b298c0d36f9a69cd39c6dcac1d394
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'mysql2'
4
+
5
+
6
+ begin
7
+
8
+ print "Login: "
9
+ user = gets.to_s.strip
10
+
11
+ con = Mysql2::Client.new( :host => 'sql2.freemysqlhosting.net',
12
+ :username => 'sql2204087',
13
+ :password => 'tM3%yF9*',
14
+ :port => '3306',
15
+ :database => 'sql2204087')
16
+ run = true
17
+ puts "Type -h for help with this shit and -r to refresh chat"
18
+ puts "Have fun"
19
+
20
+
21
+ while run do
22
+
23
+ msg = gets.to_s.strip
24
+ msgs = con.query("SELECT * FROM chat WHERE id > ( SELECT MAX(id) - 5 FROM chat)")
25
+ case msg
26
+ when "-r"
27
+ msgs.each do |row|
28
+ puts row["user"] + ": " + row["msg"]
29
+ end
30
+ when "-h"
31
+ puts "Do it without help. You are shit"
32
+ when "exit"
33
+ break
34
+ else
35
+
36
+ con.query("INSERT INTO chat (user, msg) VALUES ('#{user}', '#{msg}')")
37
+
38
+ end
39
+
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chat_by_rznvls
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Roman Ovcharov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-09 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple chat
14
+ email: rozenvil13@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/chat_by_rznvls.rb
20
+ homepage: http://rubygems.org/gems/chat_by_rznvls
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.6.13
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: First gem
44
+ test_files: []