Skip to content

Commit

Permalink
Changes for gem release
Browse files Browse the repository at this point in the history
  • Loading branch information
BDQ committed Jan 21, 2011
1 parent 84884d4 commit 738c9a6
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.swp
spec/test_app
32 changes: 32 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
source 'http://rubygems.org'

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

group :test do
gem 'rspec-rails', '= 2.4.1'
gem 'factory_girl_rails'
gem 'rcov'
gem 'shoulda'
gem 'faker'
if RUBY_VERSION < "1.9"
gem "ruby-debug"
else
gem "ruby-debug19"
end
end

group :cucumber do
gem 'cucumber-rails'
gem 'database_cleaner', '~> 0.5.2'
gem 'nokogiri'
gem 'capybara'
gem 'factory_girl_rails'
gem 'faker'
gem 'launchy'

if RUBY_VERSION < "1.9"
gem "ruby-debug"
else
gem "ruby-debug19"
end
end
67 changes: 25 additions & 42 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#require File.expand_path('../../config/application', __FILE__)

# encoding: utf-8
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'

desc "Default Task"
task :default => [ :spec ]

gemfile = File.expand_path('../spec/test_app/Gemfile', __FILE__)
if File.exists?(gemfile)
if File.exists?(gemfile) && %w(rcov spec cucumber).include?(ARGV.first.to_s)
require 'bundler'
ENV['BUNDLE_GEMFILE'] = gemfile
Bundler.setup
Expand All @@ -19,62 +19,45 @@ if File.exists?(gemfile)
Cucumber::Rake::Task.new do |t|
t.cucumber_opts = %w{--format pretty}
end
end


spec = eval(File.read('spree_comments.gemspec'))

Rake::GemPackageTask.new(spec) do |p|
p.gem_spec = spec
end
desc "Run specs with RCov"
RSpec::Core::RakeTask.new(:rcov) do |t|
t.rcov = true
t.rcov_opts = %w{ --exclude gems\/,spec\/,features\/}
t.verbose = true
end

desc "Release to gemcutter"
task :release => :package do
require 'rake/gemcutter'
Rake::Gemcutter::Tasks.new(spec).define
Rake::Task['gem:push'].invoke
end

desc "Default Task"
task :default => [ :spec ]

# TODO: pull in the spree/core/Rakefile bits that set up for testing
desc "Regenerates a Rails 3 app for testing"
desc "Regenerates a rails 3 app for testing"
task :test_app do
# TODO - this path requires a certain directory structure -- need
# to think about how to refactor
require '../spree/lib/generators/spree/test_app_generator'
class SpreeCommentsTestAppGenerator < Spree::Generators::TestAppGenerator
SPREE_PATH = ENV['SPREE_PATH']
raise "SPREE_PATH should be specified" unless SPREE_PATH
require File.join(SPREE_PATH, 'lib/generators/spree/test_app_generator')
class AuthTestAppGenerator < Spree::Generators::TestAppGenerator
def tweak_gemfile
append_file "Gemfile" ,
<<-gems
gem 'spree_core', '>=0.30.0'
gem 'spree_auth', '>=0.30.0'
gem 'spree_comments', :path => "#{File.dirname(__FILE__)}"
gems
append_file 'Gemfile' do
<<-gems
gem 'spree_core', :path => '#{File.join(SPREE_PATH, 'core')}'
gem 'spree_auth', :path => '#{File.join(SPREE_PATH, 'auth')}'
gem 'spree_comments', :path => '#{File.dirname(__FILE__)}'
gems
end
end

def install_spree_gems
def install_gems
inside "test_app" do
run 'rake spree_core:install'
run 'rake spree_auth:install'
run 'rake spree_comments:install'
end
end

# def install_spree_auth
# inside "test_app" do
# run 'rake spree_auth:install'
# end
# end

def migrate_db
run_migrations
end
end
SpreeCommentsTestAppGenerator.start
AuthTestAppGenerator.start
end

namespace :test_app do
Expand Down
11 changes: 5 additions & 6 deletions spree_comments.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ Gem::Specification.new do |s|
s.email = '[email protected]'
s.required_ruby_version = '>= 1.8.7'

s.files = Dir['CHANGELOG', 'README.md', 'LICENSE', 'lib/**/*', 'app/**/*']
s.require_path = 'lib'
s.requirements << 'none'

s.has_rdoc = true
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.require_paths = ["lib"]
s.has_rdoc = false

s.add_dependency('spree_core', '>=0.30.0')
s.add_dependency('acts_as_commentable')
s.add_dependency('acts_as_commentable', '3.0.0')
end

0 comments on commit 738c9a6

Please sign in to comment.