diff --git a/Gemfile.lock b/Gemfile.lock index 1601f1b..0780a53 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - namespacer (0.1.0) + namespacer-rb (0.1.3) parser (~> 3) tty-command (~> 0.10) unparser (~> 0.6) @@ -70,7 +70,7 @@ PLATFORMS DEPENDENCIES minitest (~> 5.16) - namespacer! + namespacer-rb! pry-byebug rake (~> 13.0) rubocop (~> 1.21) diff --git a/bin/namespacer b/bin/namespacer new file mode 100755 index 0000000..bc7fad2 --- /dev/null +++ b/bin/namespacer @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'namespacer' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) + +bundle_binstub = File.expand_path('bundle', __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300).include?('This file was generated by Bundler') + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('namespacer-rb', 'namespacer') diff --git a/exe/namespacer b/exe/namespacer index c0d0794..72672c0 100755 --- a/exe/namespacer +++ b/exe/namespacer @@ -28,6 +28,11 @@ parser = OptionParser.new do |opts| opts.on('-i', '--in-place', 'Modify files in-place') { |_| options.in_place = true } + opts.on('-V', '--version', 'Print version') do + puts "namespacer #{Rubyists::Namespacer::VERSION}" + exit + end + opts.on('-v', '--verbose', 'Verbose output') do options.verbose = true end