vindetta 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -3
- data/README.md +1 -3
- data/Rakefile +3 -3
- data/bin/console +4 -11
- data/bin/setup +1 -2
- data/exe/vindetta +2 -16
- data/lib/vindetta/cli.rb +24 -0
- data/lib/vindetta/errors.rb +7 -0
- data/lib/vindetta/generator.rb +4 -10
- data/lib/vindetta/transliterator.rb +11 -0
- data/lib/vindetta/version.rb +1 -1
- data/lib/vindetta/vin.rb +17 -0
- data/lib/vindetta.rb +6 -2
- data/rubocop.yml +0 -0
- data/vindetta.gemspec +18 -14
- metadata +54 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97ff2d11e84c7f31eda645c3e72fd992adeabc8e
|
4
|
+
data.tar.gz: '0857a33d479739dcb82555f72cb1c34b5e22521c'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0eaa15fab51ff8ab37ece173052f8ff38b9bc70b58fd731a10ee540d970f0aafd9b4221d067e1cf538fa9cb4b54fc5e4b639b8f21a65b2ef59f300345e9c469
|
7
|
+
data.tar.gz: 2993be32724b7749fe21fce2935fb52048a219068abe1046530d90f34a2abb9635e477d0f3074e81af7eed1acb8ffd50c4b53e590d0a8e64feed647041a3d39b
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -32,10 +32,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
32
|
|
33
33
|
## Contributing
|
34
34
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
36
|
-
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kyledecot/vindetta.
|
37
36
|
|
38
37
|
## License
|
39
38
|
|
40
39
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,14 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'pry'
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'vindetta'
|
5
6
|
|
6
|
-
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
7
|
+
Pry.start
|
data/bin/setup
CHANGED
data/exe/vindetta
CHANGED
@@ -1,19 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require "gli"
|
3
|
+
require 'vindetta'
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
program_desc 'Utility for generating Vehicle Identification Numbers (VINs)'
|
9
|
-
|
10
|
-
command :generate do |c|
|
11
|
-
c.desc "Generates a random VIN"
|
12
|
-
|
13
|
-
c.action do
|
14
|
-
puts Vindetta::Generator.generate
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
exit run(ARGV)
|
5
|
+
Vindetta::CLI.run(ARGV)
|
data/lib/vindetta/cli.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'gli'
|
2
|
+
|
3
|
+
module Vindetta
|
4
|
+
class CLI
|
5
|
+
extend GLI::App
|
6
|
+
|
7
|
+
program_desc 'Vehicle Identification Number (VIN) CLI'
|
8
|
+
|
9
|
+
desc 'Transliterates a VIN character'
|
10
|
+
arg_name 'character'
|
11
|
+
command :transliterate do |c|
|
12
|
+
c.action do |_global, _options, args|
|
13
|
+
puts Vindetta::Transliterator.run(args.first)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Generates a random vin'
|
18
|
+
command :generate do |c|
|
19
|
+
c.action do |_global, options, _args|
|
20
|
+
puts Vindetta::Generator.generate(options)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/vindetta/generator.rb
CHANGED
@@ -1,15 +1,9 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
1
3
|
module Vindetta
|
2
4
|
class Generator
|
3
|
-
|
4
|
-
|
5
|
-
"1FTRX12W18KE97487",
|
6
|
-
"2HGFA1F38BH525824",
|
7
|
-
"1C4GP64L5YB667678"
|
8
|
-
].freeze
|
9
|
-
|
10
|
-
|
11
|
-
def self.generate(options = {})
|
12
|
-
VINS.sample
|
5
|
+
def self.generate
|
6
|
+
Net::HTTP.get('randomvin.com', '/getvin.php')
|
13
7
|
end
|
14
8
|
end
|
15
9
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Vindetta
|
2
|
+
class Transliterator
|
3
|
+
MAPPING = '0123456789.ABCDEFGH..JKLMN.P.R..STUVWXYZ'.split('').freeze
|
4
|
+
|
5
|
+
def self.run(character)
|
6
|
+
index = MAPPING.find_index(character)
|
7
|
+
raise Vindetta::InvalidCharacter.new(character) unless index
|
8
|
+
index % 10
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/vindetta/version.rb
CHANGED
data/lib/vindetta/vin.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'active_support'
|
2
|
+
require 'active_model'
|
3
|
+
|
4
|
+
module Vindetta
|
5
|
+
class Vin
|
6
|
+
LENGTH = 17
|
7
|
+
|
8
|
+
attr_reader :value
|
9
|
+
include ActiveModel::Validations
|
10
|
+
|
11
|
+
validates_length_of :value, is: LENGTH
|
12
|
+
|
13
|
+
def initialize(value)
|
14
|
+
@value = value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/vindetta.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'vindetta/version'
|
2
|
+
require 'vindetta/generator'
|
3
|
+
require 'vindetta/cli'
|
4
|
+
require 'vindetta/errors'
|
5
|
+
require 'vindetta/transliterator'
|
6
|
+
require 'vindetta/vin'
|
3
7
|
|
4
8
|
module Vindetta
|
5
9
|
def self.generate(options = {})
|
data/rubocop.yml
ADDED
File without changes
|
data/vindetta.gemspec
CHANGED
@@ -1,30 +1,34 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'vindetta/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'vindetta'
|
8
9
|
spec.version = Vindetta::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
10
|
+
spec.authors = ['Kyle Decot']
|
11
|
+
spec.email = ['kyle@joinroot.com']
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
13
|
+
spec.summary = 'Ruby gem for generating VINs'
|
14
|
+
spec.description = 'Ruby gem for generating VINs'
|
15
|
+
spec.homepage = 'https://github.com/kyledecot/vindetta'
|
16
|
+
spec.license = 'MIT'
|
16
17
|
|
17
18
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
19
|
f.match(%r{^(test|spec|features)/})
|
19
20
|
end
|
20
|
-
spec.bindir =
|
21
|
+
spec.bindir = 'exe'
|
21
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
-
spec.require_paths = [
|
23
|
+
spec.require_paths = ['lib']
|
23
24
|
|
24
|
-
spec.add_dependency
|
25
|
+
spec.add_dependency 'gli', '~> 2.16'
|
26
|
+
spec.add_dependency 'activemodel', '~> 5.1'
|
27
|
+
spec.add_dependency 'activesupport', '~> 5.1'
|
25
28
|
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
29
|
+
spec.add_development_dependency 'bundler', '~> 1.14'
|
30
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
31
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
32
|
+
spec.add_development_dependency 'pry'
|
33
|
+
spec.add_development_dependency 'rubocop'
|
30
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vindetta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Decot
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activemodel
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.1'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: bundler
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,19 +95,33 @@ dependencies:
|
|
67
95
|
- !ruby/object:Gem::Version
|
68
96
|
version: '3.0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
98
|
+
name: pry
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
|
-
- - "
|
101
|
+
- - ">="
|
74
102
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
103
|
+
version: '0'
|
76
104
|
type: :development
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
|
-
- - "
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
81
123
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
124
|
+
version: '0'
|
83
125
|
description: Ruby gem for generating VINs
|
84
126
|
email:
|
85
127
|
- kyle@joinroot.com
|
@@ -99,8 +141,13 @@ files:
|
|
99
141
|
- bin/setup
|
100
142
|
- exe/vindetta
|
101
143
|
- lib/vindetta.rb
|
144
|
+
- lib/vindetta/cli.rb
|
145
|
+
- lib/vindetta/errors.rb
|
102
146
|
- lib/vindetta/generator.rb
|
147
|
+
- lib/vindetta/transliterator.rb
|
103
148
|
- lib/vindetta/version.rb
|
149
|
+
- lib/vindetta/vin.rb
|
150
|
+
- rubocop.yml
|
104
151
|
- vindetta.gemspec
|
105
152
|
homepage: https://github.com/kyledecot/vindetta
|
106
153
|
licenses:
|