Permalink
Browse files

Merge branch 'master' of github.com:willroberto/toggle_server

  • Loading branch information...
2 parents c7bbde2 + 7b2bfed commit 9d90db4a60f05debfab0c2dc1f1479f7e433630d Alexander Borges committed Feb 1, 2013
View
@@ -15,7 +15,7 @@ gem 'bcrypt-ruby', :require => "bcrypt"
gem 'haml'
gem 'activerecord', :require => "active_record"
gem 'mysql2'
-
+gem 'debugger'
# Test requirements
gem 'mocha', :group => "test"
gem 'rspec', :group => "test"
View
@@ -15,6 +15,14 @@ GEM
arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.4)
+ columnize (0.3.6)
+ debugger (1.3.0)
+ columnize (>= 0.3.1)
+ debugger-linecache (~> 1.1.1)
+ debugger-ruby_core_source (~> 1.1.7)
+ debugger-linecache (1.1.2)
+ debugger-ruby_core_source (>= 1.1.1)
+ debugger-ruby_core_source (1.1.7)
diff-lcs (1.1.3)
haml (3.1.7)
http_router (0.10.2)
@@ -94,6 +102,7 @@ PLATFORMS
DEPENDENCIES
activerecord
bcrypt-ruby
+ debugger
haml
mocha
mysql2
@@ -37,7 +37,8 @@
end
get :show, :map => "/toggle/:service/:name", :provides => [:json] do
- "#{params[:service]}#{params[:name]}"
+ toggle = Service.where(name: params[:service]).first.toggles.where(name: params[:name]).first
+ render :enabled => toggle.enabled
end
end
View
@@ -1,3 +1,4 @@
+# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
@@ -0,0 +1,7 @@
+---
+:orm: activerecord
+:test: none
+:mock: mocha
+:script: jquery
+:renderer: haml
+:stylesheet: none
@@ -0,0 +1,7 @@
+.DS_Store
+log/**/*
+tmp/**/*
+bin/*
+vendor/gems/*
+!vendor/gems/cache/
+.sass-cache/*
View
@@ -0,0 +1,30 @@
+source :rubygems
+
+# Server requirements
+# gem 'thin' # or mongrel
+# gem 'trinidad', :platform => 'jruby'
+
+# Project requirements
+gem 'rake'
+gem 'sinatra-flash', :require => 'sinatra/flash'
+
+# Component requirements
+gem 'haml'
+gem 'activerecord', :require => "active_record"
+gem 'sqlite3'
+
+# Test requirements
+gem 'mocha', :group => "test"
+
+# Padrino Stable Gem
+gem 'padrino', '0.10.7'
+
+gem 'toggle', :path => "/Users/wilson/OpenFriday/toggle/"
+
+# Or Padrino Edge
+# gem 'padrino', :git => 'git://github.com/padrino/padrino-framework.git'
+
+# Or Individual Gems
+# %w(core gen helpers cache mailer admin).each do |g|
+# gem 'padrino-' + g, '0.10.7'
+# end
@@ -0,0 +1,113 @@
+PATH
+ remote: /Users/wilson/OpenFriday/toggle
+ specs:
+ toggle (0.0.1)
+ bundler (~> 1.2.3)
+ debugger (~> 1.3.0)
+ http_monkey (~> 0.0.3)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ activemodel (3.2.11)
+ activesupport (= 3.2.11)
+ builder (~> 3.0.0)
+ activerecord (3.2.11)
+ activemodel (= 3.2.11)
+ activesupport (= 3.2.11)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activesupport (3.2.11)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.2)
+ builder (3.0.4)
+ columnize (0.3.6)
+ debugger (1.3.0)
+ columnize (>= 0.3.1)
+ debugger-linecache (~> 1.1.1)
+ debugger-ruby_core_source (~> 1.1.7)
+ debugger-linecache (1.1.2)
+ debugger-ruby_core_source (>= 1.1.1)
+ debugger-ruby_core_source (1.1.7)
+ haml (3.1.7)
+ http_monkey (0.0.3)
+ http_objects (~> 0.0.4)
+ httpi (~> 2.0.0)
+ rack
+ http_objects (0.0.4)
+ http_router (0.10.2)
+ rack (>= 1.0.0)
+ url_mount (~> 0.2.1)
+ httpi (2.0.2)
+ rack
+ i18n (0.6.1)
+ mail (2.3.3)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ metaclass (0.0.1)
+ mime-types (1.19)
+ mocha (0.13.2)
+ metaclass (~> 0.0.1)
+ multi_json (1.5.0)
+ padrino (0.10.7)
+ padrino-admin (= 0.10.7)
+ padrino-cache (= 0.10.7)
+ padrino-core (= 0.10.7)
+ padrino-gen (= 0.10.7)
+ padrino-helpers (= 0.10.7)
+ padrino-mailer (= 0.10.7)
+ padrino-admin (0.10.7)
+ padrino-core (= 0.10.7)
+ padrino-helpers (= 0.10.7)
+ padrino-cache (0.10.7)
+ padrino-core (= 0.10.7)
+ padrino-core (0.10.7)
+ activesupport (~> 3.2.0)
+ http_router (~> 0.10.2)
+ sinatra (~> 1.3.1)
+ thor (~> 0.15.2)
+ tilt (~> 1.3.0)
+ padrino-gen (0.10.7)
+ bundler (~> 1.0)
+ padrino-core (= 0.10.7)
+ padrino-helpers (0.10.7)
+ i18n (~> 0.6)
+ padrino-core (= 0.10.7)
+ padrino-mailer (0.10.7)
+ mail (~> 2.3.0)
+ padrino-core (= 0.10.7)
+ polyglot (0.3.3)
+ rack (1.5.1)
+ rack-protection (1.3.2)
+ rack
+ rake (10.0.3)
+ sinatra (1.3.4)
+ rack (~> 1.4)
+ rack-protection (~> 1.3)
+ tilt (~> 1.3, >= 1.3.3)
+ sinatra-flash (0.3.0)
+ sinatra (>= 1.0.0)
+ sqlite3 (1.3.7)
+ thor (0.15.4)
+ tilt (1.3.3)
+ treetop (1.4.12)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.35)
+ url_mount (0.2.1)
+ rack
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activerecord
+ haml
+ mocha
+ padrino (= 0.10.7)
+ rake
+ sinatra-flash
+ sqlite3
+ toggle!
@@ -0,0 +1,60 @@
+class DummyDomain < Padrino::Application
+ use ActiveRecord::ConnectionAdapters::ConnectionManagement
+ register Padrino::Rendering
+ register Padrino::Mailer
+ register Padrino::Helpers
+
+ enable :sessions
+
+ ##
+ # Caching support
+ #
+ # register Padrino::Cache
+ # enable :caching
+ #
+ # You can customize caching store engines:
+ #
+ # set :cache, Padrino::Cache::Store::Memcache.new(::Memcached.new('127.0.0.1:11211', :exception_retry_limit => 1))
+ # set :cache, Padrino::Cache::Store::Memcache.new(::Dalli::Client.new('127.0.0.1:11211', :exception_retry_limit => 1))
+ # set :cache, Padrino::Cache::Store::Redis.new(::Redis.new(:host => '127.0.0.1', :port => 6379, :db => 0))
+ # set :cache, Padrino::Cache::Store::Memory.new(50)
+ # set :cache, Padrino::Cache::Store::File.new(Padrino.root('tmp', app_name.to_s, 'cache')) # default choice
+ #
+
+ ##
+ # Application configuration options
+ #
+ # set :raise_errors, true # Raise exceptions (will stop application) (default for test)
+ # set :dump_errors, true # Exception backtraces are written to STDERR (default for production/development)
+ # set :show_exceptions, true # Shows a stack trace in browser (default for development)
+ # set :logging, true # Logging in STDOUT for development and file for production (default only for development)
+ # set :public_folder, "foo/bar" # Location for static assets (default root/public)
+ # set :reload, false # Reload application files (default in development)
+ # set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
+ # set :locale_path, "bar" # Set path for I18n translations (default your_app/locales)
+ # disable :sessions # Disabled sessions by default (enable if needed)
+ # disable :flash # Disables sinatra-flash (enabled by default if Sinatra::Flash is defined)
+ # layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application)
+ #
+
+ ##
+ # You can configure for a specified environment like:
+ #
+ # configure :development do
+ # set :foo, :bar
+ # disable :asset_stamp # no asset timestamping for dev
+ # end
+ #
+
+ ##
+ # You can manage errors like:
+ #
+ # error 404 do
+ # render 'errors/404'
+ # end
+ #
+ # error 505 do
+ # render 'errors/505'
+ # end
+ #
+end
@@ -0,0 +1,39 @@
+# encoding: utf-8
+DummyDomain.controllers :dummy do
+ # get :index, :map => "/foo/bar" do
+ # session[:foo] = "bar"
+ # render 'index'
+ # end
+
+ # get :sample, :map => "/sample/url", :provides => [:any, :js] do
+ # case content_type
+ # when :js then ...
+ # else ...
+ # end
+
+ # get :foo, :with => :id do
+ # "Maps to url '/foo/#{params[:id]}'"
+ # end
+
+ # get "/example" do
+ # "Hello world!"
+ # end
+ include Toggle
+
+ get :index do
+
+ toggle :show_new_index do
+
+ enabled do
+ render "/dummy/index"
+ end
+
+ disabled do
+ render "/dummy/index_old"
+ end
+
+ end
+
+ end
+
+end
@@ -0,0 +1,7 @@
+# Helper methods defined here can be accessed in any controller or view in the application
+
+DummyDomain.helpers do
+ # def simple_helper_method
+ # ...
+ # end
+end
@@ -0,0 +1 @@
+Borges Gayzinho
@@ -0,0 +1 @@
+Borges Hominho
@@ -0,0 +1,9 @@
+#!/usr/bin/env rackup
+# encoding: utf-8
+
+# This file can be used to start Padrino,
+# just execute it from the command line.
+
+require File.expand_path("../config/boot.rb", __FILE__)
+
+run Padrino.application
@@ -0,0 +1,34 @@
+##
+# This file mounts each app in the Padrino project to a specified sub-uri.
+# You can mount additional applications using any of these commands below:
+#
+# Padrino.mount("blog").to('/blog')
+# Padrino.mount("blog", :app_class => "BlogApp").to('/blog')
+# Padrino.mount("blog", :app_file => "path/to/blog/app.rb").to('/blog')
+#
+# You can also map apps to a specified host:
+#
+# Padrino.mount("Admin").host("admin.example.org")
+# Padrino.mount("WebSite").host(/.*\.?example.org/)
+# Padrino.mount("Foo").to("/foo").host("bar.example.org")
+#
+# Note 1: Mounted apps (by default) should be placed into the project root at '/app_name'.
+# Note 2: If you use the host matching remember to respect the order of the rules.
+#
+# By default, this file mounts the primary app which was generated with this project.
+# However, the mounted app can be modified as needed:
+#
+# Padrino.mount("AppName", :app_file => "path/to/file", :app_class => "BlogApp").to('/')
+#
+
+##
+# Setup global project settings for your apps. These settings are inherited by every subapp. You can
+# override these settings in the subapps as needed.
+#
+Padrino.configure_apps do
+ # enable :sessions
+ set :session_secret, '60e9007c1d854bd7fa83a1350b4c2e23797d1f01b07a23c57e770718bf1b21c2'
+end
+
+# Mounts the core application for this project
+Padrino.mount("DummyDomain").to('/')
Oops, something went wrong.

0 comments on commit 9d90db4

Please sign in to comment.