Initial commit for rubygem

master
Nemo 3 years ago
parent e625caee29
commit 8ec8ab839e
  1. 16
      .gitignore
  2. 6
      Gemfile
  3. 34
      Gemfile.lock
  4. 7
      Rakefile
  5. 14
      bin/console
  6. 8
      bin/setup
  7. 28
      pincode-validator.gemspec
  8. 6
      src/pincode_validator.rb
  9. 3
      src/pincode_validator/version.rb
  10. 9
      tests/validate_spec.rb

16
.gitignore vendored

@ -1,6 +1,14 @@
/vendor/
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/dist/
/doc/
/node_modules/
composer.lock
/pkg/
/spec/reports/
/tmp/
/vendor/
__pycache__/
/dist/
package-lock.json
/composer.lock
/package-lock.json

@ -0,0 +1,6 @@
source "https://rubygems.org"
# Specify your gem's dependencies in pincode-validator.gemspec
gemspec
gem "rake", "~> 12.0"

@ -0,0 +1,34 @@
PATH
remote: .
specs:
pincode_validator (1.0.3)
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.3)
rake (12.3.3)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
PLATFORMS
ruby
DEPENDENCIES
pincode_validator!
rake (~> 12.0)
rspec (~> 3.8)
BUNDLED WITH
2.1.4

@ -0,0 +1,7 @@
require "bundler/gem_tasks"
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'tests/*_spec.rb'
end
task :default => :spec

@ -0,0 +1,14 @@
#!/usr/bin/env ruby
require "bundler/setup"
require "pincode_validator"
# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start
require "irb"
IRB.start(__FILE__)

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx
bundle install
# Do any other automated setup that you need to do here

@ -0,0 +1,28 @@
require_relative 'src/pincode_validator/version'
Gem::Specification.new do |spec|
spec.name = "pincode_validator"
spec.version = PincodeValidator::VERSION
spec.authors = ["Nemo"]
spec.email = ["rubygems@captnemo.in"]
spec.summary = %q{A simple regex based offline validator for PIN codes in India}
spec.homepage = "https://github.com/captn3m0/india-pincode-regex"
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/captn3m0/india-pincode-regex"
# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.license = 'MIT'
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["src"]
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.8'
end

@ -0,0 +1,6 @@
require "pincode_validator/version"
module PincodeValidator
class Error < StandardError; end
# Your code goes here...
end

@ -0,0 +1,3 @@
module PincodeValidator
VERSION = "1.0.3"
end

@ -0,0 +1,9 @@
require 'pincode_validator'
describe PincodeValidator do
it 'should validate pincodes' do
['244713', '560029', '560030', '110011'].each do |pin|
expect(described_class::valid? pin).to eq(true)
end
end
end
Loading…
Cancel
Save