Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

began work on chili main engine

  • Loading branch information...
commit e67a41d4f244fdd3d22f328aeae20214a38d9e8e 0 parents
Jens Balvig authored April 18, 2012
17  .gitignore
... ...
@@ -0,0 +1,17 @@
  1
+*.gem
  2
+*.rbc
  3
+.bundle
  4
+.config
  5
+.yardoc
  6
+Gemfile.lock
  7
+InstalledFiles
  8
+_yardoc
  9
+coverage
  10
+doc/
  11
+lib/bundler/man
  12
+pkg
  13
+rdoc
  14
+spec/reports
  15
+test/tmp
  16
+test/version_tmp
  17
+tmp
4  Gemfile
... ...
@@ -0,0 +1,4 @@
  1
+source 'https://rubygems.org'
  2
+
  3
+# Specify your gem's dependencies in chili.gemspec
  4
+gemspec
22  LICENSE
... ...
@@ -0,0 +1,22 @@
  1
+Copyright (c) 2012 Jens Balvig
  2
+
  3
+MIT License
  4
+
  5
+Permission is hereby granted, free of charge, to any person obtaining
  6
+a copy of this software and associated documentation files (the
  7
+"Software"), to deal in the Software without restriction, including
  8
+without limitation the rights to use, copy, modify, merge, publish,
  9
+distribute, sublicense, and/or sell copies of the Software, and to
  10
+permit persons to whom the Software is furnished to do so, subject to
  11
+the following conditions:
  12
+
  13
+The above copyright notice and this permission notice shall be
  14
+included in all copies or substantial portions of the Software.
  15
+
  16
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  20
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  21
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  22
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29  README.md
Source Rendered
... ...
@@ -0,0 +1,29 @@
  1
+# Chili
  2
+
  3
+TODO: Write a gem description
  4
+
  5
+## Installation
  6
+
  7
+Add this line to your application's Gemfile:
  8
+
  9
+    gem 'chili'
  10
+
  11
+And then execute:
  12
+
  13
+    $ bundle
  14
+
  15
+Or install it yourself as:
  16
+
  17
+    $ gem install chili
  18
+
  19
+## Usage
  20
+
  21
+TODO: Write usage instructions here
  22
+
  23
+## Contributing
  24
+
  25
+1. Fork it
  26
+2. Create your feature branch (`git checkout -b my-new-feature`)
  27
+3. Commit your changes (`git commit -am 'Added some feature'`)
  28
+4. Push to the branch (`git push origin my-new-feature`)
  29
+5. Create new Pull Request
2  Rakefile
... ...
@@ -0,0 +1,2 @@
  1
+#!/usr/bin/env rake
  2
+require "bundler/gem_tasks"
10  app/controllers/chili/application_controller.rb
... ...
@@ -0,0 +1,10 @@
  1
+module Chili
  2
+  class ApplicationController  < ::ApplicationController
  3
+    before_filter :activate_extension
  4
+
  5
+    private
  6
+    def activate_extension
  7
+      raise ActionController::RoutingError, 'Extension Disabled' unless eval(self.class.parent.conditions)
  8
+    end
  9
+  end
  10
+end
17  chili.gemspec
... ...
@@ -0,0 +1,17 @@
  1
+# -*- encoding: utf-8 -*-
  2
+require File.expand_path('../lib/chili/version', __FILE__)
  3
+
  4
+Gem::Specification.new do |gem|
  5
+  gem.authors       = ["Jens Balvig"]
  6
+  gem.email         = ["jens@cookpad.com"]
  7
+  gem.description   = %q{TODO: Write a gem description}
  8
+  gem.summary       = %q{TODO: Write a gem summary}
  9
+  gem.homepage      = ""
  10
+
  11
+  gem.files         = `git ls-files`.split($\)
  12
+  gem.executables   = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
  13
+  gem.test_files    = gem.files.grep(%r{^(test|spec|features)/})
  14
+  gem.name          = "chili"
  15
+  gem.require_paths = ["lib"]
  16
+  gem.version       = Chili::VERSION
  17
+end
7  lib/chili.rb
... ...
@@ -0,0 +1,7 @@
  1
+require "chili/version"
  2
+require "chili/engine"
  3
+require "chili/overrides"
  4
+
  5
+module Chili
  6
+  # Your code goes here...
  7
+end
9  lib/chili/engine.rb
... ...
@@ -0,0 +1,9 @@
  1
+module Chili
  2
+  class Engine < ::Rails::Engine
  3
+    initializer 'chili.controller' do |app|
  4
+      ActiveSupport.on_load(:action_controller) do
  5
+        include Chili::Overrides
  6
+      end
  7
+    end
  8
+  end
  9
+end
19  lib/chili/overrides.rb
... ...
@@ -0,0 +1,19 @@
  1
+module Chili
  2
+  module Overrides
  3
+    def self.included(base)
  4
+      base.send(:include, InstanceMethods)
  5
+      base.before_filter :activate_overrides
  6
+    end
  7
+
  8
+    module InstanceMethods
  9
+      def activate_overrides
  10
+        Deface::Override.all.each do |o|
  11
+          extension_name = o.second.keys.first.classify
  12
+          conditions = extension_name.constantize.conditions
  13
+          override = o.second.first.second
  14
+          override.args[:disabled] = !eval(conditions)
  15
+        end
  16
+      end
  17
+    end
  18
+  end
  19
+end
3  lib/chili/version.rb
... ...
@@ -0,0 +1,3 @@
  1
+module Chili
  2
+  VERSION = "0.0.1"
  3
+end

0 notes on commit e67a41d

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