class Pickaxe::Generator

Public Class Methods

source_root() click to toggle source
# File lib/pickaxe/generator.rb, line 10
def self.source_root
  File.expand_path(File.dirname(__FILE__) +'/templates')
end

Public Instance Methods

run_bundle() click to toggle source
# File lib/pickaxe/generator.rb, line 14
def run_bundle
  run "bundle gem #{gem_name}", :verbose => false
end
setup_project() click to toggle source
# File lib/pickaxe/generator.rb, line 18
    def setup_project
      remove_file "#{gem_name}/Rakefile"
      remove_file "#{gem_name}/Gemfile"
      
      directory "test"

      template 'test_helper.tt',  "#{gem_name}/test/test_helper.rb"
      template 'Guardfile.tt',    "#{gem_name}/Guardfile"
      template 'Gemfile.tt',      "#{gem_name}/Gemfile"
      template 'Rakefile.tt',     "#{gem_name}/Rakefile"

      inside gem_name do
        create_file "test/#{gem_name}_test.rb" do
          <<-EOS
require 'test_helper'

describe #{gem_name.classify} do
  subject { #{gem_name.classify} }

end
EOS
        end

        append_to_file "test/test_helper.rb" do
          "require '#{gem_name}'"
        end
      end
      
      bundle

      commit "Initial gem creation with testing!"
    end

Private Instance Methods

bundle() click to toggle source
# File lib/pickaxe/generator.rb, line 60
def bundle
  inside gem_name do 
    run "bundle install"
  end
end
commit(msg) click to toggle source
# File lib/pickaxe/generator.rb, line 53
def commit(msg)
  inside gem_name do 
    run "git add ."
    run "git commit -m '#{msg}'"
  end
end