Skip to content
Browse files

Merge branch 'sinatra' of github.com:winton/gem_template

Conflicts:
	lib/a_b_front_end.rb
	lib/a_b_front_end/boot/console.rb
	require.rb
	script/console
	spec/spec_helper.rb
  • Loading branch information...
2 parents 89b5857 + a35b577 commit 6fa9538e3931790e8d84a4ba2f68e8b1e97f19a3 @winton committed
Showing with 598 additions and 240 deletions.
  1. +0 −1 .gitignore
  2. +57 −0 Gemfile
  3. +103 −0 Gemfile.lock
  4. +2 −2 MIT-LICENSE → LICENSE
  5. +2 −2 README.markdown → README.md
  6. +39 −21 Rakefile
  7. +30 −0 a_b_front_end.gemspec
  8. +1 −1 config.ru
  9. +1 −1 config/a_b.yml
  10. +1 −1 config/database.example.yml
  11. +1 −1 config/externals.yml
  12. +1 −1 config/mail.example.yml
  13. +1 −1 db/migrate/001_users.rb
  14. +1 −1 features/example.feature
  15. +1 −1 features/support/env.rb
  16. +1 −1 features/support/rspec.rb
  17. +1 −1 features/support/webrat.rb
  18. +18 −2 lib/a_b_front_end.rb
  19. +1 −1 lib/a_b_front_end/boot/active_wrapper.rb
  20. +1 −1 lib/a_b_front_end/boot/application.rb
  21. +9 −2 lib/a_b_front_end/boot/console.rb
  22. +1 −1 lib/a_b_front_end/boot/controller.rb
  23. +1 −1 lib/a_b_front_end/boot/flash.rb
  24. +1 −1 lib/a_b_front_end/boot/helper.rb
  25. +1 −3 lib/a_b_front_end/boot/lilypad.rb
  26. +1 −1 lib/a_b_front_end/boot/model.rb
  27. +1 −1 lib/a_b_front_end/boot/session.rb
  28. +1 −1 lib/a_b_front_end/boot/sinatra.rb
  29. +1 −1 lib/a_b_front_end/controller/api.rb
  30. +1 −1 lib/a_b_front_end/controller/front.rb
  31. +1 −1 lib/a_b_front_end/helper/application.rb
  32. +1 −1 lib/a_b_front_end/model/user.rb
  33. +3 −0 lib/a_b_front_end/version.rb
  34. +1 −1 lib/a_b_front_end/view/layout.haml
  35. +1 −1 lib/a_b_front_end/view/spec.haml
  36. +1 −1 public/css/blueprint/ie.css
  37. +1 −1 public/css/blueprint/print.css
  38. +1 −1 public/css/blueprint/screen.css
  39. +1 −1 public/css/qunit.css
  40. +1 −1 public/js/jquery.js
  41. +1 −1 public/js/qunit.js
  42. +0 −84 require.rb
  43. +5 −1 script/console
  44. +4 −0 spec/a_b_front_end_spec.rb
  45. +16 −2 spec/spec_helper.rb
  46. +0 −1 vendor/a_b_plugin/.gitignore
  47. +41 −0 vendor/a_b_plugin/Gemfile
  48. +74 −0 vendor/a_b_plugin/Gemfile.lock
  49. +2 −2 vendor/a_b_plugin/{MIT-LICENSE → LICENSE}
  50. 0 vendor/a_b_plugin/{README.markdown → README.md}
  51. +68 −2 vendor/a_b_plugin/Rakefile
  52. +30 −0 vendor/a_b_plugin/a_b_plugin.gemspec
  53. +2 −2 vendor/a_b_plugin/bin/a_b
  54. +1 −1 vendor/a_b_plugin/init.rb
  55. +19 −4 vendor/a_b_plugin/lib/a_b_plugin.rb
  56. +3 −0 vendor/a_b_plugin/lib/a_b_plugin/version.rb
  57. +1 −2 vendor/a_b_plugin/rails/init.rb
  58. +0 −58 vendor/a_b_plugin/require.rb
  59. +1 −1 vendor/a_b_plugin/spec/a_b_plugin/cookies_spec.rb
  60. +1 −1 vendor/a_b_plugin/spec/a_b_plugin/test_spec.rb
  61. +7 −6 vendor/a_b_plugin/spec/a_b_plugin_spec.rb
  62. +1 −1 vendor/a_b_plugin/spec/fixtures/rails/app/controllers/application_controller.rb
  63. +1 −1 vendor/a_b_plugin/spec/fixtures/rails/app/helpers/application_helper.rb
  64. +1 −1 vendor/a_b_plugin/spec/fixtures/rails/config/boot.rb
  65. +1 −1 vendor/a_b_plugin/spec/fixtures/rails/config/initializers/inflections.rb
  66. +1 −1 vendor/a_b_plugin/spec/fixtures/rails/config/initializers/mime_types.rb
  67. +1 −1 vendor/a_b_plugin/spec/fixtures/rails/config/initializers/session_store.rb
  68. +1 −1 vendor/a_b_plugin/spec/fixtures/rails/config/routes.rb
  69. +22 −3 vendor/a_b_plugin/spec/spec_helper.rb
View
1 .gitignore
@@ -1,6 +1,5 @@
.DS_Store
*.gem
-*.gemspec
*.log
config/database.yml
config/deploy.rb
View
57 Gemfile
@@ -0,0 +1,57 @@
+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)
+ gem 'rspec', v[:rspec], :require => %w(
+ spec/adapters/mock_frameworks/rspec
+ spec/runner/formatter/progress_bar_formatter
+ spec/runner/formatter/text_mate_formatter
+ )
+end
View
103 Gemfile.lock
@@ -0,0 +1,103 @@
+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)
+ rspec (= 1.3.0)
+ sinatra (= 1.0)
+ sinatra (= 1.0)
+ sinatra (= 1.0)
View
4 MIT-LICENSE → LICENSE
@@ -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
@@ -15,4 +15,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
4 README.markdown → README.md
@@ -1,4 +1,4 @@
-GemTemplate
+ABFrontEnd
===========
A gem template for new projects.
@@ -33,4 +33,4 @@ stencil a_b_front_end
rake rename
</pre>
-The last command does a find-replace (gem\_template -> my\_project) on files and filenames.
+The last command does a find-replace (gem\_template -> my\_project) on files and filenames.
View
60 Rakefile
@@ -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('../a_b_front_end.gemspec', __FILE__)
+ eval(File.read(file), binding, file)
+ end
+end
if defined?(ActiveWrapper::Tasks)
ActiveWrapper::Tasks.new(
@@ -8,23 +17,32 @@ if defined?(ActiveWrapper::Tasks)
)
end
-# You can delete this after you use it
-desc "Rename project"
-task :rename do
- name = ENV['NAME'] || File.basename(Dir.pwd)
- begin
- dir = Dir['**/gem_template*']
- from = dir.pop
- if from
- rb = from.include?('.rb')
- to = File.dirname(from) + "/#{name}#{'.rb' if rb}"
- FileUtils.mv(from, to)
- end
- end while dir.length > 0
- Dir["**/*"].each do |path|
- next if path.include?('Rakefile')
- if File.file?(path)
- `sed -i "" 's/gem_template/#{name}/g' #{path}`
- end
+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
-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
View
30 a_b_front_end.gemspec
@@ -0,0 +1,30 @@
+# -*- encoding: utf-8 -*-
+lib = File.expand_path('../lib/', __FILE__)
+$:.unshift lib unless $:.include?(lib)
+
+require 'a_b_front_end/version'
+require 'rubygems'
+require 'bundler'
+
+Gem::Specification.new do |s|
+ s.name = "a_b_front_end"
+ s.version = ABFrontEnd::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Winton Welsh"]
+ s.email = ["mail@wintoni.us"]
+ s.homepage = "http://github.com/winton/a_b_front_end"
+ s.summary = ""
+ s.description = ""
+
+ Bundler.definition.dependencies.each do |dep|
+ if dep.groups.include?(:gemspec)
+ s.add_dependency dep.name, dep.requirement
+ elsif dep.groups.include?(:gemspec_dev)
+ s.add_development_dependency dep.name, dep.requirement
+ end
+ end
+
+ s.files = Dir.glob("{bin,lib}/**/*") + %w(LICENSE README.md)
+ s.executables = Dir.glob("{bin}/*").collect { |f| File.basename(f) }
+ s.require_path = 'lib'
+end
View
2 config.ru
@@ -1,3 +1,3 @@
require "#{File.dirname(__FILE__)}/lib/a_b_front_end"
-run Application
+run Application
View
2 config/a_b.yml
@@ -1,2 +1,2 @@
token: UAkc328OcjMVFbPAE5bo
-url: http://localhost:9394
+url: http://localhost:9394
View
2 config/database.example.yml
@@ -3,4 +3,4 @@ development:
database: a_b_front_end
username: root
password:
- host: localhost
+ host: localhost
View
2 config/externals.yml
@@ -3,4 +3,4 @@ a_b_plugin:
path: vendor
authlogic:
repo: git@github.com:winton/authlogic.git
- path: vendor
+ path: vendor
View
2 config/mail.example.yml
@@ -13,4 +13,4 @@ production:
password: password
port: 587
enable_starttls_auto: true
- user_name: test@mydomain.com
+ user_name: test@mydomain.com
View
2 db/migrate/001_users.rb
@@ -22,4 +22,4 @@ def self.up
def self.down
drop_table :users
end
-end
+end
View
2 features/example.feature
@@ -7,4 +7,4 @@ Feature: Example
Scenario: I do something
/Given
/When
- /Then
+ /Then
View
2 features/support/env.rb
@@ -36,4 +36,4 @@ def app
include Test::Unit::Assertions
include Webrat::Matchers
include Webrat::Methods
-end
+end
View
2 features/support/rspec.rb
@@ -8,4 +8,4 @@
ensure
$rspec_mocks.reset_all
end
-end
+end
View
2 features/support/webrat.rb
@@ -1,3 +1,3 @@
Webrat.configure do |config|
config.mode = :rack
-end
+end
View
20 lib/a_b_front_end.rb
@@ -1,2 +1,18 @@
-require File.expand_path("#{File.dirname(__FILE__)}/../require")
-Require.lib!
+require 'rubygems'
+require 'bundler'
+
+Bundler.require(:lib)
+
+$:.unshift File.dirname(__FILE__) + '/a_b_front_end'
+
+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'
View
2 lib/a_b_front_end/boot/active_wrapper.rb
@@ -9,4 +9,4 @@
$db.establish_connection
ActionMailer::Base.raise_delivery_errors = true
-end
+end
View
2 lib/a_b_front_end/boot/application.rb
@@ -1,2 +1,2 @@
class Application < Sinatra::Base
-end
+end
View
11 lib/a_b_front_end/boot/console.rb
@@ -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'
View
2 lib/a_b_front_end/boot/controller.rb
@@ -3,4 +3,4 @@
Dir["#{root}/lib/a_b_front_end/controller/*.rb"].sort.each do |path|
require path
end
-end
+end
View
2 lib/a_b_front_end/boot/flash.rb
@@ -1,4 +1,4 @@
Application.class_eval do
use Rack::Flash, :accessorize => %w(error notice success)
-end
+end
View
2 lib/a_b_front_end/boot/helper.rb
@@ -3,4 +3,4 @@
Dir["#{root}/lib/a_b_front_end/helper/*.rb"].sort.each do |path|
require path
end
-end
+end
View
4 lib/a_b_front_end/boot/lilypad.rb
@@ -1,5 +1,3 @@
-Require.lilypad!
-
Application.class_eval do
if File.exists?(lilypad = "#{root}/config/lilypad.txt")
@@ -8,4 +6,4 @@
sinatra
end
end
-end
+end
View
2 lib/a_b_front_end/boot/model.rb
@@ -3,4 +3,4 @@
Dir["#{root}/lib/a_b_front_end/model/*.rb"].sort.each do |path|
require path
end
-end
+end
View
2 lib/a_b_front_end/boot/session.rb
@@ -1,4 +1,4 @@
Application.class_eval do
use Rack::Session::Cookie
-end
+end
View
2 lib/a_b_front_end/boot/sinatra.rb
@@ -7,4 +7,4 @@
set :logging, true
set :static, true
set :views, "#{root}/lib/a_b_front_end/view"
-end
+end
View
2 lib/a_b_front_end/controller/api.rb
@@ -64,4 +64,4 @@
:token => current_user.single_access_token
).to_json
end
-end
+end
View
2 lib/a_b_front_end/controller/front.rb
@@ -11,4 +11,4 @@
haml :front
end
end
-end
+end
View
2 lib/a_b_front_end/helper/application.rb
@@ -35,4 +35,4 @@ def stylesheets(&block)
end
end
end
-end
+end
View
2 lib/a_b_front_end/model/user.rb
@@ -12,4 +12,4 @@ def self.quick_create(u, p)
puts "\nCouldn't save user:\n#{user.errors.to_a.inspect}\n\n" unless user.id
user
end
-end
+end
View
3 lib/a_b_front_end/version.rb
@@ -0,0 +1,3 @@
+module ABFrontEnd
+ VERSION = "0.1.0" unless defined?(::ABFrontEnd::VERSION)
+end
View
2 lib/a_b_front_end/view/layout.haml
@@ -57,4 +57,4 @@
- javascripts do |path|
= js path
- if @sites
- %script= "window.dashboard = new Dashboard(#{@sites.to_json});"
+ %script= "window.dashboard = new Dashboard(#{@sites.to_json});"
View
2 lib/a_b_front_end/view/spec.haml
@@ -8,4 +8,4 @@
%h1{ :id => "qunit-header" } a_b_front_end
%h2{ :id => "qunit-banner" }
%h2{ :id => "qunit-userAgent" }
- %ol{ :id => "qunit-tests" }
+ %ol{ :id => "qunit-tests" }
View
2 public/css/blueprint/ie.css
@@ -32,4 +32,4 @@ input.checkbox, input.radio {position:relative;top:.25em;}
form.inline div, form.inline p {vertical-align:middle;}
form.inline label {position:relative;top:-0.25em;}
form.inline input.checkbox, form.inline input.radio, form.inline input.button, form.inline button {margin:0.5em 0;}
-button, input.button {position:relative;top:0.25em;}
+button, input.button {position:relative;top:0.25em;}
View
2 public/css/blueprint/print.css
@@ -26,4 +26,4 @@ blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;}
.quiet {color:#999;}
.hide {display:none;}
a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;}
-a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;}
+a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;}
View
2 public/css/blueprint/screen.css
@@ -255,4 +255,4 @@ hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;marg
hr.space {background:#fff;color:#fff;visibility:hidden;}
.clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;}
.clearfix, .container {display:block;}
-.clear {clear:both;}
+.clear {clear:both;}
View
2 public/css/qunit.css
@@ -115,4 +115,4 @@ strong b.fail{
}
strong b.pass{
color:#5E740B;
- }
+ }
View
2 public/js/jquery.js
@@ -151,4 +151,4 @@ c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetL
d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
-e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
+e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
View
2 public/js/qunit.js
@@ -1066,4 +1066,4 @@ QUnit.jsDump = (function() {
return jsDump;
})();
-})(this);
+})(this);
View
84 require.rb
@@ -1,84 +0,0 @@
-require 'rubygems'
-gem 'require'
-require 'require'
-
-Require do
- gem(:active_wrapper, '=0.2.5') { require 'active_wrapper' }
- gem :cucumber, '=0.6.2'
- gem(:haml, '=2.2.17') { require %w(haml sass) }
- gem(:lilypad, '=0.3.0') { require 'lilypad' }
- gem(:'rack-flash', '=0.1.1') { require 'rack-flash' }
- gem(:'rack-test', '=0.5.3') { require 'rack/test' }
- gem(:rake, '=0.8.7') { require 'rake' }
- gem :require, '=0.2.7'
- gem :rspec, '=1.3.0'
- gem(:sinatra, '=1.0') { require 'sinatra/base' }
-
- gemspec do
- author 'Winton Welsh'
- dependencies do
- gem :active_wrapper
- gem :haml
- gem :lilypad
- gem :'rack-flash'
- gem :require
- gem :sinatra
- end
- email 'mail@wintoni.us'
- name 'a_b_front_end'
- homepage "http://github.com/winton/#{name}"
- summary ""
- version '0.1.0'
- end
-
- bin { require 'lib/a_b_front_end' }
-
- console do
- gem :active_wrapper
- gem :sinatra
- load_path 'vendor/a_b_plugin/lib'
- load_path 'vendor/authlogic/lib'
- require 'a_b_plugin'
- require 'authlogic'
- require 'lib/a_b_front_end/boot/application'
- require 'lib/a_b_front_end/boot/a_b'
- require 'lib/a_b_front_end/boot/sinatra'
- require 'lib/a_b_front_end/boot/active_wrapper'
- require 'lib/a_b_front_end/boot/model'
- end
-
- lib do
- gem :haml
- gem :sinatra
- gem :active_wrapper
- gem :'rack-flash'
- load_path 'vendor/a_b_plugin/lib'
- load_path 'vendor/authlogic/lib'
- require 'authlogic'
- require 'lib/a_b_front_end/boot/application'
- require 'lib/a_b_front_end/boot/sinatra'
- require 'lib/a_b_front_end/boot/session'
- require 'lib/a_b_front_end/boot/flash'
- require 'lib/a_b_front_end/boot/active_wrapper'
- require 'a_b_plugin'
- require 'lib/a_b_front_end/boot/a_b'
- require 'lib/a_b_front_end/boot/lilypad'
- require 'lib/a_b_front_end/boot/controller'
- require 'lib/a_b_front_end/boot/helper'
- require 'lib/a_b_front_end/boot/model'
- end
-
- rakefile do
- gem(:active_wrapper) { require 'active_wrapper/tasks' }
- gem(:rake) { require 'rake/gempackagetask' }
- gem(:rspec) { require 'spec/rake/spectask' }
- require 'require/tasks'
- end
-
- spec_helper do
- gem :'rack-test'
- require 'require/spec_helper'
- require 'lib/a_b_front_end'
- require 'pp'
- end
-end
View
6 script/console
@@ -1,3 +1,7 @@
#!/usr/bin/env ruby
-exec "irb -r #{File.expand_path("#{File.dirname(__FILE__)}/../lib/a_b_front_end/boot/console")}"
+require 'rubygems'
+require 'bundler'
+
+lib = File.expand_path(File.dirname(__FILE__) + "/../lib/a_b_front_end")
+exec "irb -r #{lib}/boot/console"
View
4 spec/a_b_front_end_spec.rb
@@ -0,0 +1,4 @@
+require 'spec_helper'
+
+describe ABFrontEnd do
+end
View
18 spec/spec_helper.rb
@@ -1,5 +1,19 @@
-require File.expand_path("#{File.dirname(__FILE__)}/../require")
-Require.spec_helper!
+require 'rubygems'
+require 'bundler'
+
+Bundler.require(:spec)
Spec::Runner.configure do |config|
end
+
+SPEC = File.dirname(__FILE__)
+
+require "#{Bundler.root}/lib/a_b_front_end"
+require 'pp'
+
+# For use with rspec textmate bundle
+def debug(object)
+ puts "<pre>"
+ puts object.pretty_inspect.gsub('<', '&lt;').gsub('>', '&gt;')
+ puts "</pre>"
+end
View
1 vendor/a_b_plugin/.gitignore
@@ -1,6 +1,5 @@
.DS_Store
*.gem
-*.gemspec
coverage
pkg
spec/fixtures/rails/log/*
View
41 vendor/a_b_plugin/Gemfile
@@ -0,0 +1,41 @@
+source "http://rubygems.org"
+
+v = {
+ :bundler => '=1.0.0.beta.2',
+ :httparty => '=0.5.2',
+ :json => '=1.2.0',
+ :rack_test => '=0.5.3',
+ :rake => '=0.8.7',
+ :rails => '=2.3.5',
+ :rspec => '=1.3.0',
+ :sinatra => '=1.0'
+}
+
+group :gemspec do
+ gem 'bundler', v[:bundler]
+end
+
+group :gemspec_dev do
+ gem 'rspec', v[:rspec]
+end
+
+group :lib do
+ gem 'httparty', v[:httparty], :require => %w(httparty)
+end
+
+group :rake do
+ gem 'rake', v[:rake], :require => %w(rake rake/gempackagetask)
+ gem 'rspec', v[:rspec], :require => %w(spec/rake/spectask)
+end
+
+group :spec do
+ gem 'json', v[:json], :require => %w(json)
+ gem 'rack-test', v[:rack_test], :require => %w(rack/test)
+ gem 'rails', v[:rails]
+ gem 'sinatra', v[:sinatra], :require => %w(sinatra/base)
+ gem 'rspec', v[:rspec], :require => %w(
+ spec/adapters/mock_frameworks/rspec
+ spec/runner/formatter/progress_bar_formatter
+ spec/runner/formatter/text_mate_formatter
+ )
+end
View
74 vendor/a_b_plugin/Gemfile.lock
@@ -0,0 +1,74 @@
+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)
+ activerecord (2.3.5)
+ activesupport (= 2.3.5)
+ activerecord (2.3.5)
+ activesupport (= 2.3.5)
+ activeresource (2.3.5)
+ activesupport (= 2.3.5)
+ activeresource (2.3.5)
+ activesupport (= 2.3.5)
+ activesupport (2.3.5)
+ activesupport (2.3.5)
+ crack (0.1.6)
+ crack (0.1.6)
+ httparty (0.5.2)
+ crack (= 0.1.6)
+ httparty (0.5.2)
+ crack (= 0.1.6)
+ json (1.2.0)
+ json (1.2.0)
+ rack (1.0.1)
+ rack (1.0.1)
+ rack-test (0.5.3)
+ rack (>= 1.0)
+ rack-test (0.5.3)
+ rack (>= 1.0)
+ rails (2.3.5)
+ actionmailer (= 2.3.5)
+ actionpack (= 2.3.5)
+ activerecord (= 2.3.5)
+ activeresource (= 2.3.5)
+ activesupport (= 2.3.5)
+ rake (>= 0.8.3)
+ rails (2.3.5)
+ actionmailer (= 2.3.5)
+ actionpack (= 2.3.5)
+ activerecord (= 2.3.5)
+ activeresource (= 2.3.5)
+ activesupport (= 2.3.5)
+ rake (>= 0.8.3)
+ 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)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler (= 1.0.0.beta.2)
+ httparty (= 0.5.2)
+ json (= 1.2.0)
+ rack-test (= 0.5.3)
+ rails (= 2.3.5)
+ rake (= 0.8.7)
+ rspec (= 1.3.0)
+ rspec (= 1.3.0)
+ rspec (= 1.3.0)
+ sinatra (= 1.0)
View
4 vendor/a_b_plugin/MIT-LICENSE → vendor/a_b_plugin/LICENSE
@@ -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
@@ -15,4 +15,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
0 vendor/a_b_plugin/README.markdown → vendor/a_b_plugin/README.md
File renamed without changes.
View
70 vendor/a_b_plugin/Rakefile
@@ -1,2 +1,68 @@
-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?(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
+ if from
+ to = from.split('/')
+ to[-1].gsub!('gem_template', name)
+ FileUtils.mv(from, to.join('/'))
+ end
+ end while dir.length > 0
+ Dir["**/*"].each do |path|
+ next if path.include?('Rakefile')
+ if File.file?(path)
+ `sed -i '' 's/gem_template/#{name}/g' #{path}`
+ `sed -i '' 's/GemTemplate/#{camelize.call(name)}/g' #{path}`
+ no_space = File.read(path).gsub(/\s+\z/, '')
+ File.open(path, 'w') { |f| f.write(no_space) }
+ end
+ end
+end
View
30 vendor/a_b_plugin/a_b_plugin.gemspec
@@ -0,0 +1,30 @@
+# -*- encoding: utf-8 -*-
+lib = File.expand_path('../lib/', __FILE__)
+$:.unshift lib unless $:.include?(lib)
+
+require 'a_b_plugin/version'
+require 'rubygems'
+require 'bundler'
+
+Gem::Specification.new do |s|
+ s.name = "a_b_plugin"
+ s.version = ABPlugin::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Winton Welsh"]
+ s.email = ["mail@wintoni.us"]
+ s.homepage = "http://github.com/winton/a_b_plugin"
+ s.summary = "Talk to a_b from your Rails or Sinatra app"
+ s.description = "Provides the a_b method to your application controller and helper"
+
+ Bundler.definition.dependencies.each do |dep|
+ if dep.groups.include?(:gemspec)
+ s.add_dependency dep.name, dep.requirement
+ elsif dep.groups.include?(:gemspec_dev)
+ s.add_development_dependency dep.name, dep.requirement
+ end
+ end
+
+ s.files = Dir.glob("{bin,lib}/**/*") + %w(LICENSE README.md)
+ s.executables = Dir.glob("{bin}/*").collect { |f| File.basename(f) }
+ s.require_path = 'lib'
+end
View
4 vendor/a_b_plugin/bin/a_b
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + "/../require")
-Require.bin!
+require File.expand_path(File.dirname(__FILE__) + "/../lib/a_b_plugin")
ABPlugin do
binary true
root Dir.pwd
end
+
ABPlugin.new
View
2 vendor/a_b_plugin/init.rb
@@ -1 +1 @@
-require File.dirname(__FILE__) + "/rails/init"
+require File.dirname(__FILE__) + "/rails/init"
View
23 vendor/a_b_plugin/lib/a_b_plugin.rb
@@ -1,5 +1,20 @@
-require File.expand_path("#{File.dirname(__FILE__)}/../require")
-Require.lib!
+require 'rubygems'
+require 'bundler'
+require 'yaml'
+
+Bundler.require(:lib)
+
+$:.unshift File.dirname(__FILE__) + '/a_b_plugin'
+
+require 'version'
+
+require 'api'
+require 'config'
+require 'cookies'
+require 'datastore'
+require 'helper'
+require 'test'
+require File.dirname(__FILE__) + '/a_b_plugin/yaml'
class ABPlugin
@@ -70,5 +85,5 @@ def ABPlugin(&block)
ABPlugin::Config.class_eval &block
end
-require File.dirname(__FILE__) + "/a_b_plugin/adapters/rails" if defined?(Rails)
-require File.dirname(__FILE__) + "/a_b_plugin/adapters/sinatra" if defined?(Sinatra)
+require 'adapters/rails' if defined?(Rails)
+require 'adapters/sinatra' if defined?(Sinatra)
View
3 vendor/a_b_plugin/lib/a_b_plugin/version.rb
@@ -0,0 +1,3 @@
+class ABPlugin
+ VERSION = "0.1.1" unless defined?(::ABPlugin::VERSION)
+end
View
3 vendor/a_b_plugin/rails/init.rb
@@ -1,2 +1 @@
-require File.expand_path(File.dirname(__FILE__) + "/../require")
-Require.rails_init!
+require File.expand_path(File.dirname(__FILE__) + '/../lib/a_b_plugin')
View
58 vendor/a_b_plugin/require.rb
@@ -1,58 +0,0 @@
-require 'rubygems'
-gem 'require'
-require 'require'
-
-Require do
- gem(:httparty, '=0.5.2') { require 'httparty' }
- gem(:json, '=1.2.0') { require 'json' }
- gem(:'rack-test', '=0.5.3') { require 'rack/test' }
- gem(:rake, '=0.8.7') { require 'rake' }
- gem :require, '=0.2.2'
- gem :rspec, '=1.3.0'
- gem(:sinatra, '=0.9.4') { require 'sinatra/base' }
-
- gemspec do
- author 'Winton Welsh'
- dependencies do
- gem :require
- end
- email 'mail@wintoni.us'
- name 'a_b_plugin'
- homepage "http://github.com/winton/#{name}"
- summary "Talk to a_b from your Rails or Sinatra app"
- version '0.1.0'
- end
-
- bin { require 'lib/a_b_plugin' }
-
- lib do
- gem :httparty
- require 'yaml'
- require "lib/a_b_plugin/api"
- require "lib/a_b_plugin/config"
- require "lib/a_b_plugin/cookies"
- require "lib/a_b_plugin/datastore"
- require "lib/a_b_plugin/helper"
- require "lib/a_b_plugin/test"
- require "lib/a_b_plugin/yaml"
- end
-
- rails_init { require 'lib/a_b_plugin' }
-
- rakefile do
- gem(:rake) { require 'rake/gempackagetask' }
- gem(:rspec) { require 'spec/rake/spectask' }
- require 'require/tasks'
- end
-
- spec_helper do
- gem :json
- gem :'rack-test'
- gem :sinatra
- require 'require/spec_helper'
- require 'pp'
- require 'spec/fixtures/rails/config/environment'
- require 'spec/fixtures/sinatra'
- require 'rails/init'
- end
-end
View
2 vendor/a_b_plugin/spec/a_b_plugin/cookies_spec.rb
@@ -43,4 +43,4 @@ def app
last_response.body.should == 'test'
end
end
-end
+end
View
2 vendor/a_b_plugin/spec/a_b_plugin/test_spec.rb
@@ -139,4 +139,4 @@
JSON($cookies['a_b_s']).should == {"v"=>[2],"c"=>[2],"e"=>{"e" => true}}
end
end
-end
+end
View
13 vendor/a_b_plugin/spec/a_b_plugin_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
+require File.dirname(__FILE__) + '/spec_helper'
describe ABPlugin do
@@ -130,13 +130,14 @@
end
it "should call API.get" do
- ABPlugin::API.should_receive(:get).with('/site.json',
+ ABPlugin::API.should_receive(:get).with('/sites.json',
:query => {
- :include => { :categories => { :tests => :variants } },
:only => [ :id, :category_id, :name, :tests, :variants ],
- :name => 'site',
- :token => 'token'
- }).and_return(nil)
+ :site => { :name => "site" },
+ :include => { :categories => { :tests => :variants }
+ },
+ :token=>"token"
+ }).and_return(nil)
ABPlugin.new
end
View
2 vendor/a_b_plugin/spec/fixtures/rails/app/controllers/application_controller.rb
@@ -26,4 +26,4 @@ def set_cookie
ABPlugin::Cookies.set('a_b', 'test')
render :nothing => true
end
-end
+end
View
2 vendor/a_b_plugin/spec/fixtures/rails/app/helpers/application_helper.rb
@@ -1,3 +1,3 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
-end
+end
View
2 vendor/a_b_plugin/spec/fixtures/rails/config/boot.rb
@@ -107,4 +107,4 @@ def read_environment_rb
end
# All that for this:
-Rails.boot!
+Rails.boot!
View
2 vendor/a_b_plugin/spec/fixtures/rails/config/initializers/inflections.rb
@@ -7,4 +7,4 @@
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
-# end
+# end
View
2 vendor/a_b_plugin/spec/fixtures/rails/config/initializers/mime_types.rb
@@ -2,4 +2,4 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
-# Mime::Type.register_alias "text/html", :iphone
+# Mime::Type.register_alias "text/html", :iphone
View
2 vendor/a_b_plugin/spec/fixtures/rails/config/initializers/session_store.rb
@@ -12,4 +12,4 @@
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake db:sessions:create")
-# ActionController::Base.session_store = :active_record_store
+# ActionController::Base.session_store = :active_record_store
View
2 vendor/a_b_plugin/spec/fixtures/rails/config/routes.rb
@@ -46,4 +46,4 @@
map.connect '/helper/respond_to/:method', :controller => 'application', :action => 'helper_respond_to'
map.connect '/get_cookie', :controller => 'application', :action => 'get_cookie'
map.connect '/set_cookie', :controller => 'application', :action => 'set_cookie'
-end
+end
View
25 vendor/a_b_plugin/spec/spec_helper.rb
@@ -1,5 +1,17 @@
-require File.expand_path("#{File.dirname(__FILE__)}/../require")
-Require.spec_helper!
+require 'rubygems'
+require 'bundler'
+
+Bundler.require(:spec)
+
+SPEC = File.dirname(__FILE__)
+
+require SPEC + '/fixtures/rails/config/environment'
+require SPEC + '/fixtures/sinatra'
+
+require "#{Bundler.root}/lib/a_b_plugin"
+require 'pp'
+
+require "#{Bundler.root}/rails/init"
$testing = true
@@ -7,6 +19,13 @@
include ABPlugin::Helper
end
+# For use with rspec textmate bundle
+def debug(object)
+ puts "<pre>"
+ puts object.pretty_inspect.gsub('<', '&lt;').gsub('>', '&gt;')
+ puts "</pre>"
+end
+
def setup_variables
@site = {
"categories" => [{
@@ -35,5 +54,5 @@ def setup_variables
def stub_api_boot
setup_variables
- ABPlugin::API.stub!(:site).and_return(@site)
+ ABPlugin::API.stub!(:sites).and_return(@site)
end

0 comments on commit 6fa9538

Please sign in to comment.
Something went wrong with that request. Please try again.