Skip to content

Commit

Permalink
Move code to lib/
Browse files Browse the repository at this point in the history
Also rename `bin/` directory to `exe/` (there are not binaries!).
  • Loading branch information
AlexWayfer committed Apr 9, 2020
1 parent 7bb4d9f commit e0d0928
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
6 changes: 6 additions & 0 deletions exe/flame
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require_relative '../lib/flame/cli'

Flame::CLI.run
1 change: 1 addition & 0 deletions flame-cli.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'simplecov', '~> 0.16'

s.files = Dir.glob('{lib,template}/**/*', File::FNM_DOTMATCH)
s.bindir = 'exe'
s.executables = ['flame']
end
5 changes: 1 addition & 4 deletions bin/flame → lib/flame/cli.rb
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'clamp'

require_relative 'new'
require_relative 'cli/new'

module Flame
## CLI for Flame
class CLI < Clamp::Command
subcommand %w[initialize init new], 'create new entity', Flame::CLI::New
end
end

Flame::CLI.run
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/new/app.rb → lib/flame/cli/new/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def make_dir(&block)

def copy_template
puts 'Copy template directories and files...'
FileUtils.cp_r File.join(__dir__, '../../template/.'), '.'
FileUtils.cp_r File.join(__dir__, '../../../../template/.'), '.'
clean_dirs
render_templates
end
Expand Down
7 changes: 4 additions & 3 deletions spec/flame/cli/new/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@

let(:app_name) { 'foo_bar' }

let(:template_dir) { "#{__dir__}/../../../../template" }
let(:root_dir) { "#{__dir__}/../../../.." }
let(:template_dir) { "#{root_dir}/template" }
let(:template_dir_pathname) { Pathname.new(template_dir) }
let(:template_ext) { '.erb' }
let(:template_ext) { '.erb' }

after do
FileUtils.rm_r "#{__dir__}/../../../../#{app_name}"
FileUtils.rm_r "#{root_dir}/#{app_name}"
end

describe 'output' do
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

require 'pry-byebug'

FLAME_CLI = File.join(__dir__, '../bin/flame').freeze
FLAME_CLI = File.join(__dir__, '../exe/flame').freeze

def transform_words_into_regexp(*words)
words.map { |word| "(?=.*#{Regexp.escape(word)})" }.join
Expand Down

0 comments on commit e0d0928

Please sign in to comment.