fakerbot 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 659d15a1df1e316903fc54196be47bb5f6887c04
4
- data.tar.gz: e419ed063d518c06ff6fae09a1294f88929abf3a
2
+ SHA256:
3
+ metadata.gz: ea71cbe8eda9c2107556272a351de4310aeea4ff97a7beb1339e0761159b456f
4
+ data.tar.gz: 97b494dc844611ad3a1c11aaa7dbebf61ccd2d1d54a082bc810f8bca57e79d18
5
5
  SHA512:
6
- metadata.gz: 2ef6759c55b74e26c59b179045c99108d1bffb277647de15eb29a875a11b2874f220fab9e41f645f7d036e58536dd85d7d41b7022cea30244833637f5f01a28f
7
- data.tar.gz: 1dce33ad7d335763fae4b920bb1cf5a6129af3595a23ed404bc738fb24ee066b3f80c2b6df7d25f17ced1c8ac407e8f626de8fd978d6719610c5365f5065f3a5
6
+ metadata.gz: db8819c887d2aa748bd0114191252cb09f98fb689643f0885d65e3ff11ea204b89a8194c6e8cc3266ee7802580be01b60136a2231a919c5da4e6a16b078c216a
7
+ data.tar.gz: 1cb84491e643546f123ef42e28fb1c6cf1fade1c97ede4b7faeb5a5dff0f78cd469ffe57a490be953f5d022f8f9cb27759971d6774592773e0b668247d04d23a
@@ -0,0 +1,9 @@
1
+ workflow "on pull request merge, delete the branch" {
2
+ on = "pull_request"
3
+ resolves = ["branch cleanup"]
4
+ }
5
+
6
+ action "branch cleanup" {
7
+ uses = "jessfraz/branch-cleanup-action@master"
8
+ secrets = ["GITHUB_TOKEN"]
9
+ }
@@ -1,3 +1,14 @@
1
+ env:
2
+ global:
3
+ - CC_TEST_REPORTER_ID=30c01e786e457860ad57c4d3ecc629c67b08510b170d86764eb360ffd5f7d8db
1
4
  language: ruby
2
5
  rvm:
3
6
  - 2.4
7
+ before_script:
8
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
9
+ - chmod +x ./cc-test-reporter
10
+ - ./cc-test-reporter before-build
11
+ script:
12
+ - bundle exec rspec
13
+ after_script:
14
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fakerbot (0.4.2)
4
+ fakerbot (0.4.4)
5
5
  faker
6
6
  pastel (~> 0.7.2)
7
7
  thor (~> 0.20.0)
@@ -13,7 +13,7 @@ GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
15
  coderay (1.1.2)
16
- concurrent-ruby (1.0.5)
16
+ concurrent-ruby (1.1.4)
17
17
  coveralls (0.7.1)
18
18
  multi_json (~> 1.3)
19
19
  rest-client
@@ -27,17 +27,47 @@ GEM
27
27
  equatable (0.5.0)
28
28
  faker (1.9.1)
29
29
  i18n (>= 0.7)
30
+ pastel (~> 0.7.2)
31
+ thor (~> 0.20.0)
32
+ tty-pager (~> 0.12.0)
33
+ tty-screen (~> 0.6.5)
34
+ tty-tree (~> 0.2.0)
35
+ ffi (1.9.25)
36
+ formatador (0.2.5)
37
+ guard (2.15.0)
38
+ formatador (>= 0.2.4)
39
+ listen (>= 2.7, < 4.0)
40
+ lumberjack (>= 1.0.12, < 2.0)
41
+ nenv (~> 0.1)
42
+ notiffany (~> 0.0)
43
+ pry (>= 0.9.12)
44
+ shellany (~> 0.0)
45
+ thor (>= 0.18.1)
46
+ guard-compat (1.2.1)
47
+ guard-rspec (4.7.3)
48
+ guard (~> 2.1)
49
+ guard-compat (~> 1.1)
50
+ rspec (>= 2.99.0, < 4.0)
30
51
  http-cookie (1.0.3)
31
52
  domain_name (~> 0.5)
32
- i18n (1.1.0)
53
+ i18n (1.5.2)
33
54
  concurrent-ruby (~> 1.0)
34
55
  json (2.1.0)
56
+ listen (3.1.5)
57
+ rb-fsevent (~> 0.9, >= 0.9.4)
58
+ rb-inotify (~> 0.9, >= 0.9.7)
59
+ ruby_dep (~> 1.2)
60
+ lumberjack (1.0.13)
35
61
  method_source (0.9.0)
36
62
  mime-types (3.1)
37
63
  mime-types-data (~> 3.2015)
38
64
  mime-types-data (3.2016.0521)
39
65
  multi_json (1.13.1)
66
+ nenv (0.3.0)
40
67
  netrc (0.11.0)
68
+ notiffany (0.1.1)
69
+ nenv (~> 0.1)
70
+ shellany (~> 0.0)
41
71
  pastel (0.7.2)
42
72
  equatable (~> 0.5.0)
43
73
  tty-color (~> 0.4.0)
@@ -45,6 +75,9 @@ GEM
45
75
  coderay (~> 1.1.0)
46
76
  method_source (~> 0.9.0)
47
77
  rake (10.5.0)
78
+ rb-fsevent (0.10.3)
79
+ rb-inotify (0.10.0)
80
+ ffi (~> 1.0)
48
81
  rest-client (2.0.2)
49
82
  http-cookie (>= 1.0.2, < 2.0)
50
83
  mime-types (>= 1.16, < 4.0)
@@ -62,6 +95,8 @@ GEM
62
95
  diff-lcs (>= 1.2.0, < 2.0)
63
96
  rspec-support (~> 3.7.0)
64
97
  rspec-support (3.7.1)
98
+ ruby_dep (1.5.0)
99
+ shellany (0.0.1)
65
100
  simplecov (0.16.1)
66
101
  docile (~> 1.1)
67
102
  json (>= 1.8, < 3)
@@ -77,17 +112,17 @@ GEM
77
112
  thor (0.20.0)
78
113
  tins (1.16.3)
79
114
  tty-color (0.4.3)
80
- tty-pager (0.11.0)
81
- strings (~> 0.1.0)
82
- tty-screen (~> 0.6.4)
83
- tty-which (~> 0.3.0)
115
+ tty-pager (0.12.0)
116
+ strings (~> 0.1.4)
117
+ tty-screen (~> 0.6)
118
+ tty-which (~> 0.4)
84
119
  tty-screen (0.6.5)
85
120
  tty-tree (0.2.0)
86
- tty-which (0.3.0)
121
+ tty-which (0.4.0)
87
122
  unf (0.1.4)
88
123
  unf_ext
89
124
  unf_ext (0.0.7.5)
90
- unicode-display_width (1.4.0)
125
+ unicode-display_width (1.4.1)
91
126
  unicode_utils (1.4.0)
92
127
 
93
128
  PLATFORMS
@@ -97,10 +132,11 @@ DEPENDENCIES
97
132
  bundler (~> 1.16)
98
133
  coveralls
99
134
  fakerbot!
135
+ guard-rspec
100
136
  pry
101
137
  rake (~> 10.0)
102
138
  rspec (~> 3.0)
103
139
  simplecov (~> 0.12)
104
140
 
105
141
  BUNDLED WITH
106
- 1.16.3
142
+ 1.17.3
@@ -0,0 +1,70 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+
43
+ # Rails files
44
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
45
+ dsl.watch_spec_files_for(rails.app_files)
46
+ dsl.watch_spec_files_for(rails.views)
47
+
48
+ watch(rails.controllers) do |m|
49
+ [
50
+ rspec.spec.call("routing/#{m[1]}_routing"),
51
+ rspec.spec.call("controllers/#{m[1]}_controller"),
52
+ rspec.spec.call("acceptance/#{m[1]}")
53
+ ]
54
+ end
55
+
56
+ # Rails config changes
57
+ watch(rails.spec_helper) { rspec.spec_dir }
58
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
59
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
60
+
61
+ # Capybara features specs
62
+ watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
63
+ watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
64
+
65
+ # Turnip features and steps
66
+ watch(%r{^spec/acceptance/(.+)\.feature$})
67
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
68
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
69
+ end
70
+ end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # FakerBot
2
2
 
3
- [![codebeat badge](https://codebeat.co/badges/ef4839f2-3946-4435-8c0e-7025de5fac22)](https://codebeat.co/projects/github-com-akabiru-fakerbot-master) [![Inline docs](http://inch-ci.org/github/akabiru/fakerbot.svg?branch=master)](http://inch-ci.org/github/akabiru/fakerbot) [![Build Status](https://travis-ci.com/akabiru/fakerbot.svg?branch=master)](https://travis-ci.com/akabiru/fakerbot) [![Coverage Status](https://coveralls.io/repos/github/akabiru/fakerbot/badge.svg?branch=master)](https://coveralls.io/github/akabiru/fakerbot?branch=master) [![Gem Version](https://badge.fury.io/rb/fakerbot.svg)](https://badge.fury.io/rb/fakerbot) [![Open Source Helpers](https://www.codetriage.com/akabiru/fakerbot/badges/users.svg)](https://www.codetriage.com/akabiru/fakerbot)
3
+ [![codebeat badge](https://codebeat.co/badges/ef4839f2-3946-4435-8c0e-7025de5fac22)](https://codebeat.co/projects/github-com-akabiru-fakerbot-master) [![Inline docs](http://inch-ci.org/github/akabiru/fakerbot.svg?branch=master)](http://inch-ci.org/github/akabiru/fakerbot) [![Build Status](https://travis-ci.com/akabiru/fakerbot.svg?branch=master)](https://travis-ci.com/akabiru/fakerbot) [![Coverage Status](https://coveralls.io/repos/github/akabiru/fakerbot/badge.svg?branch=master)](https://coveralls.io/github/akabiru/fakerbot?branch=master) [![Gem Version](https://badge.fury.io/rb/fakerbot.svg)](https://badge.fury.io/rb/fakerbot) [![Open Source Helpers](https://www.codetriage.com/akabiru/fakerbot/badges/users.svg)](https://www.codetriage.com/akabiru/fakerbot) [![Maintainability](https://api.codeclimate.com/v1/badges/58e23da2916f5007b5d3/maintainability)](https://codeclimate.com/github/akabiru/fakerbot/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/58e23da2916f5007b5d3/test_coverage)](https://codeclimate.com/github/akabiru/fakerbot/test_coverage)
4
4
 
5
5
  > Quickly look up [Faker](https://github.com/stympy/faker) methods without leaving your terminal!
6
6
 
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_development_dependency "bundler", "~> 1.16"
30
30
  spec.add_development_dependency "coveralls"
31
+ spec.add_development_dependency "guard-rspec"
31
32
  spec.add_development_dependency "pry"
32
33
  spec.add_development_dependency "rake", "~> 10.0"
33
34
  spec.add_development_dependency "rspec", "~> 3.0"
@@ -9,6 +9,8 @@ require 'fakerbot/commands/search'
9
9
  module FakerBot
10
10
  class CLI < Thor
11
11
  Error = Class.new(StandardError)
12
+ # Do not print depracation warnings; the CLI will do that
13
+ Gem::Deprecate.skip = true
12
14
 
13
15
  desc 'version', 'fakerbot version'
14
16
  def version
@@ -7,8 +7,10 @@ require 'tty/tree'
7
7
 
8
8
  module FakerBot
9
9
  class Renderer
10
- def self.call(hash, options, output)
11
- new(hash, options, output).call
10
+ attr_reader :crayon, :hash, :options, :output, :pager
11
+
12
+ def self.call(*args)
13
+ new(*args).call
12
14
  end
13
15
 
14
16
  def initialize(hash, options, output)
@@ -17,29 +19,40 @@ module FakerBot
17
19
  @output = output
18
20
  @crayon = Pastel.new(enabled: output.tty?)
19
21
  @pager = TTY::Pager.new(command: 'less -R')
20
- @screen = TTY::Screen
21
- @tree = TTY::Tree
22
22
  end
23
23
 
24
24
  def call
25
- data_tree = tree.new(build_tree)
26
- view = data_tree.render
27
- if gt_screen_height?(data_tree)
28
- output.tty? ? pager.page(view) : output.puts(view)
25
+ if paginable?
26
+ pager.page(render)
29
27
  else
30
- output.puts view
28
+ output.puts(render)
31
29
  end
32
30
  end
33
31
 
34
- private
32
+ def render
33
+ tree.render
34
+ end
35
+
36
+ def tree
37
+ @tree ||= TTY::Tree.new(build_tree)
38
+ end
39
+
40
+ def paginable?
41
+ gt_screen_height? && output.tty?
42
+ end
35
43
 
36
- attr_reader :crayon, :hash, :options, :output, :pager, :screen, :tree
44
+ def gt_screen_height?
45
+ tree.nodes.size > TTY::Screen.height
46
+ end
47
+
48
+ private
37
49
 
38
50
  def build_tree
39
- data_tree = hash.reduce({}) do |h, (faker, methods)|
51
+ result = hash.reduce({}) do |h, (faker, methods)|
40
52
  h.merge! node(faker, methods&.sort)
41
53
  end
42
- data_tree.sort_by(&:to_s).to_h
54
+
55
+ result.sort_by(&:to_s).to_h
43
56
  end
44
57
 
45
58
  def node(const, methods)
@@ -49,19 +62,13 @@ module FakerBot
49
62
  end
50
63
 
51
64
  def leaf(const, methods)
52
- (methods || []).map do |m|
53
- crayon.cyan(*leaf_args(m, const))
54
- end
65
+ (methods || []).map { |m| crayon.cyan(*leaf_args(m, const)) }
55
66
  end
56
67
 
57
68
  def leaf_args(method, const)
58
69
  [method.to_s].tap { |arr| verbose_output(method, const, arr) if verbose? }
59
70
  end
60
71
 
61
- def gt_screen_height?(data_tree)
62
- data_tree.nodes.size > screen.height
63
- end
64
-
65
72
  def verbose?
66
73
  options[:verbose]
67
74
  end
@@ -73,7 +80,7 @@ module FakerBot
73
80
 
74
81
  def faker_method(method, const)
75
82
  [const.public_send(method), ensure_method_is_supported(method, const)]
76
- rescue ArgumentError
83
+ rescue ArgumentError => _exception
77
84
  ['N/A', '']
78
85
  end
79
86
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FakerBot
4
- VERSION = '0.4.3'
4
+ VERSION = '0.4.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakerbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Kabiru
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-07 00:00:00.000000000 Z
11
+ date: 2019-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faker
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: pry
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -186,6 +200,7 @@ executables:
186
200
  extensions: []
187
201
  extra_rdoc_files: []
188
202
  files:
203
+ - ".github/main.workflow"
189
204
  - ".gitignore"
190
205
  - ".rspec"
191
206
  - ".rubocop.yml"
@@ -194,6 +209,7 @@ files:
194
209
  - CODE_OF_CONDUCT.md
195
210
  - Gemfile
196
211
  - Gemfile.lock
212
+ - Guardfile
197
213
  - LICENSE.txt
198
214
  - README.md
199
215
  - Rakefile
@@ -229,8 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
245
  - !ruby/object:Gem::Version
230
246
  version: '0'
231
247
  requirements: []
232
- rubyforge_project:
233
- rubygems_version: 2.6.8
248
+ rubygems_version: 3.0.2
234
249
  signing_key:
235
250
  specification_version: 4
236
251
  summary: A stympy/faker lookup command line tool.