Permalink
Browse files

Now it's a gem

  • Loading branch information...
1 parent d5bcbca commit 595f002c0f103b5dbee4ef026f010947f0ca2108 Joe Ferris and Mike Burns committed with jferris Aug 3, 2012
View
@@ -0,0 +1,17 @@
+*.gem
+*.rbc
+.bundle
+.config
+.yardoc
+Gemfile.lock
+InstalledFiles
+_yardoc
+coverage
+doc/
+lib/bundler/man
+pkg
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
View
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+
+# Specify your gem's dependencies in turning.gemspec
+gemspec
View
@@ -0,0 +1,22 @@
+Copyright (c) 2012 Joe Ferris and Mike Burns
+
+MIT License
+
+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 the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR 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.
View
@@ -0,0 +1,29 @@
+# Turning
+
+TODO: Write a gem description
+
+## Installation
+
+Add this line to your application's Gemfile:
+
+ gem 'turning'
+
+And then execute:
+
+ $ bundle
+
+Or install it yourself as:
+
+ $ gem install turning
+
+## Usage
+
+TODO: Write usage instructions here
+
+## Contributing
+
+1. Fork it
+2. Create your feature branch (`git checkout -b my-new-feature`)
+3. Commit your changes (`git commit -am 'Added some feature'`)
+4. Push to the branch (`git push origin my-new-feature`)
+5. Create new Pull Request
View
@@ -0,0 +1,10 @@
+#!/usr/bin/env rake
+require 'bundler/gem_tasks'
+require 'rspec/core/rake_task'
+
+RSpec::Core::RakeTask.new do |t|
+ t.pattern = 'spec/**/*_spec.rb'
+end
+
+desc "Run all specs"
+task default: :spec
View
@@ -1,4 +1,4 @@
+require 'turning/version'
require 'turning/callbacks'
-
-module Turning
-end
+require 'turning/controller'
+require 'turning/renderer'
@@ -1,3 +1,5 @@
+require 'active_model/callbacks'
+
module ActiveModel::Callbacks
def on(event, &block)
new_block = lambda { |instance| block.call(instance) }
@@ -1,3 +1,12 @@
+require 'action_view'
+require 'active_support/core_ext/module/attr_internal'
+require 'active_support/log_subscriber'
+require 'abstract_controller/view_paths'
+require 'abstract_controller/rendering'
+require 'abstract_controller/layouts'
+require 'abstract_controller/helpers'
+require 'action_controller/metal/helpers'
+
module Turning
class Renderer
def initialize(controller_path)
@@ -11,7 +20,7 @@ def initialize(controller_path)
# Search for views based on the controller name
attr_accessor :controller_path
- self.view_paths = 'app/views'
+ self.view_paths = ActionController::Base.view_paths
# Include all helpers from the application's helper paths
def self.helpers_path
@@ -0,0 +1,3 @@
+module Turning
+ VERSION = "0.0.1"
+end
View
@@ -0,0 +1,10 @@
+require 'rspec'
+require 'turning'
+require 'bourne'
+
+require './spec/testapp/config/application'
+Dir["spec/support/**/*.rb"].each { |f| require File.expand_path(f) }
+
+RSpec.configure do |config|
+ config.mock_with :mocha
+end
@@ -0,0 +1,2 @@
+TestApp::Application.initialize!
+ActionView::Resolver.caching = false
No changes.
@@ -0,0 +1,27 @@
+require 'rails'
+require 'action_controller/railtie'
+
+module TestApp
+ APP_ROOT = File.expand_path('..', __FILE__).freeze
+
+ class Application < Rails::Application
+ config.encoding = "utf-8"
+ # config.paths.add 'config/routes', with: "#{APP_ROOT}/config/routes.rb"
+ # config.paths.add 'app/controllers', with: "#{APP_ROOT}/app/controllers"
+ # config.paths.add 'app/helpers', with: "#{APP_ROOT}/app/helpers"
+ # config.paths.add 'app/views', with: "#{APP_ROOT}/app/views"
+ # config.paths.add 'log', with: 'tmp/log'
+ config.cache_classes = true
+ config.whiny_nils = true
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+ config.action_dispatch.show_exceptions = false
+ config.action_controller.allow_forgery_protection = false
+ config.active_support.deprecation = :stderr
+ config.secret_token = "DIESEL" * 5 # so diesel
+
+ def require_environment!
+ initialize!
+ end
+ end
+end
@@ -0,0 +1,3 @@
+TestApp::Application.routes.draw do
+ root to: 'ponies#show'
+end
@@ -0,0 +1,84 @@
+ Rendered examples/index.html.erb (1.0ms)
+ Rendered examples/index.html.erb (13.5ms)
+ Rendered examples/say_hello.html.erb (0.2ms)
+ Rendered examples/go_home.html.erb (3.0ms)
+ Rendered examples/greet_hello.html.erb (0.2ms)
+ Rendered examples/form.html.erb (0.5ms)
+ Rendered examples/simple.html.erb (0.2ms)
+ Rendered examples/index.html.erb (13.5ms)
+ Rendered examples/say_hello.html.erb (0.3ms)
+ Rendered examples/go_home.html.erb (3.4ms)
+ Rendered examples/greet_hello.html.erb (0.2ms)
+ Rendered examples/form.html.erb (0.5ms)
+ Rendered examples/simple.html.erb (0.2ms)
+ Rendered examples/index.html.erb (1.0ms)
+ Rendered examples/say_hello.html.erb (0.2ms)
+ Rendered examples/go_home.html.erb (0.4ms)
+ Rendered examples/greet_hello.html.erb (0.2ms)
+ Rendered examples/form.html.erb (0.4ms)
+ Rendered examples/simple.html.erb (0.2ms)
+ Rendered examples/simple.html.erb within layouts/static (1.1ms)
+ Rendered examples/index.html.erb (1.0ms)
+ Rendered examples/say_hello.html.erb (0.3ms)
+ Rendered examples/go_home.html.erb (0.4ms)
+ Rendered examples/greet_hello.html.erb (0.3ms)
+ Rendered examples/form.html.erb (0.5ms)
+ Rendered examples/simple.html.erb (0.4ms)
+ Rendered examples/index.html.erb (1.0ms)
+ Rendered examples/say_hello.html.erb (0.3ms)
+ Rendered examples/go_home.html.erb (0.4ms)
+ Rendered examples/greet_hello.html.erb (0.3ms)
+ Rendered examples/form.html.erb (0.5ms)
+ Rendered examples/simple.html.erb (0.3ms)
+ Rendered examples/simple.html.erb within layouts/static (1.1ms)
+ Rendered examples/simple.html.erb within layouts/static (1.1ms)
+ Rendered examples/index.html.erb (1.0ms)
+ Rendered examples/say_hello.html.erb (0.2ms)
+ Rendered examples/go_home.html.erb (0.4ms)
+ Rendered examples/greet_hello.html.erb (0.2ms)
+ Rendered examples/form.html.erb (0.5ms)
+ Rendered examples/simple.html.erb (0.3ms)
+ Rendered examples/index.html.erb (1.0ms)
+ Rendered examples/say_hello.html.erb (0.3ms)
+ Rendered examples/go_home.html.erb (0.4ms)
+ Rendered examples/greet_hello.html.erb (0.2ms)
+ Rendered examples/form.html.erb (0.5ms)
+ Rendered examples/simple.html.erb (0.2ms)
+ Rendered examples/simple.html.erb within layouts/static (1.0ms)
+ Rendered examples/simple.html.erb within layouts/static (1.1ms)
+ Rendered examples/simple.html.erb within layouts/static (1.1ms)
+ Rendered examples/simple.html.erb within layouts/static (1.0ms)
+ Rendered examples/say_hello.html.erb (1.2ms)
+ Rendered examples/go_home.html.erb (0.4ms)
+ Rendered examples/greet_hello.html.erb (0.3ms)
+ Rendered examples/form.html.erb (0.5ms)
+ Rendered examples/simple.html.erb (0.2ms)
+ Rendered examples/simple.html.erb within layouts/static (1.0ms)
+ Rendered examples/simple.html.erb within layouts/static (1.0ms)
+ Rendered examples/say_hello.html.erb (1.1ms)
+ Rendered examples/go_home.html.erb (0.4ms)
+ Rendered examples/greet_hello.html.erb (0.2ms)
+ Rendered examples/form.html.erb (0.5ms)
+ Rendered examples/simple.html.erb (0.2ms)
+ Rendered examples/say_hello.html.erb (1.1ms)
+ Rendered examples/go_home.html.erb (0.4ms)
+ Rendered examples/greet_hello.html.erb (0.2ms)
+ Rendered examples/form.html.erb (0.5ms)
+ Rendered examples/simple.html.erb (0.2ms)
+ Rendered examples/simple.html.erb within layouts/static (1.1ms)
+ Rendered examples/simple.html.erb within layouts/static (1.1ms)
+ Rendered examples/simple.html.erb within layouts/static (1.1ms)
+ Rendered examples/simple.html.erb within layouts/static (1.1ms)
+ Rendered examples/simple.html.erb within layouts/static (1.1ms)
+ Rendered examples/simple.html.erb within layouts/static (1.0ms)
+ Rendered examples/say_hello.html.erb (1.1ms)
+ Rendered examples/go_home.html.erb (0.4ms)
+ Rendered examples/greet_hello.html.erb (0.3ms)
+ Rendered examples/form.html.erb (0.5ms)
+ Rendered examples/simple.html.erb within layouts/static (0.2ms)
+ Rendered examples/index.html.erb (1.0ms)
+ Rendered examples/say_hello.html.erb (0.2ms)
+ Rendered examples/go_home.html.erb (0.4ms)
+ Rendered examples/greet_hello.html.erb (0.2ms)
+ Rendered examples/form.html.erb (0.5ms)
+ Rendered examples/simple.html.erb within layouts/static (0.2ms)
@@ -35,6 +35,6 @@ def trigger_update
controller.listen
model.trigger_update
- IO.read('public/examples/index.html').should == 'Hello'
+ read_cached_view('examples/index.html').should == 'Hello'
end
end
View
@@ -0,0 +1,25 @@
+# -*- encoding: utf-8 -*-
+require File.expand_path('../lib/turning/version', __FILE__)
+
+Gem::Specification.new do |gem|
+ gem.authors = ["Joe Ferris"]
+ gem.email = ["jferris@thoughtbot.com"]
+ gem.description = %q{The wheels in the sky keep on turning}
+ gem.summary = %q{Wheels keep on spinning round, spinning round, spinning round}
+
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ gem.files = `git ls-files`.split("\n")
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ gem.name = "turning"
+ gem.require_paths = ["lib"]
+ gem.version = Turning::VERSION
+
+ gem.add_dependency 'activemodel'
+ gem.add_dependency 'actionpack'
+ gem.add_dependency 'railties'
+
+ gem.add_development_dependency 'rspec'
+ gem.add_development_dependency 'rake'
+ gem.add_development_dependency 'bourne'
+ gem.add_development_dependency 'tzinfo'
+end

0 comments on commit 595f002

Please sign in to comment.