wakame-vdc-webui 10.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (281) hide show
  1. data/INSTALL.txt +21 -0
  2. data/LICENSE +202 -0
  3. data/NOTICE +1 -0
  4. data/README +256 -0
  5. data/Rakefile +42 -0
  6. data/app/controllers/accounts_controller.rb +15 -0
  7. data/app/controllers/application_controller.rb +5 -0
  8. data/app/controllers/dialog_controller.rb +80 -0
  9. data/app/controllers/home_controller.rb +5 -0
  10. data/app/controllers/host_pools_controller.rb +26 -0
  11. data/app/controllers/images_controller.rb +28 -0
  12. data/app/controllers/information_controller.rb +10 -0
  13. data/app/controllers/instances_controller.rb +59 -0
  14. data/app/controllers/keypairs_controller.rb +64 -0
  15. data/app/controllers/security_groups_controller.rb +59 -0
  16. data/app/controllers/sessions_controller.rb +25 -0
  17. data/app/controllers/snapshots_controller.rb +48 -0
  18. data/app/controllers/storage_pools_controller.rb +27 -0
  19. data/app/controllers/users_controller.rb +3 -0
  20. data/app/controllers/volumes_controller.rb +86 -0
  21. data/app/helpers/accounts_helper.rb +2 -0
  22. data/app/helpers/application_helper.rb +23 -0
  23. data/app/helpers/dialog_helper.rb +2 -0
  24. data/app/helpers/home_helper.rb +2 -0
  25. data/app/helpers/host_pools_helper.rb +2 -0
  26. data/app/helpers/images_helper.rb +2 -0
  27. data/app/helpers/information_helper.rb +2 -0
  28. data/app/helpers/instances_helper.rb +2 -0
  29. data/app/helpers/keypairs_helper.rb +2 -0
  30. data/app/helpers/security_groups_helper.rb +2 -0
  31. data/app/helpers/sessions_helper.rb +2 -0
  32. data/app/helpers/snapshots_helper.rb +2 -0
  33. data/app/helpers/storage_pools_helper.rb +2 -0
  34. data/app/helpers/users_helper.rb +2 -0
  35. data/app/helpers/volumes_helper.rb +2 -0
  36. data/app/models/account.rb +104 -0
  37. data/app/models/authz.rb +102 -0
  38. data/app/models/base_new.rb +311 -0
  39. data/app/models/dcmgr_resource/account.rb +5 -0
  40. data/app/models/dcmgr_resource/base.rb +51 -0
  41. data/app/models/dcmgr_resource/host_pool.rb +11 -0
  42. data/app/models/dcmgr_resource/image.rb +11 -0
  43. data/app/models/dcmgr_resource/instance.rb +37 -0
  44. data/app/models/dcmgr_resource/mock.rb +15 -0
  45. data/app/models/dcmgr_resource/netfilter_group.rb +29 -0
  46. data/app/models/dcmgr_resource/ssh_key_pair.rb +25 -0
  47. data/app/models/dcmgr_resource/storage_pool.rb +11 -0
  48. data/app/models/dcmgr_resource/volume.rb +48 -0
  49. data/app/models/dcmgr_resource/volume_snapshot.rb +35 -0
  50. data/app/models/information.rb +9 -0
  51. data/app/models/schema.rb +51 -0
  52. data/app/models/tag.rb +121 -0
  53. data/app/models/tag_mapping.rb +25 -0
  54. data/app/models/user.rb +46 -0
  55. data/app/views/accounts/index.html.erb +68 -0
  56. data/app/views/dialog/attach_volume.html.erb +13 -0
  57. data/app/views/dialog/create_and_edit_security_group.html.erb +32 -0
  58. data/app/views/dialog/create_snapshot.html.erb +7 -0
  59. data/app/views/dialog/create_ssh_keypair.html.erb +15 -0
  60. data/app/views/dialog/create_volume.html.erb +18 -0
  61. data/app/views/dialog/create_volume_from_snapshot.html.erb +7 -0
  62. data/app/views/dialog/delete_security_group.html.erb +4 -0
  63. data/app/views/dialog/delete_snapshot.html.erb +7 -0
  64. data/app/views/dialog/delete_ssh_keypair.html.erb +4 -0
  65. data/app/views/dialog/delete_volume.html.erb +7 -0
  66. data/app/views/dialog/detach_volume.html.erb +7 -0
  67. data/app/views/dialog/launch_instance.html.erb +70 -0
  68. data/app/views/dialog/reboot_instances.html.erb +7 -0
  69. data/app/views/dialog/start_instances.html.erb +8 -0
  70. data/app/views/dialog/stop_instances.html.erb +7 -0
  71. data/app/views/dialog/terminate_instances.html.erb +7 -0
  72. data/app/views/home/index.html.erb +55 -0
  73. data/app/views/host_pools/index.html.erb +103 -0
  74. data/app/views/images/index.html.erb +126 -0
  75. data/app/views/information/index.html.erb +25 -0
  76. data/app/views/instances/index.html.erb +134 -0
  77. data/app/views/keypairs/index.html.erb +104 -0
  78. data/app/views/layouts/_footer.html.erb +4 -0
  79. data/app/views/layouts/_header.html.erb +14 -0
  80. data/app/views/layouts/_informationarea.html.erb +18 -0
  81. data/app/views/layouts/_login_header.erb +4 -0
  82. data/app/views/layouts/_service_health.erb +27 -0
  83. data/app/views/layouts/_sidemenu.html.erb +58 -0
  84. data/app/views/layouts/application.html.erb +34 -0
  85. data/app/views/layouts/login.html.erb +25 -0
  86. data/app/views/security_groups/index.html.erb +114 -0
  87. data/app/views/sessions/new.html.erb +27 -0
  88. data/app/views/snapshots/index.html.erb +110 -0
  89. data/app/views/storage_pools/index.html.erb +98 -0
  90. data/app/views/volumes/index.html.erb +117 -0
  91. data/config.ru +4 -0
  92. data/config/application.rb +48 -0
  93. data/config/boot.rb +13 -0
  94. data/config/database.yml +20 -0
  95. data/config/environment.rb +5 -0
  96. data/config/environments/development.rb +28 -0
  97. data/config/environments/production.rb +49 -0
  98. data/config/environments/test.rb +35 -0
  99. data/config/initializers/backtrace_silencers.rb +7 -0
  100. data/config/initializers/dcmgr_gui.rb +14 -0
  101. data/config/initializers/inflections.rb +10 -0
  102. data/config/initializers/mime_types.rb +5 -0
  103. data/config/initializers/secret_token.rb +7 -0
  104. data/config/initializers/session_store.rb +8 -0
  105. data/config/locales/en.yml +5 -0
  106. data/config/routes.rb +109 -0
  107. data/db/seeds.rb +7 -0
  108. data/extras/authentication.rb +94 -0
  109. data/extras/util.rb +5 -0
  110. data/lib/tasks/dcmgr_gui.rake +51 -0
  111. data/public/404.html +26 -0
  112. data/public/422.html +26 -0
  113. data/public/500.html +26 -0
  114. data/public/favicon.ico +0 -0
  115. data/public/images/app_active.gif +0 -0
  116. data/public/images/app_passive.gif +0 -0
  117. data/public/images/body_bg.gif +0 -0
  118. data/public/images/btn_change.gif +0 -0
  119. data/public/images/btn_create_security_group.gif +0 -0
  120. data/public/images/btn_create_snapshot.gif +0 -0
  121. data/public/images/btn_create_volume.gif +0 -0
  122. data/public/images/btn_createkey.gif +0 -0
  123. data/public/images/btn_de_register.gif +0 -0
  124. data/public/images/btn_delete_security_group.gif +0 -0
  125. data/public/images/btn_delete_snapshot.gif +0 -0
  126. data/public/images/btn_delete_volume.gif +0 -0
  127. data/public/images/btn_deletekey.gif +0 -0
  128. data/public/images/btn_healthdetail.gif +0 -0
  129. data/public/images/btn_hide.gif +0 -0
  130. data/public/images/btn_launch.gif +0 -0
  131. data/public/images/btn_next.gif +0 -0
  132. data/public/images/btn_prev.gif +0 -0
  133. data/public/images/btn_refresh.gif +0 -0
  134. data/public/images/btn_register_new_ami.gif +0 -0
  135. data/public/images/btn_savechange.gif +0 -0
  136. data/public/images/btn_show.gif +0 -0
  137. data/public/images/btn_show_accesskey.png +0 -0
  138. data/public/images/bup_btn_healthdetail.gif +0 -0
  139. data/public/images/bup_btn_refresh.gif +0 -0
  140. data/public/images/clear.gif +0 -0
  141. data/public/images/content_bg.png +0 -0
  142. data/public/images/content_foot_bg.gif +0 -0
  143. data/public/images/content_head_bg.gif +0 -0
  144. data/public/images/footer_bg.gif +0 -0
  145. data/public/images/head_gradation_bg.gif +0 -0
  146. data/public/images/header_logo.gif +0 -0
  147. data/public/images/icon_blockstore.gif +0 -0
  148. data/public/images/icon_caution.gif +0 -0
  149. data/public/images/icon_health.gif +0 -0
  150. data/public/images/icon_images.gif +0 -0
  151. data/public/images/icon_information.gif +0 -0
  152. data/public/images/icon_instances.gif +0 -0
  153. data/public/images/icon_resource.gif +0 -0
  154. data/public/images/icon_resource01.gif +0 -0
  155. data/public/images/icon_resource02.gif +0 -0
  156. data/public/images/icon_resource03.gif +0 -0
  157. data/public/images/icon_resource04.gif +0 -0
  158. data/public/images/icon_rss.gif +0 -0
  159. data/public/images/icon_security.gif +0 -0
  160. data/public/images/icon_service.gif +0 -0
  161. data/public/images/icon_service_stat.gif +0 -0
  162. data/public/images/icon_stop.gif +0 -0
  163. data/public/images/icon_summary.gif +0 -0
  164. data/public/images/icon_ttl_accskey.gif +0 -0
  165. data/public/images/icon_ttl_detail.gif +0 -0
  166. data/public/images/icon_ttl_instance.gif +0 -0
  167. data/public/images/icon_ttl_personal_inf.gif +0 -0
  168. data/public/images/infra_active.gif +0 -0
  169. data/public/images/infra_passive.gif +0 -0
  170. data/public/images/lastelement_bg.gif +0 -0
  171. data/public/images/lastelement_bg.png +0 -0
  172. data/public/images/listicon_useast.gif +0 -0
  173. data/public/images/loader_ball.gif +0 -0
  174. data/public/images/loader_boxes.gif +0 -0
  175. data/public/images/loading.gif +0 -0
  176. data/public/images/mainarea_bottom_bg.gif +0 -0
  177. data/public/images/mainarea_content_bg.gif +0 -0
  178. data/public/images/mainarea_h3_bg.gif +0 -0
  179. data/public/images/mainarea_wide_bottom_bg.gif +0 -0
  180. data/public/images/mainarea_wide_content_bg.gif +0 -0
  181. data/public/images/mainarea_wide_h3_bg.gif +0 -0
  182. data/public/images/menu_list_header.gif +0 -0
  183. data/public/images/menu_list_header_current.gif +0 -0
  184. data/public/images/plat_active.gif +0 -0
  185. data/public/images/plat_passive.gif +0 -0
  186. data/public/images/regionselect_bg.gif +0 -0
  187. data/public/images/select_bg_126.gif +0 -0
  188. data/public/images/select_bg_139.gif +0 -0
  189. data/public/images/sidemenu_bg.gif +0 -0
  190. data/public/images/sidemenu_bottom.gif +0 -0
  191. data/public/images/sidemenu_top.gif +0 -0
  192. data/public/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  193. data/public/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  194. data/public/images/ui-bg_flat_10_000000_40x100.png +0 -0
  195. data/public/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  196. data/public/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  197. data/public/images/ui-bg_glass_55_fcf0ba_1x400.png +0 -0
  198. data/public/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  199. data/public/images/ui-bg_gloss-wave_100_ece8da_500x100.png +0 -0
  200. data/public/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  201. data/public/images/ui-bg_highlight-hard_100_f5f3e5_1x100.png +0 -0
  202. data/public/images/ui-bg_highlight-hard_100_fafaf4_1x100.png +0 -0
  203. data/public/images/ui-bg_highlight-hard_15_459e00_1x100.png +0 -0
  204. data/public/images/ui-bg_highlight-hard_95_cccccc_1x100.png +0 -0
  205. data/public/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  206. data/public/images/ui-bg_highlight-soft_25_67b021_1x100.png +0 -0
  207. data/public/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  208. data/public/images/ui-bg_highlight-soft_95_ffedad_1x100.png +0 -0
  209. data/public/images/ui-bg_inset-soft_15_2b2922_1x100.png +0 -0
  210. data/public/images/ui-icons_222222_256x240.png +0 -0
  211. data/public/images/ui-icons_228ef1_256x240.png +0 -0
  212. data/public/images/ui-icons_808080_256x240.png +0 -0
  213. data/public/images/ui-icons_847e71_256x240.png +0 -0
  214. data/public/images/ui-icons_8dc262_256x240.png +0 -0
  215. data/public/images/ui-icons_cd0a0a_256x240.png +0 -0
  216. data/public/images/ui-icons_eeeeee_256x240.png +0 -0
  217. data/public/images/ui-icons_ef8c08_256x240.png +0 -0
  218. data/public/images/ui-icons_ffd27a_256x240.png +0 -0
  219. data/public/images/ui-icons_ffffff_256x240.png +0 -0
  220. data/public/images/vtip_arrow.png +0 -0
  221. data/public/javascripts/controls.js +965 -0
  222. data/public/javascripts/dcmgr_gui/application.js +91 -0
  223. data/public/javascripts/dcmgr_gui/core.js +539 -0
  224. data/public/javascripts/dcmgr_gui/dashboard_panel.js +34 -0
  225. data/public/javascripts/dcmgr_gui/host_pool_panel.js +83 -0
  226. data/public/javascripts/dcmgr_gui/image_panel.js +242 -0
  227. data/public/javascripts/dcmgr_gui/instance_panel.js +197 -0
  228. data/public/javascripts/dcmgr_gui/security_group_panel.js +196 -0
  229. data/public/javascripts/dcmgr_gui/snapshot_panel.js +168 -0
  230. data/public/javascripts/dcmgr_gui/sshkeypair_panel.js +161 -0
  231. data/public/javascripts/dcmgr_gui/storage_pool_panel.js +99 -0
  232. data/public/javascripts/dcmgr_gui/volume_panel.js +311 -0
  233. data/public/javascripts/dragdrop.js +974 -0
  234. data/public/javascripts/effects.js +1123 -0
  235. data/public/javascripts/jquery-1.4.2.min.js +154 -0
  236. data/public/javascripts/jquery-ui-1.8.4.custom.min.js +763 -0
  237. data/public/javascripts/jquery.loadmask.min.js +10 -0
  238. data/public/javascripts/jquery.tmpl.js +486 -0
  239. data/public/javascripts/jsdeferred.jquery.js +385 -0
  240. data/public/javascripts/prototype.js +6001 -0
  241. data/public/javascripts/rails.js +175 -0
  242. data/public/robots.txt +5 -0
  243. data/public/stylesheets/common.css +1236 -0
  244. data/public/stylesheets/dialog.css +67 -0
  245. data/public/stylesheets/jquery-ui-1.8.4.custom.css +572 -0
  246. data/public/stylesheets/jquery.loadmask.css +40 -0
  247. data/public/stylesheets/reset.css +71 -0
  248. data/public/stylesheets/style.css +7 -0
  249. data/public/stylesheets/vtip.css +28 -0
  250. data/script/rails +6 -0
  251. data/test/functional/accounts_controller_test.rb +8 -0
  252. data/test/functional/dialog_controller_test.rb +8 -0
  253. data/test/functional/home_controller_test.rb +8 -0
  254. data/test/functional/host_pools_controller_test.rb +8 -0
  255. data/test/functional/images_controller_test.rb +8 -0
  256. data/test/functional/information_controller_test.rb +8 -0
  257. data/test/functional/instances_controller_test.rb +8 -0
  258. data/test/functional/keypairs_controller_test.rb +8 -0
  259. data/test/functional/security_groups_controller_test.rb +8 -0
  260. data/test/functional/sessions_controller_test.rb +8 -0
  261. data/test/functional/snapshots_controller_test.rb +8 -0
  262. data/test/functional/storage_pools_controller_test.rb +8 -0
  263. data/test/functional/users_controller_test.rb +8 -0
  264. data/test/functional/volumes_controller_test.rb +8 -0
  265. data/test/performance/browsing_test.rb +9 -0
  266. data/test/test_helper.rb +13 -0
  267. data/test/unit/helpers/accounts_helper_test.rb +4 -0
  268. data/test/unit/helpers/dialog_helper_test.rb +4 -0
  269. data/test/unit/helpers/home_helper_test.rb +4 -0
  270. data/test/unit/helpers/host_pools_helper_test.rb +4 -0
  271. data/test/unit/helpers/images_helper_test.rb +4 -0
  272. data/test/unit/helpers/information_helper_test.rb +4 -0
  273. data/test/unit/helpers/instances_helper_test.rb +4 -0
  274. data/test/unit/helpers/keypairs_helper_test.rb +4 -0
  275. data/test/unit/helpers/security_groups_helper_test.rb +4 -0
  276. data/test/unit/helpers/sessions_helper_test.rb +4 -0
  277. data/test/unit/helpers/snapshots_helper_test.rb +4 -0
  278. data/test/unit/helpers/storage_pools_helper_test.rb +4 -0
  279. data/test/unit/helpers/users_helper_test.rb +4 -0
  280. data/test/unit/helpers/volumes_helper_test.rb +4 -0
  281. metadata +399 -0
data/INSTALL.txt ADDED
@@ -0,0 +1,21 @@
1
+
2
+ #Create database
3
+ mysql -uroot
4
+ > create database wakame_dcmgr_gui default character set utf8;
5
+ > grant all on wakame_dcmgr_gui.* to wakame_dcmgr_gui@localhost identified by 'passwd';
6
+
7
+ #create salt for user.password
8
+ rails console
9
+ >ActiveSupport::SecureRandom.hex(30)
10
+ => "019f403202066d3f19e7a5c0e6c3d142989446aa65c13bb3c30c129695db"
11
+
12
+ #Change config.secret_token in config/initializers/secret_token.rb
13
+ DcmgrGui::Application.config.secret_token = "019f403202066d3f19e7a5c0e6c3d142989446aa65c13bb3c30c129695db"
14
+
15
+ #Edit dcmgi api server
16
+ #config/initializers/dcmgr_gui.rb
17
+ # :site => "http://your.dcmgrguiserver/"
18
+
19
+ #for development
20
+ rake db:init
21
+ rake db:sample_data
data/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/NOTICE ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) 2009-2010 axsh Ltd.
data/README ADDED
@@ -0,0 +1,256 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application framework that includes everything needed to create
4
+ database-backed web applications according to the Model-View-Control pattern.
5
+
6
+ This pattern splits the view (also called the presentation) into "dumb"
7
+ templates that are primarily responsible for inserting pre-built data in between
8
+ HTML tags. The model contains the "smart" domain objects (such as Account,
9
+ Product, Person, Post) that holds all the business logic and knows how to
10
+ persist themselves to a database. The controller handles the incoming requests
11
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
12
+ and directing data to the view.
13
+
14
+ In Rails, the model is handled by what's called an object-relational mapping
15
+ layer entitled Active Record. This layer allows you to present the data from
16
+ database rows as objects and embellish these data objects with business logic
17
+ methods. You can read more about Active Record in
18
+ link:files/vendor/rails/activerecord/README.html.
19
+
20
+ The controller and view are handled by the Action Pack, which handles both
21
+ layers by its two parts: Action View and Action Controller. These two layers
22
+ are bundled in a single package due to their heavy interdependence. This is
23
+ unlike the relationship between the Active Record and Action Pack that is much
24
+ more separate. Each of these packages can be used independently outside of
25
+ Rails. You can read more about Action Pack in
26
+ link:files/vendor/rails/actionpack/README.html.
27
+
28
+
29
+ == Getting Started
30
+
31
+ 1. At the command prompt, create a new Rails application:
32
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
+
34
+ 2. Change directory to <tt>myapp</tt> and start the web server:
35
+ <tt>cd myapp; rails server</tt> (run with --help for options)
36
+
37
+ 3. Go to http://localhost:3000/ and you'll see:
38
+ "Welcome aboard: You're riding Ruby on Rails!"
39
+
40
+ 4. Follow the guidelines to start developing your application. You can find
41
+ the following resources handy:
42
+
43
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
+
46
+
47
+ == Debugging Rails
48
+
49
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
+ will help you debug it and get it back on the rails.
51
+
52
+ First area to check is the application log files. Have "tail -f" commands
53
+ running on the server.log and development.log. Rails will automatically display
54
+ debugging and runtime information to these files. Debugging info will also be
55
+ shown in the browser on requests from 127.0.0.1.
56
+
57
+ You can also log your own messages directly into the log file from your code
58
+ using the Ruby logger class from inside your controllers. Example:
59
+
60
+ class WeblogController < ActionController::Base
61
+ def destroy
62
+ @weblog = Weblog.find(params[:id])
63
+ @weblog.destroy
64
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
+ end
66
+ end
67
+
68
+ The result will be a message in your log file along the lines of:
69
+
70
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
+
72
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
73
+
74
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
+ several books available online as well:
76
+
77
+ * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
+
80
+ These two books will bring you up to speed on the Ruby language and also on
81
+ programming in general.
82
+
83
+
84
+ == Debugger
85
+
86
+ Debugger support is available through the debugger command when you start your
87
+ Mongrel or WEBrick server with --debugger. This means that you can break out of
88
+ execution at any point in the code, investigate and change the model, and then,
89
+ resume execution! You need to install ruby-debug to run the server in debugging
90
+ mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
+
92
+ class WeblogController < ActionController::Base
93
+ def index
94
+ @posts = Post.find(:all)
95
+ debugger
96
+ end
97
+ end
98
+
99
+ So the controller will accept the action, run the first line, then present you
100
+ with a IRB prompt in the server window. Here you can do things like:
101
+
102
+ >> @posts.inspect
103
+ => "[#<Post:0x14a6be8
104
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
+ #<Post:0x14a6620
106
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
+ >> @posts.first.title = "hello from a debugger"
108
+ => "hello from a debugger"
109
+
110
+ ...and even better, you can examine how your runtime objects actually work:
111
+
112
+ >> f = @posts.first
113
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
+ >> f.
115
+ Display all 152 possibilities? (y or n)
116
+
117
+ Finally, when you're ready to resume execution, you can enter "cont".
118
+
119
+
120
+ == Console
121
+
122
+ The console is a Ruby shell, which allows you to interact with your
123
+ application's domain model. Here you'll have all parts of the application
124
+ configured, just like it is when the application is running. You can inspect
125
+ domain models, change values, and save to the database. Starting the script
126
+ without arguments will launch it in the development environment.
127
+
128
+ To start the console, run <tt>rails console</tt> from the application
129
+ directory.
130
+
131
+ Options:
132
+
133
+ * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
+ made to the database.
135
+ * Passing an environment name as an argument will load the corresponding
136
+ environment. Example: <tt>rails console production</tt>.
137
+
138
+ To reload your controllers and models after launching the console run
139
+ <tt>reload!</tt>
140
+
141
+ More information about irb can be found at:
142
+ link:http://www.rubycentral.com/pickaxe/irb.html
143
+
144
+
145
+ == dbconsole
146
+
147
+ You can go to the command line of your database directly through <tt>rails
148
+ dbconsole</tt>. You would be connected to the database with the credentials
149
+ defined in database.yml. Starting the script without arguments will connect you
150
+ to the development database. Passing an argument will connect you to a different
151
+ database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
+ PostgreSQL and SQLite 3.
153
+
154
+ == Description of Contents
155
+
156
+ The default directory structure of a generated Ruby on Rails application:
157
+
158
+ |-- app
159
+ | |-- controllers
160
+ | |-- helpers
161
+ | |-- models
162
+ | `-- views
163
+ | `-- layouts
164
+ |-- config
165
+ | |-- environments
166
+ | |-- initializers
167
+ | `-- locales
168
+ |-- db
169
+ |-- doc
170
+ |-- lib
171
+ | `-- tasks
172
+ |-- log
173
+ |-- public
174
+ | |-- images
175
+ | |-- javascripts
176
+ | `-- stylesheets
177
+ |-- script
178
+ | `-- performance
179
+ |-- test
180
+ | |-- fixtures
181
+ | |-- functional
182
+ | |-- integration
183
+ | |-- performance
184
+ | `-- unit
185
+ |-- tmp
186
+ | |-- cache
187
+ | |-- pids
188
+ | |-- sessions
189
+ | `-- sockets
190
+ `-- vendor
191
+ `-- plugins
192
+
193
+ app
194
+ Holds all the code that's specific to this particular application.
195
+
196
+ app/controllers
197
+ Holds controllers that should be named like weblogs_controller.rb for
198
+ automated URL mapping. All controllers should descend from
199
+ ApplicationController which itself descends from ActionController::Base.
200
+
201
+ app/models
202
+ Holds models that should be named like post.rb. Models descend from
203
+ ActiveRecord::Base by default.
204
+
205
+ app/views
206
+ Holds the template files for the view that should be named like
207
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
208
+ eRuby syntax by default.
209
+
210
+ app/views/layouts
211
+ Holds the template files for layouts to be used with views. This models the
212
+ common header/footer method of wrapping views. In your views, define a layout
213
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
214
+ Inside default.html.erb, call <% yield %> to render the view using this
215
+ layout.
216
+
217
+ app/helpers
218
+ Holds view helpers that should be named like weblogs_helper.rb. These are
219
+ generated for you automatically when using generators for controllers.
220
+ Helpers can be used to wrap functionality for your views into methods.
221
+
222
+ config
223
+ Configuration files for the Rails environment, the routing map, the database,
224
+ and other dependencies.
225
+
226
+ db
227
+ Contains the database schema in schema.rb. db/migrate contains all the
228
+ sequence of Migrations for your schema.
229
+
230
+ doc
231
+ This directory is where your application documentation will be stored when
232
+ generated using <tt>rake doc:app</tt>
233
+
234
+ lib
235
+ Application specific libraries. Basically, any kind of custom code that
236
+ doesn't belong under controllers, models, or helpers. This directory is in
237
+ the load path.
238
+
239
+ public
240
+ The directory available for the web server. Contains subdirectories for
241
+ images, stylesheets, and javascripts. Also contains the dispatchers and the
242
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
243
+ server.
244
+
245
+ script
246
+ Helper scripts for automation and generation.
247
+
248
+ test
249
+ Unit and functional tests along with fixtures. When using the rails generate
250
+ command, template test files will be generated for you and placed in this
251
+ directory.
252
+
253
+ vendor
254
+ External libraries that the application depends on. Also includes the plugins
255
+ subdirectory. If the app has frozen rails, those gems also go here, under
256
+ vendor/rails/. This directory is in the load path.