gen/lib/gen/generator.rb in cli-kit-3.3.0 vs gen/lib/gen/generator.rb in cli-kit-4.0.0
- old
+ new
@@ -16,24 +16,24 @@
private_constant :VALID_PROJECT_NAME
# false -> delete file
# string -> rename file before applying template substitutions
VENDOR_TRANSLATIONS = {
- 'Gemfile' => false,
- 'exe/__app__-gems' => false,
+ 'Gemfile' => false,
+ 'exe/__app__-gems' => false,
'exe/__app__-vendor' => 'exe/__app__',
- 'dev-gems.yml' => false,
- 'dev-vendor.yml' => 'dev.yml',
+ 'dev-gems.yml' => false,
+ 'dev-vendor.yml' => 'dev.yml',
}.freeze
private_constant :VENDOR_TRANSLATIONS
BUNDLER_TRANSLATIONS = {
- 'bin/update-deps' => false,
- 'exe/__app__-gems' => 'exe/__app__',
+ 'bin/update-deps' => false,
+ 'exe/__app__-gems' => 'exe/__app__',
'exe/__app__-vendor' => false,
- 'dev-gems.yml' => 'dev.yml',
- 'dev-vendor.yml' => false,
+ 'dev-gems.yml' => 'dev.yml',
+ 'dev-vendor.yml' => false,
}.freeze
private_constant :BUNDLER_TRANSLATIONS
def initialize(project_name)
raise(
@@ -56,12 +56,12 @@
end
private
def ask_vendor?
- return 'vendor' if ENV['DEPS'] == 'vendor'
- return 'bundler' if ENV['DEPS'] == 'bundler'
+ return true if ENV['DEPS'] == 'vendor'
+ return false if ENV['DEPS'] == 'bundler'
vendor = nil
CLI::UI::Frame.open('Configuration') do
q = 'How would you like the application to consume {{command:cli-kit}} and {{command:cli-ui}}?'
vendor = CLI::UI::Prompt.ask(q) do |c|
@@ -114,10 +114,10 @@
def clone(dir, repo)
info(clone: repo)
out, stat = Open3.capture2e('git', '-C', dir, 'clone', "https://github.com/shopify/#{repo}")
unless stat.success?
STDERR.puts(out)
- error("git clone failed")
+ error('git clone failed')
end
end
def each_template_file
return enum_for(:each_template_file) unless block_given?