wschenk-workstreamer_api 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/.document +5 -0
  2. data/.gitignore +9 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +23 -0
  5. data/Rakefile +52 -0
  6. data/VERSION +1 -0
  7. data/lib/workstreamer_api.rb +375 -0
  8. data/rails_example/Rakefile +10 -0
  9. data/rails_example/app/controllers/application.rb +15 -0
  10. data/rails_example/app/controllers/user_controller.rb +12 -0
  11. data/rails_example/app/controllers/workstreamer_controller.rb +154 -0
  12. data/rails_example/app/helpers/application_helper.rb +3 -0
  13. data/rails_example/app/helpers/user_helper.rb +2 -0
  14. data/rails_example/app/helpers/workstreamer_helper.rb +2 -0
  15. data/rails_example/app/models/user.rb +2 -0
  16. data/rails_example/app/views/layouts/application.rhtml +158 -0
  17. data/rails_example/app/views/workstreamer/index.html.erb +1 -0
  18. data/rails_example/app/views/workstreamer/info.html.erb +25 -0
  19. data/rails_example/app/views/workstreamer/stream.html.erb +24 -0
  20. data/rails_example/config/app_config.yml +3 -0
  21. data/rails_example/config/boot.rb +109 -0
  22. data/rails_example/config/database.yml +22 -0
  23. data/rails_example/config/environment.rb +77 -0
  24. data/rails_example/config/environments/development.rb +17 -0
  25. data/rails_example/config/environments/production.rb +24 -0
  26. data/rails_example/config/environments/test.rb +22 -0
  27. data/rails_example/config/initializers/inflections.rb +10 -0
  28. data/rails_example/config/initializers/mime_types.rb +5 -0
  29. data/rails_example/config/initializers/new_rails_defaults.rb +17 -0
  30. data/rails_example/config/locales/en.yml +5 -0
  31. data/rails_example/config/routes.rb +43 -0
  32. data/rails_example/db/migrate/20090611183940_create_users.rb +15 -0
  33. data/rails_example/db/schema.rb +23 -0
  34. data/rails_example/doc/README_FOR_APP +5 -0
  35. data/rails_example/public/404.html +30 -0
  36. data/rails_example/public/422.html +30 -0
  37. data/rails_example/public/500.html +33 -0
  38. data/rails_example/public/dispatch.cgi +10 -0
  39. data/rails_example/public/dispatch.fcgi +24 -0
  40. data/rails_example/public/dispatch.rb +10 -0
  41. data/rails_example/public/favicon.ico +0 -0
  42. data/rails_example/public/images/rails.png +0 -0
  43. data/rails_example/public/javascripts/application.js +2 -0
  44. data/rails_example/public/javascripts/controls.js +963 -0
  45. data/rails_example/public/javascripts/dragdrop.js +973 -0
  46. data/rails_example/public/javascripts/effects.js +1128 -0
  47. data/rails_example/public/javascripts/prototype.js +4320 -0
  48. data/rails_example/public/robots.txt +5 -0
  49. data/rails_example/script/about +4 -0
  50. data/rails_example/script/console +3 -0
  51. data/rails_example/script/dbconsole +3 -0
  52. data/rails_example/script/destroy +3 -0
  53. data/rails_example/script/generate +3 -0
  54. data/rails_example/script/performance/benchmarker +3 -0
  55. data/rails_example/script/performance/profiler +3 -0
  56. data/rails_example/script/performance/request +3 -0
  57. data/rails_example/script/plugin +3 -0
  58. data/rails_example/script/process/inspector +3 -0
  59. data/rails_example/script/process/reaper +3 -0
  60. data/rails_example/script/process/spawner +3 -0
  61. data/rails_example/script/runner +3 -0
  62. data/rails_example/script/server +3 -0
  63. data/rails_example/test/fixtures/users.yml +7 -0
  64. data/rails_example/test/functional/user_controller_test.rb +8 -0
  65. data/rails_example/test/functional/workstreamer_controller_test.rb +8 -0
  66. data/rails_example/test/performance/browsing_test.rb +9 -0
  67. data/rails_example/test/test_helper.rb +38 -0
  68. data/rails_example/test/unit/user_test.rb +8 -0
  69. data/spec/spec_helper.rb +9 -0
  70. data/spec/workstreamer_api_spec.rb +7 -0
  71. metadata +143 -0
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,77 @@
1
+ # Be sure to restart your server when you modify this file
2
+
3
+ # Uncomment below to force Rails into production mode when
4
+ # you don't control web/app server and can't set it the proper way
5
+ # ENV['RAILS_ENV'] ||= 'production'
6
+
7
+ # Specifies gem version of Rails to use when vendor/rails is not present
8
+ RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
9
+
10
+ # Bootstrap the Rails environment, frameworks, and default configuration
11
+ require File.join(File.dirname(__FILE__), 'boot')
12
+
13
+ Rails::Initializer.run do |config|
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration should go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded.
17
+ # See Rails::Configuration for more options.
18
+
19
+ # Skip frameworks you're not going to use. To use Rails without a database
20
+ # you must remove the Active Record framework.
21
+ # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
22
+
23
+ # Specify gems that this application depends on.
24
+ # They can then be installed with "rake gems:install" on new installations.
25
+ # You have to specify the :lib option for libraries, where the Gem name (sqlite3-ruby) differs from the file itself (sqlite3)
26
+ config.gem "workstreamer_api"
27
+ # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
28
+ # config.gem "sqlite3-ruby", :lib => "sqlite3"
29
+ # config.gem "aws-s3", :lib => "aws/s3"
30
+
31
+ # Only load the plugins named here, in the order given. By default, all plugins
32
+ # in vendor/plugins are loaded in alphabetical order.
33
+ # :all can be used as a placeholder for all plugins not explicitly named
34
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
35
+
36
+ # Add additional load paths for your own custom dirs
37
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
38
+
39
+ # Force all environments to use the same logger level
40
+ # (by default production uses :info, the others :debug)
41
+ # config.log_level = :debug
42
+
43
+ # Make Time.zone default to the specified zone, and make Active Record store time values
44
+ # in the database in UTC, and return them converted to the specified local zone.
45
+ # Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time.
46
+ config.time_zone = 'UTC'
47
+
48
+ # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths.
49
+ # All files from config/locales/*.rb,yml are added automatically.
50
+ # config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')]
51
+ # config.i18n.default_locale = :de
52
+
53
+ # Your secret key for verifying cookie session data integrity.
54
+ # If you change this key, all old sessions will become invalid!
55
+ # Make sure the secret is at least 30 characters and all random,
56
+ # no regular words or you'll be exposed to dictionary attacks.
57
+ config.action_controller.session = {
58
+ :session_key => '_example_session',
59
+ :secret => '95471f4c5934ee3c7b79103ef32769c985ea438077a553e7f4711dd9ba60e671b942bd8d1e6dbd597c9ec603e4c1cef6cdaac38c35786d6fe902204384f8e7e4'
60
+ }
61
+
62
+ # Use the database for sessions instead of the cookie-based default,
63
+ # which shouldn't be used to store highly confidential information
64
+ # (create the session table with "rake db:sessions:create")
65
+ # config.action_controller.session_store = :active_record_store
66
+
67
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
68
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
69
+ # like if you have constraints or database-specific column types
70
+ # config.active_record.schema_format = :sql
71
+
72
+ # Activate observers that should always be running
73
+ # Please note that observers generated using script/generate observer need to have an _observer suffix
74
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
75
+ end
76
+
77
+ APP_CONFIG = YAML.load( File.read( "#{RAILS_ROOT}/config/app_config.yml")).symbolize_keys
@@ -0,0 +1,17 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # In the development environment your application's code is reloaded on
4
+ # every request. This slows down response time but is perfect for development
5
+ # since you don't have to restart the webserver when you make code changes.
6
+ config.cache_classes = false
7
+
8
+ # Log error messages when you accidentally call methods on nil.
9
+ config.whiny_nils = true
10
+
11
+ # Show full error reports and disable caching
12
+ config.action_controller.consider_all_requests_local = true
13
+ config.action_view.debug_rjs = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,24 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The production environment is meant for finished, "live" apps.
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Enable threaded mode
8
+ # config.threadsafe!
9
+
10
+ # Use a different logger for distributed setups
11
+ # config.logger = SyslogLogger.new
12
+
13
+ # Full error reports are disabled and caching is turned on
14
+ config.action_controller.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Use a different cache store in production
18
+ # config.cache_store = :mem_cache_store
19
+
20
+ # Enable serving of images, stylesheets, and javascripts from an asset server
21
+ # config.action_controller.asset_host = "http://assets.example.com"
22
+
23
+ # Disable delivery errors, bad email addresses will be ignored
24
+ # config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,22 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+ config.cache_classes = true
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Disable request forgery protection in test environment
17
+ config.action_controller.allow_forgery_protection = false
18
+
19
+ # Tell Action Mailer not to deliver emails to the real world.
20
+ # The :test delivery method accumulates sent emails in the
21
+ # ActionMailer::Base.deliveries array.
22
+ config.action_mailer.delivery_method = :test
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,17 @@
1
+ # These settings change the behavior of Rails 2 apps and will be defaults
2
+ # for Rails 3. You can remove this initializer when Rails 3 is released.
3
+
4
+ if defined?(ActiveRecord)
5
+ # Include Active Record class name as root for JSON serialized output.
6
+ ActiveRecord::Base.include_root_in_json = true
7
+
8
+ # Store the full class name (including module namespace) in STI type column.
9
+ ActiveRecord::Base.store_full_sti_class = true
10
+ end
11
+
12
+ # Use ISO 8601 format for JSON serialized times and dates.
13
+ ActiveSupport.use_standard_json_time_format = true
14
+
15
+ # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
16
+ # if you're including raw json in an HTML page.
17
+ ActiveSupport.escape_html_entities_in_json = false
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,43 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ # The priority is based upon order of creation: first created -> highest priority.
3
+
4
+ # Sample of regular route:
5
+ # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
6
+ # Keep in mind you can assign values other than :controller and :action
7
+
8
+ # Sample of named route:
9
+ # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
10
+ # This route can be invoked with purchase_url(:id => product.id)
11
+
12
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
13
+ # map.resources :products
14
+
15
+ # Sample resource route with options:
16
+ # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
17
+
18
+ # Sample resource route with sub-resources:
19
+ # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
20
+
21
+ # Sample resource route with more complex sub-resources
22
+ # map.resources :products do |products|
23
+ # products.resources :comments
24
+ # products.resources :sales, :collection => { :recent => :get }
25
+ # end
26
+
27
+ # Sample resource route within a namespace:
28
+ # map.namespace :admin do |admin|
29
+ # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
30
+ # admin.resources :products
31
+ # end
32
+
33
+ # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
34
+ map.root :controller => "workstreamer"
35
+
36
+ # See how all your routes lay out with "rake routes"
37
+
38
+ # Install the default routes as the lowest priority.
39
+ # Note: These default routes make all actions in every controller accessible via GET requests. You should
40
+ # consider removing the them or commenting them out if you're using named routes and resources.
41
+ map.connect ':controller/:action/:id'
42
+ map.connect ':controller/:action/:id.:format'
43
+ end
@@ -0,0 +1,15 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :users do |t|
4
+ t.string :username
5
+ t.string :login
6
+ t.string :token
7
+ t.string :secret
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :users
14
+ end
15
+ end
@@ -0,0 +1,23 @@
1
+ # This file is auto-generated from the current state of the database. Instead of editing this file,
2
+ # please use the migrations feature of Active Record to incrementally modify your database, and
3
+ # then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6
+ # to create the application database on another system, you should be using db:schema:load, not running
7
+ # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
9
+ #
10
+ # It's strongly recommended to check this file into your version control system.
11
+
12
+ ActiveRecord::Schema.define(:version => 20090611183940) do
13
+
14
+ create_table "users", :force => true do |t|
15
+ t.string "username"
16
+ t.string "login"
17
+ t.string "token"
18
+ t.string "secret"
19
+ t.datetime "created_at"
20
+ t.datetime "updated_at"
21
+ end
22
+
23
+ end
@@ -0,0 +1,5 @@
1
+ To build the guides:
2
+
3
+ * Install source-highlighter (http://www.gnu.org/software/src-highlite/source-highlight.html)
4
+ * Install the mizuho gem (http://github.com/FooBarWidget/mizuho/tree/master)
5
+ * Run `rake guides` from the railties directory
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
+ <title>The page you were looking for doesn't exist (404)</title>
9
+ <style type="text/css">
10
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
+ div.dialog {
12
+ width: 25em;
13
+ padding: 0 4em;
14
+ margin: 4em auto 0 auto;
15
+ border: 1px solid #ccc;
16
+ border-right-color: #999;
17
+ border-bottom-color: #999;
18
+ }
19
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <!-- This file lives in public/404.html -->
25
+ <div class="dialog">
26
+ <h1>The page you were looking for doesn't exist.</h1>
27
+ <p>You may have mistyped the address or the page may have moved.</p>
28
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
+ <title>The change you wanted was rejected (422)</title>
9
+ <style type="text/css">
10
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
+ div.dialog {
12
+ width: 25em;
13
+ padding: 0 4em;
14
+ margin: 4em auto 0 auto;
15
+ border: 1px solid #ccc;
16
+ border-right-color: #999;
17
+ border-bottom-color: #999;
18
+ }
19
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <!-- This file lives in public/422.html -->
25
+ <div class="dialog">
26
+ <h1>The change you wanted was rejected.</h1>
27
+ <p>Maybe you tried to change something you didn't have access to.</p>
28
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,33 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
+ <title>We're sorry, but something went wrong (500)</title>
9
+ <style type="text/css">
10
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
+ div.dialog {
12
+ width: 25em;
13
+ padding: 0 4em;
14
+ margin: 4em auto 0 auto;
15
+ border: 1px solid #ccc;
16
+ border-right-color: #999;
17
+ border-bottom-color: #999;
18
+ }
19
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <!-- This file lives in public/500.html -->
25
+ <div class="dialog">
26
+ <h1>We're sorry, but something went wrong.</h1>
27
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
28
+ <p><small>(If you're the administrator of this website, then please read
29
+ the log file "<%=h RAILS_ENV %>.log"
30
+ to find out what went wrong.)</small></p>
31
+ </div>
32
+ </body>
33
+ </html>
@@ -0,0 +1,10 @@
1
+ #!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
2
+
3
+ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
4
+
5
+ # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
6
+ # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
7
+ require "dispatcher"
8
+
9
+ ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
10
+ Dispatcher.dispatch
@@ -0,0 +1,24 @@
1
+ #!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
2
+ #
3
+ # You may specify the path to the FastCGI crash log (a log of unhandled
4
+ # exceptions which forced the FastCGI instance to exit, great for debugging)
5
+ # and the number of requests to process before running garbage collection.
6
+ #
7
+ # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
8
+ # and the GC period is nil (turned off). A reasonable number of requests
9
+ # could range from 10-100 depending on the memory footprint of your app.
10
+ #
11
+ # Example:
12
+ # # Default log path, normal GC behavior.
13
+ # RailsFCGIHandler.process!
14
+ #
15
+ # # Default log path, 50 requests between GC.
16
+ # RailsFCGIHandler.process! nil, 50
17
+ #
18
+ # # Custom log path, normal GC behavior.
19
+ # RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
20
+ #
21
+ require File.dirname(__FILE__) + "/../config/environment"
22
+ require 'fcgi_handler'
23
+
24
+ RailsFCGIHandler.process!