diff --git a/app/assets/javascripts/asciicasts.js.coffee b/app/assets/javascripts/asciicasts.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/asciicasts.js.coffee @@ -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/ diff --git a/app/assets/stylesheets/asciicasts.css.scss b/app/assets/stylesheets/asciicasts.css.scss new file mode 100644 index 0000000..e93ce83 --- /dev/null +++ b/app/assets/stylesheets/asciicasts.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Asciicasts controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/asciicasts_controller.rb b/app/controllers/asciicasts_controller.rb new file mode 100644 index 0000000..7eb8c9e --- /dev/null +++ b/app/controllers/asciicasts_controller.rb @@ -0,0 +1,7 @@ +class AsciicastsController < ApplicationController + + def index + @asciicast = Asciicast.find(params[:id]) + end + +end diff --git a/app/helpers/asciicasts_helper.rb b/app/helpers/asciicasts_helper.rb new file mode 100644 index 0000000..5e020d9 --- /dev/null +++ b/app/helpers/asciicasts_helper.rb @@ -0,0 +1,2 @@ +module AsciicastsHelper +end diff --git a/app/models/asciicast.rb b/app/models/asciicast.rb new file mode 100644 index 0000000..3f140fa --- /dev/null +++ b/app/models/asciicast.rb @@ -0,0 +1,3 @@ +class Asciicast < ActiveRecord::Base + validates :terminal_columns, :terminal_lines, :duration, :presence => true +end diff --git a/config/routes.rb b/config/routes.rb index 74765ff..67f8d33 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,6 @@ AsciiIo::Application.routes.draw do + resources :asciicasts + # The priority is based upon order of creation: # first created -> highest priority. @@ -48,7 +50,7 @@ AsciiIo::Application.routes.draw do # You can have the root of your site routed with "root" # just remember to delete public/index.html. - # root :to => 'welcome#index' + root :to => 'asciicasts#index' # See how all your routes lay out with "rake routes" diff --git a/db/migrate/20111123210607_create_asciicasts.rb b/db/migrate/20111123210607_create_asciicasts.rb new file mode 100644 index 0000000..a18ff1a --- /dev/null +++ b/db/migrate/20111123210607_create_asciicasts.rb @@ -0,0 +1,22 @@ +class CreateAsciicasts < ActiveRecord::Migration + def change + create_table :asciicasts do |t| + t.integer :user_id + t.string :title + t.integer :duration, :null => false + t.datetime :recorded_at + t.string :terminal_type + t.integer :terminal_columns, :null => false + t.integer :terminal_lines, :null => false + t.string :command + t.string :shell + t.string :uname + + t.timestamps + end + + add_index :asciicasts, :user_id + add_index :asciicasts, :created_at + add_index :asciicasts, :recorded_at + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..4d5c30d --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,35 @@ +# 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 => 20111123210607) do + + create_table "asciicasts", :force => true do |t| + t.integer "user_id" + t.string "title" + t.integer "duration", :null => false + t.datetime "recorded_at" + t.string "terminal_type" + t.integer "terminal_columns", :null => false + t.integer "terminal_lines", :null => false + t.string "command" + t.string "shell" + t.string "uname" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "asciicasts", ["created_at"], :name => "index_asciicasts_on_created_at" + add_index "asciicasts", ["recorded_at"], :name => "index_asciicasts_on_recorded_at" + add_index "asciicasts", ["user_id"], :name => "index_asciicasts_on_user_id" + +end diff --git a/spec/controllers/asciicasts_controller_spec.rb b/spec/controllers/asciicasts_controller_spec.rb new file mode 100644 index 0000000..4636580 --- /dev/null +++ b/spec/controllers/asciicasts_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe AsciicastsController do + +end diff --git a/spec/factories/asciicasts.rb b/spec/factories/asciicasts.rb new file mode 100644 index 0000000..4e6dc75 --- /dev/null +++ b/spec/factories/asciicasts.rb @@ -0,0 +1,16 @@ +# Read about factories at http://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :asciicast do + user_id 1 + title "MyString" + duration 1 + recorded_at "2011-11-23 22:06:07" + terminal_type "MyString" + terminal_columns 1 + terminal_lines 1 + command "MyString" + shell "MyString" + uname "MyString" + end +end diff --git a/spec/helpers/asciicasts_helper_spec.rb b/spec/helpers/asciicasts_helper_spec.rb new file mode 100644 index 0000000..b3c0917 --- /dev/null +++ b/spec/helpers/asciicasts_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the AsciicastsHelper. For example: +# +# describe AsciicastsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe AsciicastsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/asciicast_spec.rb b/spec/models/asciicast_spec.rb new file mode 100644 index 0000000..e4fbbc5 --- /dev/null +++ b/spec/models/asciicast_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Asciicast do + pending "add some examples to (or delete) #{__FILE__}" +end