Skip to content

Commit

Permalink
Update gem structure from current boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDaugherty committed Dec 17, 2020
1 parent d37b6ac commit e4bd25e
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 79 deletions.
16 changes: 14 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
*.o
*.bundle
Gemfile.lock

/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
*.bundle
*.so
*.o
*.a
mkmf.log
Makefile
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ RubyVM::DebugInspector.open { |dc|
}
```

Development
-----------

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

Contact
-------

Expand Down
73 changes: 8 additions & 65 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,77 +1,20 @@
$:.unshift 'lib'
require 'rake/clean'
require 'rake/testtask'

dlext = RbConfig::CONFIG['DLEXT']
direc = File.expand_path(File.dirname(__FILE__))
CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o")
CLEAN.include("ext/**/*.#{dlext}", "ext/**/*.log", "ext/**/*.o",
"ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "**/*#*", "**/*#*.*",
"ext/**/*.def", "ext/**/*.pdb", "**/*_flymake*.*", "**/*_flymake", "**/*.rbc")
require "bundler/gem_tasks"
require "rake/testtask"

Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
t.warning = true
t.verbose = true
end

desc "Show version"
task :version do
require "rubyvm/debug_inspector/version"
puts "debug_inspector version: #{RubyVM::DebugInspector::VERSION}"
end

desc "run tests"
task :default => [:compile, :test]

task :pry do
puts "loading debug_inspector into pry"
sh "pry -Ilib -rdebug_inspector"
end

desc "build the binaries"
task :compile do
chdir "#{direc}/ext/rubyvm/debug_inspector/" do
sh "ruby extconf.rb"
sh "make clean"
sh "make"
sh "cp *.#{dlext} ../../../lib/rubyvm/"
end
end

desc 'cleanup the extensions'
task :cleanup do
sh "rm -rf lib/debug_inspector.#{dlext}"
chdir "#{direc}/ext/rubyvm/debug_inspector/" do
sh 'make clean' rescue nil
end
end

desc "(re)install gem"
task :reinstall => :gem do
require "rubyvm/debug_inspector/version"
sh "gem uninstall debug_inspector" rescue nil
sh "gem install -l #{direc}/debug_inspector-#{RubyVM::DebugInspector::VERSION}.gem"
end
require "rake/extensiontask"

task :install => :reinstall
task :build => :compile

desc "build all platform gems at once"
task :gem => [:clean, :rmgems] do
sh "gem build #{direc}/debug_inspector.gemspec"
Rake::ExtensionTask.new("rubyvm/debug_inspector") do |ext|
ext.lib_dir = "lib"
end

desc "remove all platform gems"
task :rmgems do
sh "rm #{direc}/*.gem" rescue nil
end

desc "build and push latest gems"
task :pushgems => :gem do
chdir(direc) do
Dir["*.gem"].each do |gemfile|
sh "gem push #{gemfile}"
end
end
end
task :default => [:clobber, :compile, :test]
14 changes: 14 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "debug_inspector"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start(__FILE__)
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
2 changes: 2 additions & 0 deletions ext/rubyvm/debug_inspector/extconf.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "mkmf"

def fake_makefile
File.open(File.join(File.dirname(__FILE__), "Makefile"), "w") {|f|
f.puts %[install:\n\techo "Nada."]
Expand Down
3 changes: 2 additions & 1 deletion test/basic_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require_relative "test_helper"
require "test_helper"

class BasicTest < MiniTest::Test
def test_version
assert(RubyVM::DebugInspector::VERSION)
Expand Down
15 changes: 4 additions & 11 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
begin
require 'bundler/setup'
rescue LoadError
# Bundler is missing. This should happen rarely (eg while running tests from Fedora package).
# See https://github.com/banister/debug_inspector/pull/16 for more details.
$LOAD_PATH.push File.expand_path(File.join("..", "lib"), File.dirname(__FILE__))
warn "WARN: Bundler is not being used."
end
require 'minitest'
require 'minitest/autorun'
require 'debug_inspector'
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "debug_inspector"

require "minitest/autorun"

0 comments on commit e4bd25e

Please sign in to comment.