bin/methadone in methadone-1.5.1 vs bin/methadone in methadone-1.6.0
- old
+ new
@@ -48,23 +48,36 @@
template_dirs_in(:test_unit).each { |dir| mkdir_p dir }
copy_file "test/tc_something.rb", :from => :test_unit, :binding => binding
end
+ gemspec = "#{gemname}.gemspec"
+ gem_variable = File.open(gemspec) { |x| x.read }.match(/(\w+)\.executables/)[1]
+
license = options[:license]
warn "warning: your app has no license" unless license
license = nil if license == 'NONE'
- copy_file "#{options[:license]}_LICENSE.txt", :as => "LICENSE.txt" if license
+ if license
+ copy_file "#{options[:license]}_LICENSE.txt", :as => "LICENSE.txt"
+ else
+ #Remove the MIT license generated by `bundle gem`
+ debug "Making sure no LICENSE.txt file exists at the root of the repo"
+ FileUtils.rm_f "LICENSE.txt"
+ end
+ #Ensure the gemspec file mentions the correct license
+ gemspec_content = File.read(gemspec)
+ gemspec_content.gsub!(/(^\s*#{gem_variable}\.license\s*=\s*).*/,"\\1#{license.to_s.inspect}")
+ File.open(gemspec,'w') {|f| f.write gemspec_content }
+
+
copy_file "README.rdoc", :binding => binding if using_readme
copy_file "features/executable.feature", :as => "#{gemname}.feature", :binding => binding
copy_file "features/step_definitions/executable_steps.rb", :as => "#{gemname}_steps.rb"
copy_file "bin/executable", :as => gemname, :executable => true, :binding => binding
- gemspec = "#{gemname}.gemspec"
- gem_variable = File.open(gemspec) { |x| x.read }.match(/(\w+)\.executables/)[1]
add_to_file gemspec, [
" #{gem_variable}.add_development_dependency('rdoc')",
" #{gem_variable}.add_development_dependency('aruba')",
" #{gem_variable}.add_development_dependency('rake', '~> 0.9.2')",
" #{gem_variable}.add_dependency('methadone', '~> #{Methadone::VERSION}')",
@@ -73,9 +86,11 @@
if rspec
add_to_file gemspec, [
" #{gem_variable}.add_development_dependency('rspec', '~> 2.99')",
], :before => /^end\s*$/
end
+
+ sh! %q(git add --all .)
end
options[:readme] = true
description "Kick the bash habit by bootstrapping your Ruby command-line apps"