This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
forked from measuredvoice/ringsail
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic setup and super-basic outlet model.
Added Boxer for JSON packaging, mysql-centric database example configuration, and the core of the outlet object.
- Loading branch information
1 parent
2f69937
commit 82c07fd
Showing
17 changed files
with
224 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,6 @@ tmp/ | |
*.lock | ||
bin/ | ||
config/database.yml | ||
.autotest | ||
.rspec | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Outlets controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class OutletsController < ApplicationController | ||
def add | ||
@outlet = Outlet.resolve(params[:service_url]) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module OutletsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# == Schema Information | ||
# | ||
# Table name: outlets | ||
# | ||
# id :integer(4) not null, primary key | ||
# service_url :string(255) | ||
# organization :string(255) | ||
# info_url :string(255) | ||
# account :string(255) | ||
# language :string(255) | ||
# updated_by :string(255) | ||
# created_at :datetime | ||
# updated_at :datetime | ||
# | ||
|
||
class Outlet < ActiveRecord::Base | ||
attr_accessor :updated_by | ||
attr_accessible :service_url, :organization, :info_url, :account, :language | ||
|
||
validates :service_url, | ||
:presence => true, | ||
:format => { :with => URI::regexp(%w(http https)) }, | ||
:uniqueness => { :case_sensitive => false } | ||
|
||
def self.resolve(url) | ||
# TODO: | ||
# Resolve the URL down to a service and account ID | ||
# Look up existing settings for this outlet, or | ||
# set up sensible defaults for the object. | ||
self.new(:service_url => url) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<h1>Outlets#add</h1> | ||
<p>Find me in app/views/outlets/add.html.erb</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,18 @@ | ||
# SQLite version 3.x | ||
# gem install sqlite3 | ||
# | ||
# Ensure the SQLite 3 gem is defined in your Gemfile | ||
# gem 'sqlite3' | ||
development: | ||
adapter: sqlite3 | ||
database: db/development.sqlite3 | ||
pool: 5 | ||
timeout: 5000 | ||
|
||
# Warning: The database defined as "test" will be erased and | ||
# re-generated from your development database when you run "rake". | ||
# Do not set this db to the same as development or production. | ||
adapter: mysql2 | ||
database: ringsail_development | ||
encoding: utf8 | ||
collation: utf8_unicode_ci | ||
host: localhost | ||
test: | ||
adapter: sqlite3 | ||
database: db/test.sqlite3 | ||
pool: 5 | ||
timeout: 5000 | ||
|
||
adapter: mysql2 | ||
database: ringsail_test | ||
encoding: utf8 | ||
collation: utf8_unicode_ci | ||
host: localhost | ||
production: | ||
adapter: sqlite3 | ||
database: db/production.sqlite3 | ||
pool: 5 | ||
timeout: 5000 | ||
adapter: mysql2 | ||
database: ringsail_production | ||
encoding: utf8 | ||
collation: utf8_unicode_ci | ||
host: localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Make URL helpers available in all boxes | ||
Boxer.configure do |config| | ||
config.box_includes = [Rails.application.routes.url_helpers] | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class CreateOutlets < ActiveRecord::Migration | ||
def change | ||
create_table :outlets do |t| | ||
t.string :service_url | ||
t.string :organization | ||
t.string :info_url | ||
t.string :account | ||
t.string :language | ||
t.string :updated_by | ||
|
||
t.timestamps | ||
end | ||
|
||
add_index :outlets, :account | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 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. | ||
# | ||
# Note that this schema.rb definition is the authoritative source for your | ||
# database schema. If you need to create the application database on another | ||
# system, you should be using db:schema:load, not running all the migrations | ||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations | ||
# you'll amass, the slower it'll run and the greater likelihood for issues). | ||
# | ||
# It's strongly recommended to check this file into your version control system. | ||
|
||
ActiveRecord::Schema.define(:version => 20111109005849) do | ||
|
||
create_table "outlets", :force => true do |t| | ||
t.string "service_url" | ||
t.string "organization" | ||
t.string "info_url" | ||
t.string "account" | ||
t.string "language" | ||
t.string "updated_by" | ||
t.datetime "created_at" | ||
t.datetime "updated_at" | ||
end | ||
|
||
add_index "outlets", ["account"], :name => "index_outlets_on_account" | ||
|
||
end |
Oops, something went wrong.