add script/console

This commit is contained in:
technoweenie 2012-12-28 00:16:34 -07:00
parent 1aed2d1b17
commit 5f1d2bf19e
2 changed files with 28 additions and 0 deletions

6
script/console Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'irb'
require File.expand_path("../ruby", __FILE__)
require File.expand_path("../../lib/#{MakeScript.lib_name}", __FILE__)
IRB.start

22
script/ruby.rb Normal file
View File

@ -0,0 +1,22 @@
module MakeScript
extend self
def lib_name
@lib_name ||= Dir['*.gemspec'].first.split('.').first
end
def version
@version ||= begin
line = File.read("lib/#{lib_name}.rb")[/^\s*VERSION\s*=\s*.*/]
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
end
end
def gemspec_file
@gemspec_file ||= "#{lib_name}.gemspec"
end
def gem_file
@gem_file ||= "#{lib_name}-#{version}.gem"
end
end