vk-url-checker 0.0.0.alpha → 0.0.0.beta

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 +4 -4
  2. metadata +4 -25
  3. data/bin/vk-url-checker +0 -120
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfc2d3128899c7dd4eb7f8687a0f4d65ee52edcb
4
- data.tar.gz: 7bea26446010c39c5fb2d165b6fe6a7d4afbfcbb
3
+ metadata.gz: 111565cd81ed5ce01999c261ba75f1fbefdbcffe
4
+ data.tar.gz: dbaecb798b4741976afe3e8c7f3f51221d9603b9
5
5
  SHA512:
6
- metadata.gz: f61242b7901553ffc4a4c689fbff7bbf7e31cadf829a51b5f4741322142ff85590be69bb3b4424aa576b6b8975734892a25b742d156206eb77a770265b28b565
7
- data.tar.gz: 70a785525d93961a74360b4cb3005434887a76a40e8ae0dcc554d038aeffe2de0b723ba0f9ee02b9383f2c6bfd94bc4ba6f3fcd9e67ed523be0cebcb156767ea
6
+ metadata.gz: bd693d02e586aaf35dff7276cef13a5ec91ee4713cb7cb0f7f83829be9d649baba2b04bc0e1bdda109de64009cc992208d7edf68a8029f1bbd53095ec84393a7
7
+ data.tar.gz: ad545ea8be18031fa3334da2828312dd3a1713533e8f6a170014a7f5693c742cd3ff5cd0bf90ca95d84009e7bab590e71ac4990cf2e6e2af5135b0057497e3a4
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vk-url-checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.alpha
4
+ version: 0.0.0.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georgiy Odisharia
@@ -9,27 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2017-07-18 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: nokogiri
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.8'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 1.8.0
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '1.8'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 1.8.0
12
+ dependencies: []
33
13
  description: |2
34
14
  vk-url-checker is a gem checking avaliability of short URL
35
15
  from VK social network. Nowdays it can be used as standalone app
@@ -39,8 +19,7 @@ email: math.kraut.cat@gmail.com
39
19
  executables: []
40
20
  extensions: []
41
21
  extra_rdoc_files: []
42
- files:
43
- - bin/vk-url-checker
22
+ files: []
44
23
  homepage: http://rubygems.org/gems/vk-url-checker
45
24
  licenses:
46
25
  - MIT
@@ -61,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
40
  version: 1.3.1
62
41
  requirements: []
63
42
  rubyforge_project:
64
- rubygems_version: 2.4.8
43
+ rubygems_version: 2.5.1
65
44
  signing_key:
66
45
  specification_version: 4
67
46
  summary: Checker of short URLs for VK
@@ -1,120 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'optparse'
5
- require 'pp'
6
-
7
- require 'vk-url-checker'
8
-
9
- class CliParser
10
-
11
- # Class variables
12
- @allowed_opt = {
13
- :addr => ["-a", "--address"],
14
- :title => ["-t", "--title"],
15
- :conseq => ["-c", "--consequence"]
16
- }
17
- Options = Struct.new(*@allowed_opt.keys)
18
-
19
- class << self
20
- attr_reader :parser, :options
21
- end
22
-
23
- def self.parse(args)
24
- @options = Options.new
25
- begin
26
- option_parser.parse!(args)
27
- rescue OptionParser::MissingArgument => mis_arg_e
28
- missing_arg_exception(mis_arg_e)
29
- rescue OptionParser::InvalidOption => inv_opt_e
30
- inv_opt_exception(inv_opt_e)
31
- end
32
- @options
33
- end
34
-
35
- def self.option_parser
36
- @parser ||= OptionParser.new do |parser|
37
- parser.banner = "Usage: url-checker.rb [options]"
38
- parser.separator "\t"
39
- parser.separator "Specific options:"
40
- parser.separator "\t"
41
- parser.separator "Common options:"
42
-
43
- # No argument, shows at tail. This will print an options summary.
44
- # Try it and see!
45
- parser.on_tail("-h", "--help", "Show this message") do
46
- puts parser
47
- exit
48
- end
49
-
50
- # Another typical switch to print the version.
51
- parser.on_tail("--version", "Show version") do
52
- puts "0.0.1"
53
- exit
54
- end
55
-
56
- end
57
- # add additional options
58
- address_option
59
- expectated_title_option
60
-
61
- @parser
62
- end
63
-
64
- def self.address_option
65
- parser.on(:REQUIRED, *make_options_list(:addr, "ADDR"), String,
66
- "Address vk") do |addr|
67
- options.addr = addr
68
- end
69
- end
70
-
71
- def self.expectated_title_option
72
- parser.on(:REQUIRED, *make_options_list(:title, "TITLE"), String,
73
- "Expected title") do |title|
74
- options.title = title
75
- end
76
- end
77
-
78
- def self.make_options_list(opt_sym, opt_holder)
79
- [
80
- @allowed_opt[opt_sym][0],
81
- @allowed_opt[opt_sym][1] + " " + opt_holder
82
- ]
83
- end
84
-
85
- def self.missing_arg_exception(expt)
86
- case arg = /\w: (?<arg>.*)/.match(expt.message)[:arg]
87
- when *@allowed_opt[:addr]
88
- $stderr.print "Missing argument: #{arg} <url>\n"
89
- exit 1
90
- when *@allowed_opt[:title]
91
- $stderr.print "Missing argument: #{arg} <title>\n"
92
- exit 1
93
- end
94
- end
95
-
96
- def self.inv_opt_exception(expt)
97
- $stderr.print expt.message + "\n"
98
- exit 1
99
- end
100
-
101
- end
102
-
103
- if __FILE__==$0
104
- # this will only run if the script was the main, not load'd or require'd
105
- cli_parser = CliParser.parse(ARGV)
106
-
107
- # DATA_DIR = ENV["HOME"] + ".config/"
108
- # Dir.mkdir(DATA_DIR) unless File.exists?(DATA_DIR)
109
-
110
- checker = VKTools::UrlChecker::Checker.new()
111
-
112
- result = checker.check(cli_parser.addr);
113
- if (result[:status] == VKTools::UrlChecker::STATUS[:Coincidence]) then
114
- puts "OK!"
115
- elsif (result[:status] == VKTools::UrlChecker::STATUS[:Avaliable]) then
116
- puts "Short address is avaliable!\n"
117
- elsif (result[:status] == VKTools::UrlChecker::STATUS[:Busy]) then
118
- puts "Page title: #{result[:title]}"
119
- end
120
- end