havior 0.1.0

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.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +34 -0
  5. data/lib/generators/havior/USAGE +8 -0
  6. data/lib/generators/havior/havior_generator.rb +63 -0
  7. data/lib/generators/havior/install_generator.rb +32 -0
  8. data/lib/generators/havior/templates/haviors/controller.rb.erb +12 -0
  9. data/lib/generators/havior/templates/haviors/haxe/Havior.hx.erb +26 -0
  10. data/lib/generators/havior/templates/haviors/model.rb.erb +15 -0
  11. data/lib/generators/havior/templates/haviors/routes.rb.erb +7 -0
  12. data/lib/generators/havior/templates/haxe/havior.hxml.erb +7 -0
  13. data/lib/generators/havior/templates/haxe/lib/Havior.hx +83 -0
  14. data/lib/havior.rb +11 -0
  15. data/lib/havior/builder.rb +34 -0
  16. data/lib/havior/helper.rb +13 -0
  17. data/lib/havior/model.rb +33 -0
  18. data/lib/havior/routes.rb +12 -0
  19. data/lib/havior/version.rb +3 -0
  20. data/lib/tasks/havior_tasks.rake +4 -0
  21. data/test/dummy/Gemfile +46 -0
  22. data/test/dummy/Gemfile.lock +171 -0
  23. data/test/dummy/README.rdoc +28 -0
  24. data/test/dummy/Rakefile +6 -0
  25. data/test/dummy/app/assets/javascripts/application.js +16 -0
  26. data/test/dummy/app/assets/javascripts/top.coffee +3 -0
  27. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  28. data/test/dummy/app/assets/stylesheets/top.scss +3 -0
  29. data/test/dummy/app/controllers/application_controller.rb +5 -0
  30. data/test/dummy/app/controllers/top_controller.rb +4 -0
  31. data/test/dummy/app/haviors/misc/todo/haxe/Todo.hx +42 -0
  32. data/test/dummy/app/haviors/misc/todo/model.rb +15 -0
  33. data/test/dummy/app/haviors/misc/todo/routes.rb +11 -0
  34. data/test/dummy/app/haviors/misc/todo/todo_controller.rb +24 -0
  35. data/test/dummy/app/haviors/misc/todo/views/todo.html.erb +1 -0
  36. data/test/dummy/app/helpers/application_helper.rb +2 -0
  37. data/test/dummy/app/helpers/top_helper.rb +2 -0
  38. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  39. data/test/dummy/app/views/top/index.html.erb +6 -0
  40. data/test/dummy/bin/bundle +3 -0
  41. data/test/dummy/bin/rails +8 -0
  42. data/test/dummy/bin/rake +8 -0
  43. data/test/dummy/bin/setup +29 -0
  44. data/test/dummy/bin/spring +18 -0
  45. data/test/dummy/config.ru +4 -0
  46. data/test/dummy/config/application.rb +26 -0
  47. data/test/dummy/config/boot.rb +3 -0
  48. data/test/dummy/config/database.yml +25 -0
  49. data/test/dummy/config/environment.rb +5 -0
  50. data/test/dummy/config/environments/development.rb +41 -0
  51. data/test/dummy/config/environments/production.rb +79 -0
  52. data/test/dummy/config/environments/test.rb +42 -0
  53. data/test/dummy/config/initializers/assets.rb +11 -0
  54. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  55. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  56. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  57. data/test/dummy/config/initializers/inflections.rb +16 -0
  58. data/test/dummy/config/initializers/mime_types.rb +4 -0
  59. data/test/dummy/config/initializers/session_store.rb +3 -0
  60. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  61. data/test/dummy/config/locales/en.yml +23 -0
  62. data/test/dummy/config/routes.rb +58 -0
  63. data/test/dummy/config/secrets.yml +22 -0
  64. data/test/dummy/db/development.sqlite3 +0 -0
  65. data/test/dummy/db/seeds.rb +7 -0
  66. data/test/dummy/haxe/havior.hxml +7 -0
  67. data/test/dummy/haxe/lib/Havior.hx +83 -0
  68. data/test/dummy/log/development.log +96 -0
  69. data/test/dummy/public/404.html +67 -0
  70. data/test/dummy/public/422.html +67 -0
  71. data/test/dummy/public/500.html +66 -0
  72. data/test/dummy/public/favicon.ico +0 -0
  73. data/test/dummy/public/javascripts/misc/todo/todo.js +206 -0
  74. data/test/dummy/public/robots.txt +5 -0
  75. data/test/dummy/public/stylesheets/misc/todo/todo.css +0 -0
  76. data/test/dummy/test/controllers/top_controller_test.rb +9 -0
  77. data/test/dummy/test/test_helper.rb +10 -0
  78. data/test/dummy/tmp/cache/assets/development/sass/f3ea2a11dd4dcf99bc71cead6095f5bcdec0e3c1/top.scssc +0 -0
  79. data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  80. data/test/dummy/tmp/cache/assets/development/sprockets/144480218666373c17378e01c880a73e +0 -0
  81. data/test/dummy/tmp/cache/assets/development/sprockets/18d2cbb0f2269d20680f775d08981e72 +0 -0
  82. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  83. data/test/dummy/tmp/cache/assets/development/sprockets/34226a9205e8dd111f3fd667140e3557 +0 -0
  84. data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  85. data/test/dummy/tmp/cache/assets/development/sprockets/55775c8c8fb4940e0575e4087043324a +0 -0
  86. data/test/dummy/tmp/cache/assets/development/sprockets/69a055f006179beba2a830d88e39fa88 +0 -0
  87. data/test/dummy/tmp/cache/assets/development/sprockets/7c6e5314d519217e99ce56f93eacb7ca +0 -0
  88. data/test/dummy/tmp/cache/assets/development/sprockets/82ac2910cee5ad83240253d81fd60ad8 +0 -0
  89. data/test/dummy/tmp/cache/assets/development/sprockets/86d34baf8dfb1e16ed00123e1e2a2190 +0 -0
  90. data/test/dummy/tmp/cache/assets/development/sprockets/9c1b6c9edc5c7d33d390964b955748a8 +0 -0
  91. data/test/dummy/tmp/cache/assets/development/sprockets/a69a6a0e8b2413a18e01dcc9e07b7263 +0 -0
  92. data/test/dummy/tmp/cache/assets/development/sprockets/ccf10475f5be0d54da1c2c223b3fca5d +0 -0
  93. data/test/dummy/tmp/cache/assets/development/sprockets/cdf84c819e9ef95e6edb7a5d36549ca4 +0 -0
  94. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  95. data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  96. data/test/dummy/tmp/cache/assets/development/sprockets/f4779bd843bfdc90d8c4fe47fcfc5c02 +0 -0
  97. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  98. data/test/dummy/tmp/cache/assets/development/sprockets/fe9f4bf7a4d033c8ec226c659ceba27e +0 -0
  99. data/test/dummy/tmp/cache/assets/development/sprockets/ffa538b8e1d908ed228e70f373c3aa00 +0 -0
  100. data/test/dummy/tmp/pids/server.pid +1 -0
  101. data/test/havior_test.rb +7 -0
  102. data/test/test_helper.rb +18 -0
  103. metadata +255 -0
@@ -0,0 +1,3 @@
1
+ module Havior
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :havior do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,46 @@
1
+ source 'https://rubygems.org'
2
+
3
+
4
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
+ gem 'rails', '4.2.0'
6
+ # Use sqlite3 as the database for Active Record
7
+ gem 'sqlite3'
8
+ # Use SCSS for stylesheets
9
+ gem 'sass-rails', '~> 5.0'
10
+ # Use Uglifier as compressor for JavaScript assets
11
+ gem 'uglifier', '>= 1.3.0'
12
+ # Use CoffeeScript for .coffee assets and views
13
+ gem 'coffee-rails', '~> 4.1.0'
14
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
15
+ # gem 'therubyracer', platforms: :ruby
16
+
17
+ # Use jquery as the JavaScript library
18
+ gem 'jquery-rails'
19
+ # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
20
+ gem 'turbolinks'
21
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
22
+ gem 'jbuilder', '~> 2.0'
23
+ # bundle exec rake doc:rails generates the API under doc/api.
24
+ gem 'sdoc', '~> 0.4.0', group: :doc
25
+
26
+ # Use ActiveModel has_secure_password
27
+ # gem 'bcrypt', '~> 3.1.7'
28
+
29
+ # Use Unicorn as the app server
30
+ # gem 'unicorn'
31
+
32
+ # Use Capistrano for deployment
33
+ # gem 'capistrano-rails', group: :development
34
+
35
+ group :development, :test do
36
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
37
+ gem 'byebug'
38
+
39
+ # Access an IRB console on exception pages or by using <%= console %> in views
40
+ gem 'web-console', '~> 2.0'
41
+
42
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
43
+ gem 'spring'
44
+ end
45
+
46
+ gem 'havior', path: "../../"
@@ -0,0 +1,171 @@
1
+ PATH
2
+ remote: ../../
3
+ specs:
4
+ havior (0.0.1)
5
+ rails (~> 4.2.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.2.0)
11
+ actionpack (= 4.2.0)
12
+ actionview (= 4.2.0)
13
+ activejob (= 4.2.0)
14
+ mail (~> 2.5, >= 2.5.4)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ actionpack (4.2.0)
17
+ actionview (= 4.2.0)
18
+ activesupport (= 4.2.0)
19
+ rack (~> 1.6.0)
20
+ rack-test (~> 0.6.2)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
23
+ actionview (4.2.0)
24
+ activesupport (= 4.2.0)
25
+ builder (~> 3.1)
26
+ erubis (~> 2.7.0)
27
+ rails-dom-testing (~> 1.0, >= 1.0.5)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
29
+ activejob (4.2.0)
30
+ activesupport (= 4.2.0)
31
+ globalid (>= 0.3.0)
32
+ activemodel (4.2.0)
33
+ activesupport (= 4.2.0)
34
+ builder (~> 3.1)
35
+ activerecord (4.2.0)
36
+ activemodel (= 4.2.0)
37
+ activesupport (= 4.2.0)
38
+ arel (~> 6.0)
39
+ activesupport (4.2.0)
40
+ i18n (~> 0.7)
41
+ json (~> 1.7, >= 1.7.7)
42
+ minitest (~> 5.1)
43
+ thread_safe (~> 0.3, >= 0.3.4)
44
+ tzinfo (~> 1.1)
45
+ arel (6.0.0)
46
+ binding_of_caller (0.7.2)
47
+ debug_inspector (>= 0.0.1)
48
+ builder (3.2.2)
49
+ byebug (3.5.1)
50
+ columnize (~> 0.8)
51
+ debugger-linecache (~> 1.2)
52
+ slop (~> 3.6)
53
+ coffee-rails (4.1.0)
54
+ coffee-script (>= 2.2.0)
55
+ railties (>= 4.0.0, < 5.0)
56
+ coffee-script (2.3.0)
57
+ coffee-script-source
58
+ execjs
59
+ coffee-script-source (1.9.0)
60
+ columnize (0.9.0)
61
+ debug_inspector (0.0.2)
62
+ debugger-linecache (1.2.0)
63
+ erubis (2.7.0)
64
+ execjs (2.3.0)
65
+ globalid (0.3.2)
66
+ activesupport (>= 4.1.0)
67
+ hike (1.2.3)
68
+ i18n (0.7.0)
69
+ jbuilder (2.2.6)
70
+ activesupport (>= 3.0.0, < 5)
71
+ multi_json (~> 1.2)
72
+ jquery-rails (4.0.3)
73
+ rails-dom-testing (~> 1.0)
74
+ railties (>= 4.2.0)
75
+ thor (>= 0.14, < 2.0)
76
+ json (1.8.2)
77
+ loofah (2.0.1)
78
+ nokogiri (>= 1.5.9)
79
+ mail (2.6.3)
80
+ mime-types (>= 1.16, < 3)
81
+ mime-types (2.4.3)
82
+ mini_portile (0.6.2)
83
+ minitest (5.5.1)
84
+ multi_json (1.10.1)
85
+ nokogiri (1.6.6.2)
86
+ mini_portile (~> 0.6.0)
87
+ rack (1.6.0)
88
+ rack-test (0.6.3)
89
+ rack (>= 1.0)
90
+ rails (4.2.0)
91
+ actionmailer (= 4.2.0)
92
+ actionpack (= 4.2.0)
93
+ actionview (= 4.2.0)
94
+ activejob (= 4.2.0)
95
+ activemodel (= 4.2.0)
96
+ activerecord (= 4.2.0)
97
+ activesupport (= 4.2.0)
98
+ bundler (>= 1.3.0, < 2.0)
99
+ railties (= 4.2.0)
100
+ sprockets-rails
101
+ rails-deprecated_sanitizer (1.0.3)
102
+ activesupport (>= 4.2.0.alpha)
103
+ rails-dom-testing (1.0.5)
104
+ activesupport (>= 4.2.0.beta, < 5.0)
105
+ nokogiri (~> 1.6.0)
106
+ rails-deprecated_sanitizer (>= 1.0.1)
107
+ rails-html-sanitizer (1.0.1)
108
+ loofah (~> 2.0)
109
+ railties (4.2.0)
110
+ actionpack (= 4.2.0)
111
+ activesupport (= 4.2.0)
112
+ rake (>= 0.8.7)
113
+ thor (>= 0.18.1, < 2.0)
114
+ rake (10.4.2)
115
+ rdoc (4.2.0)
116
+ json (~> 1.4)
117
+ sass (3.4.11)
118
+ sass-rails (5.0.1)
119
+ railties (>= 4.0.0, < 5.0)
120
+ sass (~> 3.1)
121
+ sprockets (>= 2.8, < 4.0)
122
+ sprockets-rails (>= 2.0, < 4.0)
123
+ tilt (~> 1.1)
124
+ sdoc (0.4.1)
125
+ json (~> 1.7, >= 1.7.7)
126
+ rdoc (~> 4.0)
127
+ slop (3.6.0)
128
+ spring (1.3.1)
129
+ sprockets (2.12.3)
130
+ hike (~> 1.2)
131
+ multi_json (~> 1.0)
132
+ rack (~> 1.0)
133
+ tilt (~> 1.1, != 1.3.0)
134
+ sprockets-rails (2.2.4)
135
+ actionpack (>= 3.0)
136
+ activesupport (>= 3.0)
137
+ sprockets (>= 2.8, < 4.0)
138
+ sqlite3 (1.3.10)
139
+ thor (0.19.1)
140
+ thread_safe (0.3.4)
141
+ tilt (1.4.1)
142
+ turbolinks (2.5.3)
143
+ coffee-rails
144
+ tzinfo (1.2.2)
145
+ thread_safe (~> 0.1)
146
+ uglifier (2.7.0)
147
+ execjs (>= 0.3.0)
148
+ json (>= 1.8.0)
149
+ web-console (2.0.0)
150
+ activemodel (~> 4.0)
151
+ binding_of_caller (>= 0.7.2)
152
+ railties (~> 4.0)
153
+ sprockets-rails (>= 2.0, < 4.0)
154
+
155
+ PLATFORMS
156
+ ruby
157
+
158
+ DEPENDENCIES
159
+ byebug
160
+ coffee-rails (~> 4.1.0)
161
+ havior!
162
+ jbuilder (~> 2.0)
163
+ jquery-rails
164
+ rails (= 4.2.0)
165
+ sass-rails (~> 5.0)
166
+ sdoc (~> 0.4.0)
167
+ spring
168
+ sqlite3
169
+ turbolinks
170
+ uglifier (>= 1.3.0)
171
+ web-console (~> 2.0)
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the top controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,4 @@
1
+ class TopController < ApplicationController
2
+ def index
3
+ end
4
+ end
@@ -0,0 +1,42 @@
1
+ import jQuery.*;
2
+
3
+ class Todo extends Havior {
4
+ public static function main(){
5
+ Havior.start("misc/todo");
6
+ }
7
+
8
+ public override function onLoad(){
9
+
10
+
11
+ // list@get
12
+ addCallback("list@get", function(data){
13
+ /// TODO
14
+ this.getDOM().html("list@get:" + data.message);
15
+ });
16
+
17
+ // add@post
18
+ addCallback("add@post", function(data){
19
+ /// TODO
20
+ this.getDOM().html("add@post:" + data.message);
21
+ });
22
+
23
+ // del@get
24
+ addCallback("del@get", function(data){
25
+ /// TODO
26
+ this.getDOM().html("del@get:" + data.message);
27
+ });
28
+
29
+
30
+
31
+
32
+ sendAsync("list@get", {} );
33
+
34
+ // sendAsync("add@post", {} );
35
+
36
+ // sendAsync("del@get", {} );
37
+
38
+ }
39
+ }
40
+
41
+
42
+
@@ -0,0 +1,15 @@
1
+ class Misc::Todo::Model < Havior::Model
2
+
3
+ def erb_script
4
+ "todo.html.erb"
5
+ end
6
+
7
+ def javascripts
8
+ ["javascripts/misc/todo/todo.js"]
9
+ end
10
+
11
+ def stylesheets
12
+ ["stylesheets/misc/todo/todo.css"]
13
+ end
14
+
15
+ end
@@ -0,0 +1,11 @@
1
+ Rails.application.routes.draw do
2
+ scope "havior/misc/todo", module: "misc/todo" do
3
+
4
+ get "list" => "todo#list"
5
+
6
+ post "add" => "todo#add"
7
+
8
+ get "del" => "todo#del"
9
+
10
+ end
11
+ end
@@ -0,0 +1,24 @@
1
+ class Misc::Todo::TodoController < ApplicationController
2
+
3
+
4
+ # GET /havior/misc/todo/todo/list
5
+ def list
6
+ render json: { result: "success",
7
+ message: "`Misc::Todo::Todo#list`" }
8
+ end
9
+
10
+ # POST /havior/misc/todo/todo/add
11
+ def add
12
+ render json: { result: "success",
13
+ message: "`Misc::Todo::Todo#add`" }
14
+ end
15
+
16
+ # GET /havior/misc/todo/todo/del
17
+ def del
18
+ render json: { result: "success",
19
+ message: "`Misc::Todo::Todo#del`" }
20
+ end
21
+
22
+
23
+ end
24
+
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module TopHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>