detran_faker 0.0.1 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3b103ca671e82eb6e4cc0a0e7af8069c75cb15b651b5ccae1dbf07ad132460e
4
- data.tar.gz: e3588cb4f210bd459962b65b2e6ca4b0359bfb49a1060a26c4ae9ac62ec6356f
3
+ metadata.gz: 6570feca43d41326dfc2c758a4a7d4245be1edc62871507355d845d883fdba3d
4
+ data.tar.gz: f43aa74e36cf3e3bd6fcb72f15e9184f5b5c05fa2e21fc11c87a5c3fb4adf5d9
5
5
  SHA512:
6
- metadata.gz: 0aab06919ec81ae79b1bcedc140aaad15e1e4e7813bfd269b7a7636bb9f508a3c55205d7064a61f8665c9e436c20d251e53693d27e364f7d370077e17a5e2539
7
- data.tar.gz: 9b7218a4fa61d901dec46c25b49373144e398e6cc74cfee9741de44b9dee02d889e49601f618809e307f6ad4c9a5cbfd3e71883e850cb5e9c13a4dc0d2d5c0e0
6
+ metadata.gz: 7293550238d6109243cd8e574d6294bf74413743d6edf948cdbd9eb20ea7b52b2398048f724969edd5d34b79bfacff35d01cf33808baed28dcea5078d93805be
7
+ data.tar.gz: 1fe31e0ffeee8e3089ed78a9ea501175ced13309e4de9885584997a899be0c122ccdff3283892f0047e2734d6fa9ac457a20483e005ff8bb10a1e019efbec67f
@@ -0,0 +1,41 @@
1
+ version: 2.1
2
+ orbs:
3
+ ruby: circleci/ruby@1.0
4
+
5
+ jobs:
6
+ test:
7
+ docker:
8
+ - image: cimg/ruby:2.7.1
9
+ steps:
10
+ - checkout
11
+ - ruby/install-deps
12
+ - ruby/rspec-test
13
+ deploy:
14
+ docker:
15
+ - image: circleci/ruby:2.7-node-browsers
16
+
17
+ working_directory: ~/detran_faker
18
+
19
+ steps:
20
+ - checkout
21
+ - run:
22
+ name: Setup Rubygems
23
+ command: bash .circleci/setup-rubygems.sh
24
+
25
+ - run:
26
+ name: Publish to Rubygems
27
+ command: |
28
+ gem build detran_faker.gemspec
29
+ gem push "detran_faker-$(git describe --tags).gem"
30
+
31
+ workflows:
32
+ version: 2
33
+ test_and_deploy:
34
+ jobs:
35
+ - test
36
+ - deploy:
37
+ filters:
38
+ tags:
39
+ only: /.*/
40
+ branches:
41
+ ignore: /.*/
@@ -0,0 +1,3 @@
1
+ mkdir ~/.gem
2
+ echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
3
+ chmod 0600 /home/circleci/.gem/credentials
data/.gitignore CHANGED
@@ -9,3 +9,6 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ # Ignore gem binaries
14
+ *.gem
@@ -0,0 +1,14 @@
1
+ Layout/SpaceAroundMethodCallOperator:
2
+ Enabled: true
3
+ Lint/RaiseException:
4
+ Enabled: true
5
+ Lint/StructNewOverride:
6
+ Enabled: true
7
+ Style/HashEachMethods:
8
+ Enabled: true
9
+ Style/HashTransformKeys:
10
+ Enabled: true
11
+ Style/HashTransformValues:
12
+ Enabled: true
13
+ Style/ExponentialNotation:
14
+ Enabled: true
@@ -0,0 +1 @@
1
+ ruby 2.7.1
@@ -0,0 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ detran_faker (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rspec (3.9.0)
11
+ rspec-core (~> 3.9.0)
12
+ rspec-expectations (~> 3.9.0)
13
+ rspec-mocks (~> 3.9.0)
14
+ rspec-core (3.9.1)
15
+ rspec-support (~> 3.9.1)
16
+ rspec-expectations (3.9.1)
17
+ diff-lcs (>= 1.2.0, < 2.0)
18
+ rspec-support (~> 3.9.0)
19
+ rspec-mocks (3.9.1)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.9.0)
22
+ rspec-support (3.9.2)
23
+ rspec_junit_formatter (0.4.1)
24
+ rspec-core (>= 2, < 4, != 2.12.0)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ detran_faker!
31
+ rspec (= 3.9.0)
32
+ rspec_junit_formatter (= 0.4.1)
33
+
34
+ BUNDLED WITH
35
+ 2.1.4
data/README.md CHANGED
@@ -1,22 +1,26 @@
1
- # DetranFaker
1
+ [![mateusdeap](https://circleci.com/gh/mateusdeap/detran_faker.svg?style=shield)](https://app.circleci.com/pipelines/github/mateusdeap/detran_faker)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/detran_faker`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ # Detran Faker
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Essa gem visa apenas atender a uma necessidade interna dos desenvolvedores do DETRANCE, gerando dados falsos de habilitação e veículos, porém que estão conformes às determinações do CTB.
6
6
 
7
- ## Installation
7
+ ## Estado Atual
8
8
 
9
- Add this line to your application's Gemfile:
9
+ Ela ainda está em desenvolvimento inicial, então falta ainda muita coisa, porém o primeiro módulo que pretendo concluir é o da Habilitação.
10
+
11
+ ## Instalação
12
+
13
+ Apenas adicione a linha abaixo ao seu Gemfile.
10
14
 
11
15
  ```ruby
12
16
  gem 'detran_faker'
13
17
  ```
14
18
 
15
- And then execute:
19
+ Então execute
16
20
 
17
- $ bundle
21
+ $ bundle install
18
22
 
19
- Or install it yourself as:
23
+ Ou instale globalmente:
20
24
 
21
25
  $ gem install detran_faker
22
26
 
@@ -24,16 +28,10 @@ Or install it yourself as:
24
28
 
25
29
  TODO: Write usage instructions here
26
30
 
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
31
+ ## Contribuindo
34
32
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/detran_faker.
33
+ Bugs e contribuições de código são bem vindas. Apenas abra uma PR no GitHub: https://github.com/mateusdeap/detran_faker.
36
34
 
37
- ## License
35
+ ## Licença
38
36
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
37
+ Essa gem está disponível como código aberto sob a licença [MIT](https://opensource.org/licenses/MIT).
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  interna dos desenvolvedores do DETRANCE, gerando dados falsos de
16
16
  habilitação e veículos, porém que estão conformes às determinações
17
17
  do CTB.)
18
- spec.homepage = 'https://bitbucket.org/mateusdeapereira/detran_faker/src'
18
+ spec.homepage = 'https://github.com/mateusdeap/detran_faker'
19
19
  spec.license = 'MIT'
20
20
 
21
21
  # Specify which files should be added to the gem when it is released.
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ['lib']
29
29
 
30
30
  spec.add_development_dependency 'rspec', '3.9.0'
31
+ spec.add_development_dependency 'rspec_junit_formatter', '0.4.1'
31
32
  end
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'detran_faker/version'
3
+ my_dir = __dir__
4
4
 
5
+ Dir.glob(File.join(my_dir, 'detran_faker', '/**/*.rb')).sort.each do |file|
6
+ require file
7
+ end
8
+
9
+ # Top level module
5
10
  module DetranFaker
6
- class Error < StandardError; end
7
- # Your code goes here...
8
11
  end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DetranFaker
4
+ # Module that contains any classes to generate data
5
+ # related to licensing issues
6
+ class Habilitacao
7
+ @state_initials = %w[AM AC AL AP AM BA CE DF
8
+ ES GO MA MT MS MG PA PB PR PE PI
9
+ RJ RN RS RO RR SC SP SE TO]
10
+
11
+ class << self
12
+ def random_single_digit
13
+ Random.rand(0..9).to_s
14
+ end
15
+
16
+ def random_non_zero_digit
17
+ Random.rand(1..9).to_s
18
+ end
19
+
20
+ def random_state_initials
21
+ @state_initials[Random.rand(0..(@state_initials.size - 1))]
22
+ end
23
+ end
24
+
25
+ # Module responsible for generating fake information
26
+ # that simulates a national driver's license.
27
+ class CNH
28
+ class << self
29
+ def numero_registro_nacional
30
+ cnh_number = Habilitacao.random_non_zero_digit
31
+ 10.times do
32
+ cnh_number = cnh_number.dup.concat Habilitacao.random_single_digit
33
+ end
34
+
35
+ cnh_number
36
+ end
37
+
38
+ def numero_espelho
39
+ numero_espelho = Habilitacao.random_non_zero_digit
40
+ 9.times do
41
+ numero_espelho =
42
+ numero_espelho.dup.concat Habilitacao.random_single_digit
43
+ end
44
+
45
+ numero_espelho
46
+ end
47
+
48
+ def numero_formulario_renach
49
+ renach = Habilitacao.random_state_initials
50
+ 9.times do
51
+ renach = renach.dup.concat Habilitacao.random_single_digit
52
+ end
53
+
54
+ renach
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DetranFaker
4
- VERSION = '0.0.1'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: detran_faker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateus Pereira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-01 00:00:00.000000000 Z
11
+ date: 2020-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.9.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec_junit_formatter
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.4.1
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.4.1
27
41
  description: |-
28
42
  Essa gem visa apenas atender a uma necessidade
29
43
  interna dos desenvolvedores do DETRANCE, gerando dados falsos de
@@ -35,10 +49,15 @@ executables: []
35
49
  extensions: []
36
50
  extra_rdoc_files: []
37
51
  files:
52
+ - ".circleci/config.yml"
53
+ - ".circleci/setup-rubygems.sh"
38
54
  - ".gitignore"
39
55
  - ".rspec"
56
+ - ".rubocop.yml"
57
+ - ".tool-versions"
40
58
  - ".travis.yml"
41
59
  - Gemfile
60
+ - Gemfile.lock
42
61
  - LICENSE.txt
43
62
  - README.md
44
63
  - Rakefile
@@ -46,8 +65,9 @@ files:
46
65
  - bin/setup
47
66
  - detran_faker.gemspec
48
67
  - lib/detran_faker.rb
68
+ - lib/detran_faker/habilitacao/cnh.rb
49
69
  - lib/detran_faker/version.rb
50
- homepage: https://bitbucket.org/mateusdeapereira/detran_faker/src
70
+ homepage: https://github.com/mateusdeap/detran_faker
51
71
  licenses:
52
72
  - MIT
53
73
  metadata: {}