Skip to content

Instantly share code, notes, and snippets.

@sumbach
Created January 16, 2011 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sumbach/781594 to your computer and use it in GitHub Desktop.
Save sumbach/781594 to your computer and use it in GitHub Desktop.
pkg/*
*.gem
.bundle
  • What version of bundler you are using

    $ bundle -v Bundler version 1.0.7

  • What version of Ruby you are using

    $ ruby -v ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.1], MBARI 0x6770, Ruby Enterprise Edition 2010.02

  • Whether you are using RVM, and if so what version

    $ rvm -v rvm 1.1.0 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]

  • Your Gemfile

    included in the gist (generated by bundle create example-gem)

  • Your Gemfile.lock

    included in the gist

  • If you are on 1.0, the result of bundle config

    $ bundle config Settings are listed in order of priority. The top value will be used.

  • The command you ran to generate exception(s)

    bundle exec ./bin/example-executable

  • The exception backtrace(s)

    Not an exception, but notice the git errors. These are caused by git git ls-files commands in the .gemspec because the .gemspec is being evaluated in the current directory instead of the directory containing the .gemspec. Note the difference in behavior between running ./bin/example-executable and bundle exec ./bin/example-executable

#!/usr/bin/env ruby
require 'fileutils'
if ARGV.size > 0
puts "Hello again"
exit
end
puts "Hello, World!"
puts "I'm going to run myself recursively from another directory now..."
executable = File.expand_path($0)
begin
temp_dir = "/tmp/example-gem-#{rand(1000)}"
FileUtils.mkdir_p temp_dir
Dir.chdir(temp_dir) do
system "#{executable} recursive"
end
ensure
FileUtils.rm_rf temp_dir
end
puts "I'm back!"
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "example-gem/version"
Gem::Specification.new do |s|
s.name = "example-gem"
s.version = Example::Gem::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["TODO: Write your name"]
s.email = ["TODO: Write your email address"]
s.homepage = ""
s.summary = %q{TODO: Write a gem summary}
s.description = %q{TODO: Write a gem description}
s.rubyforge_project = "example-gem"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
end
module Example
module Gem
# Your code goes here...
end
end
source "http://rubygems.org"
# Specify your gem's dependencies in example-gem.gemspec
gemspec
PATH
remote: .
specs:
example-gem (0.0.1)
GEM
remote: http://rubygems.org/
specs:
PLATFORMS
ruby
DEPENDENCIES
example-gem!
require 'bundler'
Bundler::GemHelper.install_tasks
module Example
module Gem
VERSION = "0.0.1"
end
end
@ahoward
Copy link

ahoward commented Jan 21, 2011

what's even worse is this means one cannot use these types of gems unless the gem directory has the proper .git directory in it.... sigh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment