Skip to content

Commit

Permalink
use rvm and bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
flyerhzm committed Oct 7, 2010
1 parent 634d8c2 commit 55d558e
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 129 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -5,3 +5,7 @@ lib/.DS_Store
.*.swp
coverage.data
tags
.bundle
.rvmrc
*.gem
Gemfile.lock
3 changes: 2 additions & 1 deletion .rspec
@@ -1 +1,2 @@
--colour --format d
--colour
--format nested
2 changes: 2 additions & 0 deletions .rvmrc.example
@@ -0,0 +1,2 @@
rvm_gemset_create_on_use_flag=1
rvm gemset use bullet
24 changes: 24 additions & 0 deletions .watchr
@@ -0,0 +1,24 @@
# vim:set filetype=ruby:
def run(cmd)
puts cmd
system cmd
end

def spec(file)
if File.exists?(file)
run("rspec #{file}")
else
puts("Spec: #{file} does not exist.")
end
end

watch("spec/.*/*_spec\.rb") do |match|
puts(match[0])
spec(match[0])
end

watch("lib/(.*/.*)\.rb") do |match|
puts(match[1])
spec("spec/#{match[1]}_spec.rb")
end

9 changes: 9 additions & 0 deletions Gemfile
@@ -0,0 +1,9 @@
# Use `bundle install` in order to install these gems
# Use `bundle exec rake` in order to run the specs using the bundle
source "http://rubygems.org"

gem 'rails', '3.0.0'
gem 'sqlite3-ruby', :require => 'sqlite3'

gem "rspec", "~> 2.0.0.rc"
gem "watchr", "~> 0.7"
2 changes: 1 addition & 1 deletion MIT-LICENSE
@@ -1,4 +1,4 @@
Copyright (c) 2009 Richard Huang (flyerhzm@gmail.com)
Copyright (c) 2009 - 2010 Richard Huang (flyerhzm@gmail.com)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
2 changes: 1 addition & 1 deletion README.textile
Expand Up @@ -412,4 +412,4 @@ In the meanwhile, there's a log appended into <code>log/bullet.log</code> file.
****************************************************************************


Copyright (c) 2009 Richard Huang (flyerhzm@gmail.com), released under the MIT license
Copyright (c) 2009 - 2010 Richard Huang (flyerhzm@gmail.com), released under the MIT license
2 changes: 1 addition & 1 deletion README_for_rails2.textile
Expand Up @@ -418,4 +418,4 @@ In the meanwhile, there's a log appended into <code>log/bullet.log</code> file.
****************************************************************************


Copyright (c) 2009 Richard Huang (flyerhzm@gmail.com), released under the MIT license
Copyright (c) 2009 - 2010 Richard Huang (flyerhzm@gmail.com), released under the MIT license
72 changes: 33 additions & 39 deletions Rakefile
@@ -1,51 +1,45 @@
require 'rake'
require 'rspec/core/rake_task'
require 'rake/rdoctask'
require 'jeweler'
require "bundler"
Bundler.setup

desc 'Default: run unit tests.'
task :default => :spec
require "rake"
require "rake/rdoctask"
require "rspec"
require "rspec/core/rake_task"

$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require "bullet/version"

desc 'Generate documentation for the bullet plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Bullet'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
task :build do
system "gem build bullet.gemspec"
end

RSpec::Core::RakeTask.new(:spec)
task :install => :build do
system "sudo gem install bullet-#{Bullet::VERSION}.gem"
end

desc "Run all examples using rcov"
RSpec::Core::RakeTask.new :rcov => :cleanup_rcov_files do |t|
t.rcov = true
t.rcov_opts = %[-Ilib -Ispec --exclude "gems/*,spec/spec_helper.rb"]
t.rcov_opts << %[--no-html --aggregate coverage.data]
task :release => :build do
puts "Tagging #{Bullet::VERSION}..."
system "git tag -a #{Bullet::VERSION} -m 'Tagging #{Bullet::VERSION}'"
puts "Pushing to Github..."
system "git push --tags"
puts "Pushing to rubygems.org..."
system "gem push bullet-#{Bullet::VERSION}.gem"
end

task :cleanup_rcov_files do
rm_rf 'coverage.data'
Rspec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = "spec/**/*_spec.rb"
end

task :clobber do
rm_rf 'pkg'
rm_rf 'tmp'
rm_rf 'coverage'
Rspec::Core::RakeTask.new('spec:progress') do |spec|
spec.rspec_opts = %w(--format progress)
spec.pattern = "spec/**/*_spec.rb"
end

begin
Jeweler::Tasks.new do |gemspec|
gemspec.name = "bullet"
gemspec.summary = "A rails plugin to kill N+1 queries and unused eager loading"
gemspec.description = "The Bullet plugin is designed to help you increase your application's performance by reducing the number of queries it makes. It will watch your queries while you develop your application and notify you when you should add eager loading (N+1 queries) or when you're using eager loading that isn't necessary."
gemspec.email = "flyerhzm@gmail.com"
gemspec.homepage = "http://github.com/flyerhzm/bullet"
gemspec.authors = ["Richard Huang"]
gemspec.files.exclude '.gitignore'
gemspec.files.exclude 'log/*'
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.title = "bullet #{Bullet::VERSION}"
rdoc.rdoc_files.include("README*")
rdoc.rdoc_files.include("lib/**/*.rb")
end

task :default => :spec
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

1 change: 0 additions & 1 deletion autotest/discover.rb

This file was deleted.

100 changes: 16 additions & 84 deletions bullet.gemspec
@@ -1,90 +1,22 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)

Gem::Specification.new do |s|
s.name = %q{bullet}
s.version = "2.0.0.rc1"
require "bullet/version"

s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["Richard Huang"]
s.date = %q{2010-08-10}
s.description = %q{The Bullet plugin is designed to help you increase your application's performance by reducing the number of queries it makes. It will watch your queries while you develop your application and notify you when you should add eager loading (N+1 queries) or when you're using eager loading that isn't necessary.}
s.email = %q{flyerhzm@gmail.com}
s.extra_rdoc_files = [
"README.textile",
"README_for_rails2.textile"
]
s.files = [
".rspec",
"Hacking.textile",
"MIT-LICENSE",
"README.textile",
"README_for_rails2.textile",
"Rakefile",
"VERSION",
"autotest/discover.rb",
"bullet.gemspec",
"lib/bullet.rb",
"lib/bullet/action_controller2.rb",
"lib/bullet/active_record2.rb",
"lib/bullet/active_record3.rb",
"lib/bullet/detector.rb",
"lib/bullet/detector/association.rb",
"lib/bullet/detector/base.rb",
"lib/bullet/detector/counter.rb",
"lib/bullet/detector/n_plus_one_query.rb",
"lib/bullet/detector/unused_eager_association.rb",
"lib/bullet/notification.rb",
"lib/bullet/notification/base.rb",
"lib/bullet/notification/counter_cache.rb",
"lib/bullet/notification/n_plus_one_query.rb",
"lib/bullet/notification/unused_eager_loading.rb",
"lib/bullet/notification_collector.rb",
"lib/bullet/presenter.rb",
"lib/bullet/presenter/base.rb",
"lib/bullet/presenter/bullet_logger.rb",
"lib/bullet/presenter/growl.rb",
"lib/bullet/presenter/javascript_alert.rb",
"lib/bullet/presenter/javascript_console.rb",
"lib/bullet/presenter/javascript_helpers.rb",
"lib/bullet/presenter/rails_logger.rb",
"lib/bullet/presenter/xmpp.rb",
"lib/bullet/rack.rb",
"lib/bullet/registry.rb",
"lib/bullet/registry/association.rb",
"lib/bullet/registry/base.rb",
"lib/bullet/registry/object.rb",
"rails/init.rb",
"spec/bullet/association_for_chris_spec.rb",
"spec/bullet/association_for_peschkaj_spec.rb",
"spec/bullet/association_spec.rb",
"spec/bullet/counter_spec.rb",
"spec/spec_helper.rb",
"tasks/bullet_tasks.rake"
]
s.homepage = %q{http://github.com/flyerhzm/bullet}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.6}
s.summary = %q{A rails plugin to kill N+1 queries and unused eager loading}
s.test_files = [
"spec/spec_helper.rb",
"spec/bullet/counter_spec.rb",
"spec/bullet/association_spec.rb",
"spec/bullet/association_for_chris_spec.rb",
"spec/bullet/association_for_peschkaj_spec.rb"
]
Gem::Specification.new do |s|
s.name = "bullet"
s.version = Bullet::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Richard Huang"]
s.email = ["flyerhzm@gmail.com"]
s.homepage = "http://github.com/flyerhzm/bullet"
s.summary = "A rails plugin to kill N+1 queries and unused eager loading."
s.description = "A rails plugin to kill N+1 queries and unused eager loading."

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
s.required_rubygems_version = ">= 1.3.6"

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
else
end
else
end
s.extra_rdoc_files = %w(MIT-LICENSE README.textile README_for_rails2.textile)
s.files = Dir.glob("lib/**/*") + %w(MIT-LICENSE README.textile README_for_rails2.textile)
s.require_path = 'lib'
end

5 changes: 5 additions & 0 deletions lib/bullet/version.rb
@@ -0,0 +1,5 @@
# encoding: utf-8
module Bullet
VERSION = "2.0.0"
end

0 comments on commit 55d558e

Please sign in to comment.