bumbleworks-rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bumbleworks/rails/version.rb +1 -1
  3. data/lib/generators/bumbleworks/rails/install/install_generator.rb +6 -0
  4. data/lib/generators/bumbleworks/rails/install/templates/config/routes.rb +13 -0
  5. data/spec/controllers/tasks_controller_spec.rb +188 -0
  6. data/spec/dummy/README.rdoc +28 -0
  7. data/spec/dummy/Rakefile +6 -0
  8. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  9. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  10. data/spec/dummy/app/controllers/application_controller.rb +13 -0
  11. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  12. data/spec/dummy/app/models/fridget.rb +3 -0
  13. data/spec/dummy/app/models/silvo_bloom.rb +3 -0
  14. data/spec/dummy/app/models/user.rb +14 -0
  15. data/spec/dummy/app/views/bumbleworks/tasks/custom/_chew_on_quandary.html.erb +1 -0
  16. data/spec/dummy/app/views/fridgets/tasks/custom/_chew_on_quandary.html.erb +1 -0
  17. data/spec/dummy/app/views/fridgets/tasks/show.html.erb +3 -0
  18. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  19. data/spec/dummy/app/views/silvo_blooms/tasks/index.html.erb +11 -0
  20. data/spec/dummy/bin/bundle +3 -0
  21. data/spec/dummy/bin/rails +4 -0
  22. data/spec/dummy/bin/rake +4 -0
  23. data/spec/dummy/config/application.rb +28 -0
  24. data/spec/dummy/config/boot.rb +5 -0
  25. data/spec/dummy/config/database.yml +25 -0
  26. data/spec/dummy/config/environment.rb +5 -0
  27. data/spec/dummy/config/environments/development.rb +29 -0
  28. data/spec/dummy/config/environments/production.rb +80 -0
  29. data/spec/dummy/config/environments/test.rb +36 -0
  30. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  31. data/spec/dummy/config/initializers/bumbleworks.rb +6 -0
  32. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  33. data/spec/dummy/config/initializers/inflections.rb +16 -0
  34. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  35. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  36. data/spec/dummy/config/initializers/session_store.rb +3 -0
  37. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  38. data/spec/dummy/config/locales/bumbleworks.en.yml +11 -0
  39. data/spec/dummy/config/locales/en.yml +23 -0
  40. data/spec/dummy/config/routes.rb +19 -0
  41. data/spec/dummy/config.ru +21 -0
  42. data/spec/dummy/db/development.sqlite3 +0 -0
  43. data/spec/dummy/db/test.sqlite3 +0 -0
  44. data/spec/dummy/lib/bumbleworks/participants.rb +3 -0
  45. data/spec/dummy/lib/bumbleworks/processes/dummy_process.rb +7 -0
  46. data/spec/dummy/lib/fake_model.rb +26 -0
  47. data/spec/dummy/log/development.log +21593 -0
  48. data/spec/dummy/log/test.log +6409 -0
  49. data/spec/dummy/public/404.html +58 -0
  50. data/spec/dummy/public/422.html +58 -0
  51. data/spec/dummy/public/500.html +57 -0
  52. data/spec/dummy/public/favicon.ico +0 -0
  53. data/spec/dummy/tmp/app/controllers/application_controller.rb +3 -0
  54. data/spec/dummy/tmp/config/initializers/bumbleworks.rb +5 -0
  55. data/spec/dummy/tmp/config/locales/bumbleworks.en.yml +8 -0
  56. data/spec/dummy/tmp/lib/bumbleworks/participants.rb +3 -0
  57. data/spec/helpers/tasks_helper_spec.rb +54 -0
  58. data/spec/lib/bumbleworks/rails/engine_spec.rb +11 -0
  59. data/spec/lib/bumbleworks/rails_spec.rb +5 -0
  60. data/spec/lib/generators/bumbleworks/rails/install/install_generator_spec.rb +52 -0
  61. data/spec/spec_helper.rb +26 -0
  62. data/spec/support/generator_helpers.rb +49 -0
  63. metadata +119 -2
@@ -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,12 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure your secret_key_base is kept private
11
+ # if you're sharing your code publicly.
12
+ Dummy::Application.config.secret_key_base = '6ec0b6b1126bf5c1a08bb0cd57408789e066503d1c5e2d43a8c95ba289a2236a1795705a1dd59148992c8950c40ae512ea8e6cc72806af08fd7415e6ea48b7f5'
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,11 @@
1
+ en:
2
+ bumbleworks:
3
+ unauthorized: "You are not authorized to access that resource."
4
+ tasks:
5
+ completed: "Task completed!"
6
+ not_found: "Can't find task %{task_id}"
7
+ unauthorized_release_attempt: "You do not currently have a lock on this task"
8
+ unclaimed_complete_attempt: "You cannot complete a task not claimed by you"
9
+ names:
10
+ shave_calves: "Calf Shaving is Fun"
11
+ iron_feet: "Ouch, that hurts %{entity}"
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,19 @@
1
+ require 'bumbleworks/gui'
2
+
3
+ Rails.application.routes.draw do
4
+ scope :module => 'bumbleworks/rails' do
5
+ scope '(:entity_type/:entity_id)' do
6
+ resources :tasks, :only => [:index, :show] do
7
+ member do
8
+ post 'complete'
9
+ post 'claim'
10
+ post 'release'
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+ mount Bumbleworks::Gui::RackApp => 'bw'
17
+
18
+ root 'bumbleworks/rails/tasks#index'
19
+ end
@@ -0,0 +1,21 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+
5
+ # Initialize our fake database
6
+ FAKE_DATABASE = {}
7
+
8
+ # Bootstrap Bumbleworks (loads process definitions & registers paricipants)
9
+ Bumbleworks.bootstrap!
10
+
11
+ # Start an in-memory worker (Hash storage)
12
+ Bumbleworks.start_worker!
13
+
14
+ # Launch four processes, two for each entity type
15
+ Bumbleworks.launch!('dummy_process', :entity => Fridget.new(1))
16
+ Bumbleworks.launch!('dummy_process', :entity => Fridget.new(2))
17
+
18
+ Bumbleworks.launch!('dummy_process', :entity => SilvoBloom.new(1))
19
+ Bumbleworks.launch!('dummy_process', :entity => SilvoBloom.new(2))
20
+
21
+ run Rails.application
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ Bumbleworks.register_participants do
2
+ # Add your own custom participants here.
3
+ end
@@ -0,0 +1,7 @@
1
+ Bumbleworks.define_process do
2
+ concurrence do
3
+ beaver :task => 'make_a_dam'
4
+ cop :task => 'chew_on_quandary'
5
+ cop :task => 'try_on_scarf'
6
+ end
7
+ end
@@ -0,0 +1,26 @@
1
+ class FakeModel
2
+ attr_reader :id
3
+
4
+ def initialize(id)
5
+ @id = id
6
+ self.class.all << self
7
+ end
8
+
9
+ def to_param
10
+ id
11
+ end
12
+
13
+ class << self
14
+ def all
15
+ FAKE_DATABASE[name] ||= []
16
+ end
17
+
18
+ def count
19
+ all.count
20
+ end
21
+
22
+ def first_by_identifier(id)
23
+ all.detect { |member| member.id == id.to_i }
24
+ end
25
+ end
26
+ end