Skip to content

Commit

Permalink
Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
vbrazo committed Jul 9, 2019
1 parent ab2f2fd commit 0785c98
Show file tree
Hide file tree
Showing 21 changed files with 41 additions and 39 deletions.
10 changes: 6 additions & 4 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

Expand All @@ -24,8 +26,8 @@
# * zeus: 'zeus rspec' (requires the server to be started separately)
# * 'just' rspec: 'rspec'

guard :rspec, cmd: "bundle exec rspec" do
require "guard/rspec/dsl"
guard :rspec, cmd: 'bundle exec rspec' do
require 'guard/rspec/dsl'
dsl = Guard::RSpec::Dsl.new(self)

# Feel free to open issues for suggestions and improvements
Expand All @@ -41,7 +43,7 @@ guard :rspec, cmd: "bundle exec rspec" do
dsl.watch_spec_files_for(ruby.lib_files)

# Rails files
rails = dsl.rails(view_extensions: %w(erb haml slim))
rails = dsl.rails(view_extensions: %w[erb haml slim])
dsl.watch_spec_files_for(rails.app_files)
dsl.watch_spec_files_for(rails.views)

Expand All @@ -65,6 +67,6 @@ guard :rspec, cmd: "bundle exec rspec" do
# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
end
end
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# frozen_string_literal: true

require 'bundler/setup'
require 'faker/cli'
require 'faker/bot'

# 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.
Expand Down
8 changes: 4 additions & 4 deletions bin/faker
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

lib_path = File.expand_path('../lib', __dir__)
$LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include?(lib_path)
require 'faker/cli'
require 'faker/bot'

Signal.trap('INT') do
warn("\n#{caller.join("\n")}: interrupted")
exit(1)
end

begin
Faker::CLI::Base.start
rescue Faker::CLI::Base::Error => err
puts "ERROR: #{err.message}"
Faker::Bot::Base.start
rescue Faker::Bot::Base::Error => e
puts "ERROR: #{e.message}"
exit 1
end
4 changes: 2 additions & 2 deletions faker-cli.gemspec → faker-bot.gemspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "faker/cli/version"
require "faker/bot/version"

Gem::Specification.new do |spec|
spec.name = "faker-bot"
spec.version = Faker::CLI::VERSION
spec.version = Faker::Bot::VERSION
spec.authors = ["Austin Kabiru"]
spec.email = ["makabby@gmail.com"]

Expand Down
Binary file added faker-cli-0.4.5.gem
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/faker-bot.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# frozen_string_literal: true

require_relative 'faker/cli'
require_relative 'faker/bot'
16 changes: 8 additions & 8 deletions lib/faker/cli.rb → lib/faker/bot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

require 'thor'

require 'faker/cli/commands/list'
require 'faker/cli/commands/search'
require 'faker/cli/version'
require 'faker/bot/commands/list'
require 'faker/bot/commands/search'
require 'faker/bot/version'

module Faker
module CLI
module Bot
class Base < Thor
Error = Class.new(StandardError)
# Skip default deprecation warning output; the CLI will display that.
# Skip default deprecation warning output; the Bot will display that.
Gem::Deprecate.skip_during do
desc 'version', 'Faker version'
def version
puts "v#{Faker::CLI::VERSION}"
puts "v#{Faker::Bot::VERSION}"
end
map %w[--version -v] => :version

Expand All @@ -29,7 +29,7 @@ def list(*)
if options[:help]
invoke :help, ['list']
else
Faker::CLI::Commands::List.new(options).execute
Faker::Bot::Commands::List.new(options).execute
end
end

Expand All @@ -44,7 +44,7 @@ def search(query)
if options[:help]
invoke :help, ['search']
else
Faker::CLI::Commands::Search.new(options).execute(query)
Faker::Bot::Commands::Search.new(options).execute(query)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/faker/cli/command.rb → lib/faker/bot/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require_relative 'renderer'

module Faker
module CLI
module Bot
class Command
extend Forwardable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require_relative '../reflectors/list'

module Faker
module CLI
module Bot
module Commands
class List < Command
def execute(output: $stdout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require_relative '../reflectors/search'

module Faker
module CLI
module Bot
module Commands
class Search < Command
def execute(input, output: $stdout)
Expand Down
2 changes: 1 addition & 1 deletion lib/faker/cli/reflector.rb → lib/faker/bot/reflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'faker'

module Faker
module CLI
module Bot
# Abstract `Faker` Reflector - introspects the `Faker` module
#
# @api private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_relative '../reflector'

module Faker
module CLI
module Bot
module Reflectors
# List command reflector
# @api private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_relative '../reflector'

module Faker
module CLI
module Bot
module Reflectors
# Find command reflector
# @api private
Expand Down
4 changes: 2 additions & 2 deletions lib/faker/cli/renderer.rb → lib/faker/bot/renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require 'tty/tree'

module Faker
module CLI
module Bot
class Renderer
attr_reader :crayon, :hash, :options, :output, :pager

Expand Down Expand Up @@ -81,7 +81,7 @@ def verbose_output(method, const, arr)

def faker_method(method, const)
[const.public_send(method), ensure_method_is_supported(method, const)]
rescue ArgumentError => _exception
rescue ArgumentError => _e
['N/A', '']
end

Expand Down
2 changes: 1 addition & 1 deletion lib/faker/cli/version.rb → lib/faker/bot/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Faker
module CLI
module Bot
VERSION = '0.4.5'
end
end
4 changes: 2 additions & 2 deletions lib/faker/renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require 'tty/screen'
require 'tty/tree'

module Faker::CLI
module Faker::Bot
class Renderer
attr_reader :crayon, :hash, :options, :output, :pager

Expand Down Expand Up @@ -80,7 +80,7 @@ def verbose_output(method, const, arr)

def faker_method(method, const)
[const.public_send(method), ensure_method_is_supported(method, const)]
rescue ArgumentError => _exception
rescue ArgumentError => _e
['N/A', '']
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

require 'faker/cli/commands/list'
require 'faker/bot/commands/list'

RSpec.describe Faker::CLI::Commands::List do
RSpec.describe Faker::Bot::Commands::List do
let(:output) { StringIO.new }
let(:options) { {} }
let(:command) { Faker::CLI::Commands::List.new(options) }
let(:command) { Faker::Bot::Commands::List.new(options) }

before do
command.execute(output: output)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

require 'faker/cli/commands/search'
require 'faker/bot/commands/search'

RSpec.describe Faker::CLI::Commands::Search do
RSpec.describe Faker::Bot::Commands::Search do
context 'when query object exists' do
it 'returns results' do
output = StringIO.new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'spec_helper'

RSpec.describe Faker::CLI::Reflectors::List do
RSpec.describe Faker::Bot::Reflectors::List do
describe '#call' do
context 'when show methods is enabled' do
it 'returns all descendants and their methods' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'spec_helper'

RSpec.describe Faker::CLI::Reflectors::Search do
RSpec.describe Faker::Bot::Reflectors::Search do
describe '#call' do
context 'when a match is found' do
it 'it returns the list of matches' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def self.bar
end
end

RSpec.describe Faker::CLI::Renderer do
RSpec.describe Faker::Bot::Renderer do
describe '#call' do
# FIXME: work out how to capture less
xcontext 'when paginable interface' do
Expand Down

0 comments on commit 0785c98

Please sign in to comment.