raydash 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Readme CHANGED
@@ -9,7 +9,7 @@ camera and display boxes in the application.
9
9
 
10
10
  1) Add the following to your Gemfile:
11
11
 
12
- gem "raydash", :git => 'https://github.com/gersh/Raydash-Ruby-on-Rails'
12
+ gem "raydash", :git => 'git://github.com/gersh/Raydash-Ruby-on-Rails.git'
13
13
 
14
14
  2) Configure your project your userid and secret with the following command:
15
15
 
@@ -1,14 +1,16 @@
1
- require 'migration'
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
2
3
 
3
4
  module Raydash
4
5
  module Generators
5
6
 
6
7
  class ModelGenerator < Rails::Generators::NamedBase
8
+ include Rails::Generators::Migration
7
9
  desc "Generate a model for working with video tokens"
8
10
  source_root File.expand_path("../../templates", __FILE__)
9
11
  def manifest
10
12
  #record do |m|
11
- migration_template 'migration:migration.rb', "db/migrate", {:assigns => raydash_local_assigns,
13
+ migration_template 'migration.rb', "db/migrate", {:assigns => raydash_local_assigns(),
12
14
  :migration_file_name => 'create_raydash_table_#{custom_name}'
13
15
  }
14
16
  #end
@@ -18,18 +20,24 @@ module Raydash
18
20
  template "model.rb", "app/models/#{custom_file_name}.rb"
19
21
  end
20
22
  private
21
- def custom_file_name
22
- custom_name = class_name.underscore.downcase
23
- custom_name = custom_name.pluralize if ActiveRecord::Base.pluralize_table_names
23
+ def custom_file_name
24
+ custom_name = class_name.underscore.downcase
25
+ custom_name = custom_name.pluralize if ActiveRecord::Base.pluralize_table_names
26
+ end
27
+ def self.next_migration_number(dirname)
28
+ if ActiveRecord::Base.timestamped_migrations
29
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
30
+ else
31
+ "%.3d" % (current_migration_number(dirname) + 1)
32
+ end
24
33
  end
25
-
26
34
  def raydash_local_assigns
27
35
  returning(assigns = {}) do
28
36
  assigns[:migration_action] = "add"
29
37
  assigns[:class_name] = "add_raydash_table_#{custom_file_name}"
30
38
  assigns[:table_name] = custom_file_name
31
- assigns[:attributes] = [Rails::Generator::GeneratedAttribute.new("token", "string")]
32
- assigns[:attributes] << Rails::Generator::GeneratedAttribute.new("connected_to","string")
39
+ assigns[:attributes] = [Rails::Generators::GeneratedAttribute.new("token", "string")]
40
+ assigns[:attributes] << Rails::Generators::GeneratedAttribute.new("connected_to","string")
33
41
  end
34
42
  end
35
43
  end
@@ -1,11 +1,33 @@
1
- class <%=@controller_name%> < ActiveRecord
1
+ class <%=@controller_name%>Controller < ActiveRecord
2
2
  def index()
3
-
3
+ @videos = <%= @model_name %>.all
4
4
  end
5
5
  def show()
6
- @token=Raydash.getToken()
6
+ @video = <%= @model_name %>.find(params[:id])
7
7
  end
8
- def change()
9
- Raydash.changeStream(params[:input_token],params[:output_token])
8
+ def new()
9
+ @video = <%= @model_name %>.new
10
+ end
11
+ def edit
12
+ @video = <%= @model_name %>.find(params[:id])
13
+ end
14
+ def create
15
+ @video = <%= @model_name %>.new()
16
+ if @video.save
17
+ redirect_to(@video, :notice => 'Video stream was successfully created')
18
+ else
19
+ render :action => "new"
20
+ end
21
+ end
22
+ def destroy
23
+ @video = <%= @model_name %>.find(params[:id])
24
+ @video.destroy
25
+ redirect_to <%= @controller_name.downcase %>_url
26
+ end
27
+ def connect()
28
+ @video1 = <%= @model_name %>.find(params[:id])
29
+ @video2 = <%= @model_name %>.find(params[:video_connect])
30
+ @video1.point_to(@video2.token)
31
+ redirect_to <%= @controller_name.downcase %>_url
10
32
  end
11
33
  end
@@ -2,5 +2,10 @@ class <%= @name %> < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :<%= @name %> do |t|
4
4
  t.string :token
5
+ t.string :connected_to
5
6
  end
7
+ end
8
+ def self.down
9
+ drop_table :<%= @name %>
10
+ end
6
11
  end
@@ -2,7 +2,7 @@ class <%= @custom_name %> < ActiveRecord::Base
2
2
  before_create :generate_token
3
3
 
4
4
  def point_to(otherToken)
5
- Raydash.changeStream(self.connected_to,otherToken)
5
+ Raydash.changeStream(self.token,otherToken)
6
6
  self.connected_to=otherToken
7
7
  self.save()
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module Raydash
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raydash
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gershon Bialer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-09 00:00:00 -06:00
18
+ date: 2011-02-12 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies: []
21
21