Skip to content

Commit

Permalink
Merge branch 'master' into sinatra
Browse files Browse the repository at this point in the history
Conflicts:
	Rakefile
	bin/gem_template
	features/step_definitions/when.rb
	require.rb
  • Loading branch information
winton committed Jun 29, 2010
2 parents 37a14c0 + 2745c80 commit 1b94dcd
Show file tree
Hide file tree
Showing 11 changed files with 254 additions and 15 deletions.
52 changes: 52 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
source "http://rubygems.org"

v = {
:active_wrapper => '=0.2.7',
:bundler => '=1.0.0.beta.2',
:cucumber => '=0.6.2',
:haml => '=2.2.17',
:lilypad => '=0.3.0',
:rack_flash => '=0.1.1',
:rack_test => '=0.5.3',
:rake => '=0.8.7',
:rspec => '=1.3.0',
:sinatra => '=1.0'
}

group :console do
gem 'active_wrapper', v[:active_wrapper], :require => %w(active_wrapper)
gem 'sinatra', v[:sinatra], :require => %w(sinatra/base)
end

group :gemspec do
gem 'active_wrapper', v[:active_wrapper], :require => %w(active_wrapper)
gem 'bundler', v[:bundler]
gem 'haml', v[:haml]
gem 'lilypad', v[:lilypad]
gem 'rack-flash', v[:rack_flash]
gem 'sinatra', v[:sinatra]
end

group :gemspec_dev do
gem 'cucumber', v[:cucumber]
gem 'rspec', v[:rspec]
gem 'rack-test', v[:rack_test]
end

group :lib do
gem 'active_wrapper', v[:active_wrapper], :require => %w(active_wrapper)
gem 'haml', v[:haml], :require => %w(haml sass)
gem 'lilypad', v[:lilypad], :require => %w(lilypad)
gem 'rack-flash', v[:rack_flash], :require => %w(rack-flash)
gem 'sinatra', v[:sinatra], :require => %w(sinatra/base)
end

group :rake do
gem 'active_wrapper', v[:active_wrapper], :require => %w(active_wrapper/tasks)
gem 'rake', v[:rake], :require => %w(rake rake/gempackagetask)
gem 'rspec', v[:rspec], :require => %w(spec/rake/spectask)
end

group :spec do
gem 'rack-test', v[:rack_test], :require => %w(rack/test)
end
102 changes: 102 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
GEM
remote: http://rubygems.org/
specs:
actionmailer (2.3.5)
actionpack (= 2.3.5)
actionmailer (2.3.5)
actionpack (= 2.3.5)
actionpack (2.3.5)
activesupport (= 2.3.5)
rack (~> 1.0.0)
actionpack (2.3.5)
activesupport (= 2.3.5)
rack (~> 1.0.0)
active_wrapper (0.2.7)
actionmailer (= 2.3.5)
activerecord (= 2.3.5)
active_wrapper (0.2.7)
actionmailer (= 2.3.5)
activerecord (= 2.3.5)
activerecord (2.3.5)
activesupport (= 2.3.5)
activerecord (2.3.5)
activesupport (= 2.3.5)
activesupport (2.3.5)
activesupport (2.3.5)
builder (2.1.2)
builder (2.1.2)
cucumber (0.6.2)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
json_pure (>= 1.2.0)
polyglot (>= 0.2.9)
term-ansicolor (>= 1.0.4)
treetop (>= 1.4.2)
cucumber (0.6.2)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
json_pure (>= 1.2.0)
polyglot (>= 0.2.9)
term-ansicolor (>= 1.0.4)
treetop (>= 1.4.2)
diff-lcs (1.1.2)
diff-lcs (1.1.2)
haml (2.2.17)
haml (2.2.17)
json_pure (1.2.0)
json_pure (1.2.0)
lilypad (0.3.0)
builder (>= 2.1.2)
lilypad (0.3.0)
builder (>= 2.1.2)
polyglot (0.2.9)
polyglot (0.2.9)
rack (1.0.1)
rack (1.0.1)
rack-flash (0.1.1)
rack
rack-flash (0.1.1)
rack
rack-test (0.5.3)
rack (>= 1.0)
rack-test (0.5.3)
rack (>= 1.0)
rake (0.8.7)
rake (0.8.7)
rspec (1.3.0)
rspec (1.3.0)
sinatra (1.0)
rack (>= 1.0)
sinatra (1.0)
rack (>= 1.0)
term-ansicolor (1.0.4)
term-ansicolor (1.0.4)
treetop (1.4.3)
polyglot (>= 0.2.5)
treetop (1.4.3)
polyglot (>= 0.2.5)

PLATFORMS
ruby

DEPENDENCIES
active_wrapper (= 0.2.7)
active_wrapper (= 0.2.7)
active_wrapper (= 0.2.7)
active_wrapper (= 0.2.7)
bundler (= 1.0.0.beta.2)
cucumber (= 0.6.2)
haml (= 2.2.17)
haml (= 2.2.17)
lilypad (= 0.3.0)
lilypad (= 0.3.0)
rack-flash (= 0.1.1)
rack-flash (= 0.1.1)
rack-test (= 0.5.3)
rack-test (= 0.5.3)
rake (= 0.8.7)
rspec (= 1.3.0)
rspec (= 1.3.0)
sinatra (= 1.0)
sinatra (= 1.0)
sinatra (= 1.0)
2 changes: 1 addition & 1 deletion MIT-LICENSE → LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2009 Winton Welsh
Copyright (c) 2010 Winton Welsh

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
File renamed without changes.
51 changes: 47 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
require "#{File.dirname(__FILE__)}/require"
Require.rakefile!
require 'rubygems'
require 'bundler'

Bundler.require(:rake)

def gemspec
@gemspec ||= begin
file = File.expand_path('../gem_template.gemspec', __FILE__)
eval(File.read(file), binding, file)
end
end

if defined?(ActiveWrapper::Tasks)
ActiveWrapper::Tasks.new(
Expand All @@ -8,10 +17,43 @@ if defined?(ActiveWrapper::Tasks)
)
end

# You can delete this after you use it
if defined?(Rake::GemPackageTask)
Rake::GemPackageTask.new(gemspec) do |pkg|
pkg.gem_spec = gemspec
end
task :gem => :gemspec
end

if defined?(Spec::Rake::SpecTask)
desc "Run specs"
Spec::Rake::SpecTask.new do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = %w(-fs --color)
t.warning = true
end
task :spec
end

desc "Install gem locally"
task :install => :package do
sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}}
end

desc "Validate the gemspec"
task :gemspec do
gemspec.validate
end

task :package => :gemspec
task :default => :spec

# DELETE AFTER USING
desc "Rename project"
task :rename do
name = ENV['NAME'] || File.basename(Dir.pwd)
camelize = lambda do |str|
str.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
end
begin
dir = Dir['**/gem_template*']
from = dir.pop
Expand All @@ -24,7 +66,8 @@ task :rename do
Dir["**/*"].each do |path|
next if path.include?('Rakefile')
if File.file?(path)
`sed -i "" 's/gem_template/#{name}/g' #{path}`
`sed -i 's/gem_template/#{name}/g' #{path}`
`sed -i 's/GemTemplate/#{camelize.call(name)}/g' #{path}`
end
end
end
19 changes: 17 additions & 2 deletions lib/gem_template.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
require File.expand_path("#{File.dirname(__FILE__)}/../require")
Require.lib!
require 'rubygems'
require 'bundler'

Bundler.require(:lib)

$:.unshift File.dirname(__FILE__) + '/gem_template'

require 'version'
require 'boot/application'
require 'boot/sinatra'
require 'boot/session'
require 'boot/flash'
require 'boot/active_wrapper'
require 'boot/lilypad'
require 'boot/controller'
require 'boot/helper'
require 'boot/model'
11 changes: 9 additions & 2 deletions lib/gem_template/boot/console.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
require File.expand_path("#{File.dirname(__FILE__)}/../../../require")
Require.console!
require 'rubygems'
require 'bundler'

Bundler.require(:console)

require File.dirname(__FILE__) + '/application'
require File.dirname(__FILE__) + '/sinatra'
require File.dirname(__FILE__) + '/active_wrapper'
require File.dirname(__FILE__) + '/model'
2 changes: 0 additions & 2 deletions lib/gem_template/boot/lilypad.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Require.lilypad!

Application.class_eval do

if File.exists?(lilypad = "#{root}/config/lilypad.txt")
Expand Down
3 changes: 3 additions & 0 deletions lib/gem_template/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module GemTemplate
VERSION = "0.1.0" unless defined?(::GemTemplate::VERSION)
end
6 changes: 5 additions & 1 deletion script/console
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/bin/env ruby

exec "irb -r #{File.expand_path("#{File.dirname(__FILE__)}/../lib/gem_template/boot/console")}"
require 'rubygems'
require 'bundler'

lib = File.expand_path(File.dirname(__FILE__) + "/../lib/gem_template")
exec "irb -r #{lib}/boot/console"
21 changes: 18 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
require File.expand_path("#{File.dirname(__FILE__)}/../require")
Require.spec_helper!
require 'rubygems'
require 'bundler'

Bundler.require(:spec)

require 'lib/gem_template'
require 'pp'

Spec::Runner.configure do |config|
end
end

SPEC = File.expand_path("#{Bundler.root}/spec")
$:.unshift File.expand_path("#{Bundler.root}/lib")

# For use with rspec textmate bundle
def debug(object)
puts "<pre>"
puts object.pretty_inspect.gsub('<', '&lt;').gsub('>', '&gt;')
puts "</pre>"
end

0 comments on commit 1b94dcd

Please sign in to comment.