fanforce-plugin-factory 0.41.0 → 1.6.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. data/.gitignore +1 -0
  2. data/.ruby-version +1 -0
  3. data/.yardopts +5 -0
  4. data/.yardopts.rb +1 -0
  5. data/Gemfile +9 -0
  6. data/README.md +40 -75
  7. data/Rakefile +61 -4
  8. data/fanforce-plugin-factory.gemspec +21 -21
  9. data/lib/fanforce/plugin_factory.rb +16 -58
  10. data/lib/fanforce/plugin_factory/Rakefile +51 -0
  11. data/lib/fanforce/plugin_factory/Routes.rb +33 -0
  12. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/_bootstrap.scss +2 -0
  13. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/_common.scss +1 -0
  14. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/_directives.scss +7 -0
  15. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/_font-awesome.scss +1 -0
  16. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/_ui-select.scss +3 -0
  17. data/lib/fanforce/plugin_factory/{assets/lib/common → asset_framework/plugin_factory/bootstrap}/_bootstrap-overrides.scss +2 -0
  18. data/lib/fanforce/plugin_factory/{assets/lib/vendors/bootstrap/css → asset_framework/plugin_factory/bootstrap}/bootstrap.css +2 -2
  19. data/lib/fanforce/plugin_factory/{assets/lib/vendors/bootstrap/js → asset_framework/plugin_factory/bootstrap}/bootstrap.js +0 -0
  20. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/bootstrap/bootstrap.min.css +7 -0
  21. data/lib/fanforce/plugin_factory/{assets/lib/vendors/bootstrap/js → asset_framework/plugin_factory/bootstrap}/bootstrap.min.js +0 -0
  22. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/bootstrap/glyphicons-halflings-regular.eot +0 -0
  23. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/bootstrap/glyphicons-halflings-regular.svg +229 -0
  24. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  25. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/bootstrap/glyphicons-halflings-regular.woff +0 -0
  26. data/lib/fanforce/plugin_factory/{assets/lib → asset_framework/plugin_factory}/common/_mixins.scss +2 -1
  27. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/directives.coffee +1 -0
  28. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/directives/error/_error.scss +6 -0
  29. data/lib/fanforce/plugin_factory/{assets/lib/common/module-error → asset_framework/plugin_factory/directives/error}/arrow-left.png +0 -0
  30. data/lib/fanforce/plugin_factory/{assets/lib/common/module-error → asset_framework/plugin_factory/directives/error}/icon-error.png +0 -0
  31. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/directives/initiative-footer/_initiative-footer.coffee +16 -0
  32. data/lib/fanforce/plugin_factory/{assets/lib/common/_module-add-initiative-footer.scss → asset_framework/plugin_factory/directives/initiative-footer/_initiative-footer.scss} +4 -1
  33. data/lib/fanforce/plugin_factory/{assets/lib/common/_module-initiative-searcher.scss → asset_framework/plugin_factory/directives/initiative-searcher/_initiative-searcher.scss} +14 -13
  34. data/lib/fanforce/plugin_factory/{assets/lib/common/module-initiative-searcher → asset_framework/plugin_factory/directives/initiative-searcher}/icon-search.png +0 -0
  35. data/lib/fanforce/plugin_factory/{assets/lib/common/module-initiative-searcher → asset_framework/plugin_factory/directives/initiative-searcher}/spinner.gif +0 -0
  36. data/lib/fanforce/plugin_factory/{assets/lib/common/module-initiative-searcher → asset_framework/plugin_factory/directives/initiative-searcher}/sprite-arrows.png +0 -0
  37. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/directives/loading/_loading.coffee +4 -0
  38. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/directives/loading/_loading.scss +4 -0
  39. data/lib/fanforce/plugin_factory/{assets/js/add_source_popup.js → asset_framework/plugin_factory/directives/saving-to-server/_saving-to-server.coffee} +0 -0
  40. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/directives/saving-to-server/_saving-to-server.scss +6 -0
  41. data/lib/fanforce/plugin_factory/{assets/lib/common/module-saving-initiative → asset_framework/plugin_factory/directives/saving-to-server}/spinner.gif +0 -0
  42. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/directives/start-arrow/_start-arrow.coffee +8 -0
  43. data/lib/fanforce/plugin_factory/{assets/lib/common/_module-start-here.scss → asset_framework/plugin_factory/directives/start-arrow/_start-arrow.scss} +5 -4
  44. data/lib/fanforce/plugin_factory/{assets/lib/common/module-start-here → asset_framework/plugin_factory/directives/start-arrow}/arrow.png +0 -0
  45. data/lib/fanforce/plugin_factory/{assets/lib/common/_module-video-thumbnail.scss → asset_framework/plugin_factory/directives/video-thumbnail/_video-thumbnail.scss} +4 -4
  46. data/lib/fanforce/plugin_factory/{assets/lib/common/module-video-thumbnail → asset_framework/plugin_factory/directives/video-thumbnail}/icon-play.png +0 -0
  47. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/font-awesome.coffee +1 -0
  48. data/lib/fanforce/plugin_factory/{assets/lib/vendors/font-awesome/font → asset_framework/plugin_factory/font-awesome}/FontAwesome.otf +0 -0
  49. data/lib/fanforce/plugin_factory/{assets/lib/vendors/font-awesome/css → asset_framework/plugin_factory/font-awesome}/font-awesome.css +2 -2
  50. data/lib/fanforce/plugin_factory/{assets/lib/vendors/font-awesome/css → asset_framework/plugin_factory/font-awesome}/font-awesome.min.css +0 -0
  51. data/lib/fanforce/plugin_factory/{assets/lib/vendors/font-awesome/font → asset_framework/plugin_factory/font-awesome}/fontawesome-webfont.eot +0 -0
  52. data/lib/fanforce/plugin_factory/{assets/lib/vendors/font-awesome/font → asset_framework/plugin_factory/font-awesome}/fontawesome-webfont.svg +0 -0
  53. data/lib/fanforce/plugin_factory/{assets/lib/vendors/font-awesome/font → asset_framework/plugin_factory/font-awesome}/fontawesome-webfont.ttf +0 -0
  54. data/lib/fanforce/plugin_factory/{assets/lib/vendors/font-awesome/font → asset_framework/plugin_factory/font-awesome}/fontawesome-webfont.woff +0 -0
  55. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/lib.coffee +1 -0
  56. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/lib/ng-focus-blur.js +68 -0
  57. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/lib/ng-visible.js +7 -0
  58. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/ui-select.coffee +1 -0
  59. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/ui-select/select.css +171 -0
  60. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/ui-select/select.js +1281 -0
  61. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/ui-select/select_override.scss +1 -0
  62. data/lib/fanforce/plugin_factory/asset_framework/plugin_factory/ui-select/selectize.default.css +443 -0
  63. data/lib/fanforce/plugin_factory/cli.rb +5 -0
  64. data/lib/fanforce/plugin_factory/cli/lib/bitbucket.rb +77 -0
  65. data/lib/fanforce/plugin_factory/cli/lib/bundler.rb +21 -0
  66. data/lib/fanforce/plugin_factory/cli/lib/env.rb +96 -0
  67. data/lib/fanforce/plugin_factory/cli/lib/git.rb +59 -0
  68. data/lib/fanforce/plugin_factory/cli/lib/heroku.rb +94 -0
  69. data/lib/fanforce/plugin_factory/cli/lib/iron.rb +71 -0
  70. data/lib/fanforce/plugin_factory/cli/lib/pow.rb +46 -0
  71. data/lib/fanforce/plugin_factory/cli/lib/scaffolding.rb +74 -0
  72. data/lib/fanforce/plugin_factory/cli/lib/scaffolding_file.rb +510 -0
  73. data/lib/fanforce/plugin_factory/cli/lib/uranium.rb +77 -0
  74. data/lib/fanforce/plugin_factory/cli/lib/utils.rb +57 -0
  75. data/lib/fanforce/plugin_factory/cli/scripts/config.rb +9 -0
  76. data/lib/fanforce/plugin_factory/cli/scripts/create.rb +64 -0
  77. data/lib/fanforce/plugin_factory/cli/scripts/destroy.rb +61 -0
  78. data/lib/fanforce/plugin_factory/cli/scripts/diff.rb +156 -0
  79. data/lib/fanforce/plugin_factory/cli/scripts/push.rb +88 -0
  80. data/lib/fanforce/plugin_factory/cli/scripts/restart.rb +41 -0
  81. data/lib/fanforce/plugin_factory/cli/scripts/setup.rb +70 -0
  82. data/lib/fanforce/plugin_factory/cli/scripts/update.rb +132 -0
  83. data/lib/fanforce/plugin_factory/cli_directory_of_plugins.rb +51 -0
  84. data/lib/fanforce/plugin_factory/cli_single_plugin.rb +52 -0
  85. data/lib/fanforce/plugin_factory/controllers/base_controller.rb +15 -0
  86. data/lib/fanforce/plugin_factory/core_config.rb +94 -0
  87. data/lib/fanforce/plugin_factory/directive_views/initiative-footer.haml +8 -0
  88. data/lib/fanforce/plugin_factory/load.rb +7 -0
  89. data/lib/fanforce/plugin_factory/load_iron_worker.rb +2 -0
  90. data/lib/fanforce/plugin_factory/load_sprockets.rb +2 -0
  91. data/lib/fanforce/plugin_factory/plugin.rb +60 -0
  92. data/lib/fanforce/plugin_factory/scaffolding/._.gitignore.registry +1 -0
  93. data/lib/fanforce/plugin_factory/scaffolding/._Gemfile.registry +3 -0
  94. data/lib/fanforce/plugin_factory/scaffolding/._Rakefile.registry +3 -0
  95. data/lib/fanforce/plugin_factory/scaffolding/._config.json.registry +2 -0
  96. data/lib/fanforce/plugin_factory/scaffolding/._config.ru.registry +4 -0
  97. data/lib/fanforce/plugin_factory/scaffolding/._favicon.ico.registry +1 -0
  98. data/lib/fanforce/plugin_factory/scaffolding/._robots.txt.registry +3 -0
  99. data/lib/fanforce/plugin_factory/scaffolding/.gitignore +27 -0
  100. data/lib/fanforce/plugin_factory/scaffolding/Gemfile +9 -0
  101. data/lib/fanforce/plugin_factory/scaffolding/Rakefile +7 -0
  102. data/lib/fanforce/plugin_factory/scaffolding/Routes.rb +67 -0
  103. data/lib/fanforce/plugin_factory/scaffolding/assets/css/._fembedded.scss.registry +4 -0
  104. data/lib/fanforce/plugin_factory/scaffolding/assets/css/._promotional.scss.registry +4 -0
  105. data/lib/fanforce/plugin_factory/scaffolding/assets/css/._visitor.scss.registry +4 -0
  106. data/lib/fanforce/plugin_factory/scaffolding/assets/css/fembedded.scss +24 -0
  107. data/lib/fanforce/plugin_factory/scaffolding/assets/css/promotional.scss +33 -0
  108. data/lib/fanforce/plugin_factory/scaffolding/assets/css/visitor.scss +61 -0
  109. data/lib/fanforce/plugin_factory/scaffolding/assets/img/._icon-16.png.registry +1 -0
  110. data/lib/fanforce/plugin_factory/scaffolding/assets/img/._icon-32.png.registry +1 -0
  111. data/lib/fanforce/plugin_factory/scaffolding/assets/img/._icon-42.png.registry +1 -0
  112. data/lib/fanforce/plugin_factory/scaffolding/assets/img/._marketplace.png.registry +1 -0
  113. data/lib/fanforce/plugin_factory/{assets → scaffolding/assets}/img/icon-16.png +0 -0
  114. data/lib/fanforce/plugin_factory/{assets → scaffolding/assets}/img/icon-32.png +0 -0
  115. data/lib/fanforce/plugin_factory/{assets → scaffolding/assets}/img/icon-42.png +0 -0
  116. data/lib/fanforce/plugin_factory/scaffolding/assets/img/marketplace.png +0 -0
  117. data/lib/fanforce/plugin_factory/scaffolding/assets/img/promotional/._fanforce_bg.png.registry +1 -0
  118. data/lib/fanforce/plugin_factory/scaffolding/assets/img/promotional/._icon-42.png.registry +1 -0
  119. data/lib/fanforce/plugin_factory/scaffolding/assets/img/promotional/._icon-plus.png.registry +1 -0
  120. data/lib/fanforce/plugin_factory/{assets/lib → scaffolding/assets/img}/promotional/fanforce_bg.png +0 -0
  121. data/lib/fanforce/plugin_factory/{assets/lib → scaffolding/assets/img}/promotional/icon-42.png +0 -0
  122. data/lib/fanforce/plugin_factory/scaffolding/assets/img/promotional/icon-plus.png +0 -0
  123. data/lib/fanforce/plugin_factory/scaffolding/assets/js/._fembedded-app.coffee.registry +5 -0
  124. data/lib/fanforce/plugin_factory/scaffolding/assets/js/._fembedded.js.registry +3 -0
  125. data/lib/fanforce/plugin_factory/scaffolding/assets/js/._promotional.js.registry +3 -0
  126. data/lib/fanforce/plugin_factory/scaffolding/assets/js/fembedded-app.coffee +11 -0
  127. data/lib/fanforce/plugin_factory/scaffolding/assets/js/fembedded.js +12 -0
  128. data/lib/fanforce/plugin_factory/scaffolding/assets/js/lib/._cookie.coffee.registry +3 -0
  129. data/lib/fanforce/plugin_factory/scaffolding/assets/js/lib/._filters.coffee.registry +3 -0
  130. data/lib/fanforce/plugin_factory/scaffolding/assets/js/lib/._utils.coffee.registry +3 -0
  131. data/lib/fanforce/plugin_factory/scaffolding/assets/js/lib/cookie.coffee +24 -0
  132. data/lib/fanforce/plugin_factory/scaffolding/assets/js/lib/filters.coffee +9 -0
  133. data/lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee +40 -0
  134. data/lib/fanforce/plugin_factory/scaffolding/assets/js/promotional.js +4 -0
  135. data/lib/fanforce/plugin_factory/scaffolding/config.json +24 -0
  136. data/lib/fanforce/plugin_factory/scaffolding/config.ru +8 -0
  137. data/lib/fanforce/plugin_factory/{public → scaffolding}/favicon.ico +0 -0
  138. data/lib/fanforce/plugin_factory/scaffolding/layouts/._fembedded.haml.registry +4 -0
  139. data/lib/fanforce/plugin_factory/scaffolding/layouts/._promotional.haml.registry +2 -0
  140. data/lib/fanforce/plugin_factory/scaffolding/layouts/._visitor.haml.registry +6 -0
  141. data/lib/fanforce/plugin_factory/scaffolding/layouts/fembedded.haml +26 -0
  142. data/lib/fanforce/plugin_factory/{layouts → scaffolding/layouts}/promotional.haml +6 -6
  143. data/lib/fanforce/plugin_factory/{layouts/engage.haml → scaffolding/layouts/visitor.haml} +10 -7
  144. data/lib/fanforce/plugin_factory/scaffolding/robots.txt +7 -0
  145. data/lib/fanforce/plugin_factory/scaffolding/views/._index.haml.registry +3 -0
  146. data/lib/fanforce/plugin_factory/{views → scaffolding/views}/index.haml +13 -7
  147. data/lib/fanforce/plugin_factory/sinatra/_load.rb +87 -0
  148. data/lib/fanforce/plugin_factory/sinatra/error_handling.rb +48 -0
  149. data/lib/fanforce/plugin_factory/sinatra/helper_routes/com_behavior.rb +19 -0
  150. data/lib/fanforce/plugin_factory/sinatra/helper_routes/com_broadcaster.rb +7 -0
  151. data/lib/fanforce/plugin_factory/sinatra/helper_routes/com_connector.rb +11 -0
  152. data/lib/fanforce/plugin_factory/sinatra/helper_routes/com_identifier.rb +3 -0
  153. data/lib/fanforce/plugin_factory/sinatra/helper_routes/com_js_widget.rb +8 -0
  154. data/lib/fanforce/plugin_factory/sinatra/helper_routes/plugin.rb +50 -0
  155. data/lib/fanforce/plugin_factory/sinatra/helpers/assets.rb +23 -0
  156. data/lib/fanforce/plugin_factory/sinatra/helpers/css_frameworks.rb +70 -0
  157. data/lib/fanforce/plugin_factory/sinatra/helpers/fanforce.rb +18 -0
  158. data/lib/fanforce/plugin_factory/{config → sinatra}/helpers/json.rb +2 -2
  159. data/lib/fanforce/plugin_factory/sinatra/helpers/ractive.rb +45 -0
  160. data/lib/fanforce/plugin_factory/sprockets/compiler.rb +5 -11
  161. data/lib/fanforce/plugin_factory/sprockets/hacks.rb +2 -2
  162. data/lib/fanforce/plugin_factory/version.rb +2 -2
  163. metadata +201 -195
  164. data/.rbenv-gemsets +0 -1
  165. data/.rbenv-version +0 -1
  166. data/lib/fanforce/plugin_factory.rake +0 -72
  167. data/lib/fanforce/plugin_factory/_init_sinatra.rb +0 -54
  168. data/lib/fanforce/plugin_factory/assets/css/add_edit_initiative.scss +0 -1
  169. data/lib/fanforce/plugin_factory/assets/css/add_source.scss +0 -1
  170. data/lib/fanforce/plugin_factory/assets/css/convert_pending_initiative.scss +0 -1
  171. data/lib/fanforce/plugin_factory/assets/css/engage.scss +0 -1
  172. data/lib/fanforce/plugin_factory/assets/css/new_message.scss +0 -1
  173. data/lib/fanforce/plugin_factory/assets/css/promotional.scss +0 -1
  174. data/lib/fanforce/plugin_factory/assets/css/source_details.scss +0 -1
  175. data/lib/fanforce/plugin_factory/assets/js/add_edit_initiative.js +0 -1
  176. data/lib/fanforce/plugin_factory/assets/js/add_source.js +0 -1
  177. data/lib/fanforce/plugin_factory/assets/js/convert_pending_initiative.js +0 -1
  178. data/lib/fanforce/plugin_factory/assets/js/engage.js +0 -1
  179. data/lib/fanforce/plugin_factory/assets/js/new_message.js +0 -1
  180. data/lib/fanforce/plugin_factory/assets/js/promotional.js +0 -2
  181. data/lib/fanforce/plugin_factory/assets/js/source_details.js +0 -0
  182. data/lib/fanforce/plugin_factory/assets/lib/common/_module-error.scss +0 -11
  183. data/lib/fanforce/plugin_factory/assets/lib/common/_module-page-loading.scss +0 -1
  184. data/lib/fanforce/plugin_factory/assets/lib/common/_module-saving-initiative.scss +0 -6
  185. data/lib/fanforce/plugin_factory/assets/lib/common/_tags.scss +0 -1
  186. data/lib/fanforce/plugin_factory/assets/lib/common/_variables.scss +0 -27
  187. data/lib/fanforce/plugin_factory/assets/lib/common/broadcaster-divider-arrow.png +0 -0
  188. data/lib/fanforce/plugin_factory/assets/lib/common/icons/dropdown-arrow.png +0 -0
  189. data/lib/fanforce/plugin_factory/assets/lib/common/icons/initiative.png +0 -0
  190. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/_add_edit_initiative.scss +0 -27
  191. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/_add_source.scss +0 -18
  192. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/_convert_pending_initiative.scss +0 -27
  193. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/_engage.scss +0 -78
  194. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/_new_message.scss +0 -24
  195. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/_promotional.scss +0 -27
  196. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/_source_details.scss +0 -17
  197. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/add_edit_initiative.js +0 -6
  198. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/add_source.js +0 -6
  199. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/convert_pending_initiative.js +0 -6
  200. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/engage.js +0 -0
  201. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/new_message.js +0 -5
  202. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/promotional.js +0 -1
  203. data/lib/fanforce/plugin_factory/assets/lib/common/layouts/source_details.js +0 -5
  204. data/lib/fanforce/plugin_factory/assets/lib/promotional/icon-behavior.png +0 -0
  205. data/lib/fanforce/plugin_factory/assets/lib/promotional/icon-broadcaster.png +0 -0
  206. data/lib/fanforce/plugin_factory/assets/lib/promotional/icon-data-connector.png +0 -0
  207. data/lib/fanforce/plugin_factory/assets/lib/promotional/icon-data-processor.png +0 -0
  208. data/lib/fanforce/plugin_factory/assets/lib/promotional/icon-identifier.png +0 -0
  209. data/lib/fanforce/plugin_factory/assets/lib/vendors/bootstrap-datepicker/datepicker.css +0 -7
  210. data/lib/fanforce/plugin_factory/assets/lib/vendors/bootstrap-datepicker/datepicker.js +0 -454
  211. data/lib/fanforce/plugin_factory/assets/lib/vendors/bootstrap-timepicker/timepicker.css +0 -82
  212. data/lib/fanforce/plugin_factory/assets/lib/vendors/bootstrap-timepicker/timepicker.js +0 -803
  213. data/lib/fanforce/plugin_factory/assets/lib/vendors/bootstrap/css/bootstrap.min.css +0 -7
  214. data/lib/fanforce/plugin_factory/assets/lib/vendors/bootstrap/img/glyphicons-halflings-regular.eot +0 -0
  215. data/lib/fanforce/plugin_factory/assets/lib/vendors/bootstrap/img/glyphicons-halflings-regular.svg +0 -0
  216. data/lib/fanforce/plugin_factory/assets/lib/vendors/bootstrap/img/glyphicons-halflings-regular.ttf +0 -0
  217. data/lib/fanforce/plugin_factory/assets/lib/vendors/bootstrap/img/glyphicons-halflings-regular.woff +0 -0
  218. data/lib/fanforce/plugin_factory/assets/lib/vendors/chosen/_chosen_override.scss +0 -6
  219. data/lib/fanforce/plugin_factory/assets/lib/vendors/chosen/chosen-sprite.png +0 -0
  220. data/lib/fanforce/plugin_factory/assets/lib/vendors/chosen/chosen-sprite@2x.png +0 -0
  221. data/lib/fanforce/plugin_factory/assets/lib/vendors/chosen/chosen.jquery.js +0 -1166
  222. data/lib/fanforce/plugin_factory/assets/lib/vendors/chosen/chosen.scss +0 -434
  223. data/lib/fanforce/plugin_factory/assets/lib/vendors/jquery/jquery-1.10.2.js +0 -9789
  224. data/lib/fanforce/plugin_factory/assets/lib/vendors/jquery/jquery.inputHint.js +0 -154
  225. data/lib/fanforce/plugin_factory/assets/lib/vendors/jquery/jquery.tmpl.debug.js +0 -484
  226. data/lib/fanforce/plugin_factory/assets/lib/vendors/knockout/knockout.custom-handlers.coffee +0 -155
  227. data/lib/fanforce/plugin_factory/assets/lib/vendors/knockout/knockout.debug.js +0 -4469
  228. data/lib/fanforce/plugin_factory/assets/lib/vendors/knockout/knockout.min.js +0 -96
  229. data/lib/fanforce/plugin_factory/assets/lib/vendors/select2/_select2_override.scss +0 -47
  230. data/lib/fanforce/plugin_factory/assets/lib/vendors/select2/select2-spinner.gif +0 -0
  231. data/lib/fanforce/plugin_factory/assets/lib/vendors/select2/select2.png +0 -0
  232. data/lib/fanforce/plugin_factory/assets/lib/vendors/select2/select2.scss +0 -617
  233. data/lib/fanforce/plugin_factory/assets/lib/vendors/select2/select2_modified.js +0 -3225
  234. data/lib/fanforce/plugin_factory/assets/lib/vendors/select2/select2x2.png +0 -0
  235. data/lib/fanforce/plugin_factory/assets/lib/vendors/underscore/underscore.debug.js +0 -999
  236. data/lib/fanforce/plugin_factory/config/_error_handling.rb +0 -27
  237. data/lib/fanforce/plugin_factory/config/core_config.rb +0 -92
  238. data/lib/fanforce/plugin_factory/config/helpers/assets.rb +0 -72
  239. data/lib/fanforce/plugin_factory/config/helpers/fanforce.rb +0 -19
  240. data/lib/fanforce/plugin_factory/layouts/add_edit_initiative.haml +0 -19
  241. data/lib/fanforce/plugin_factory/layouts/add_source.haml +0 -19
  242. data/lib/fanforce/plugin_factory/layouts/convert_pending_initiative.haml +0 -19
  243. data/lib/fanforce/plugin_factory/layouts/new_message.haml +0 -19
  244. data/lib/fanforce/plugin_factory/layouts/source_details.haml +0 -19
  245. data/lib/fanforce/plugin_factory/public/robots.txt +0 -2
  246. data/lib/fanforce/plugin_factory/routes.rb +0 -48
  247. data/lib/fanforce/plugin_factory/routes_behavior.rb +0 -34
  248. data/lib/fanforce/plugin_factory/routes_broadcaster.rb +0 -9
  249. data/lib/fanforce/plugin_factory/routes_data_connector.rb +0 -21
  250. data/lib/fanforce/plugin_factory/routes_identifier.rb +0 -3
  251. data/lib/fanforce/plugin_factory/views/add_initiative.haml +0 -1
  252. data/lib/fanforce/plugin_factory/views/add_source.haml +0 -1
  253. data/lib/fanforce/plugin_factory/views/close_popup.haml +0 -8
  254. data/lib/fanforce/plugin_factory/views/convert_pending_initiative.haml +0 -1
  255. data/lib/fanforce/plugin_factory/views/edit_initiative.haml +0 -1
  256. data/lib/fanforce/plugin_factory/views/engage.haml +0 -1
  257. data/lib/fanforce/plugin_factory/views/new_message.haml +0 -1
  258. data/lib/fanforce/plugin_factory/views/source_details.haml +0 -1
  259. data/lib/fanforce/plugin_factory/views/widget_tmpls.haml +0 -1
  260. data/lib/fanforce/plugin_factory_workers.rb +0 -2
data/.gitignore CHANGED
@@ -14,6 +14,7 @@ tmp
14
14
  .idea/
15
15
  .DS_STORE
16
16
  Gemfile.lock
17
+ !._*.registry
17
18
 
18
19
  # YARD artifacts
19
20
  .yardoc
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p194
data/.yardopts ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ --load ./.yardopts.rb
3
+ --markup-provider=redcarpet
4
+ --markup=markdown
5
+ --readme README.md
data/.yardopts.rb ADDED
@@ -0,0 +1 @@
1
+ require 'redcarpet/compat'
data/Gemfile CHANGED
@@ -1,2 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
+
4
+ group :development, :test do
5
+ gem 'minitest'
6
+ gem 'rack-test'
7
+ gem 'simplecov', :require => false
8
+ gem 'yard'
9
+ gem 'redcarpet'
10
+ gem 'github-markup', :require => true
11
+ end
data/README.md CHANGED
@@ -17,19 +17,16 @@ ruby '1.9.3'
17
17
 
18
18
  gem 'fanforce-plugin-factory'
19
19
  ```
20
- One you've created the Gemfile you'll need to run bundler install.
20
+ One you've created the Gemfile you'll need to run bundle install.
21
21
 
22
22
  ### /config.ru
23
- Only seven lines are required (in addition to having a Redis server).
23
+ Only four lines are required (you must have a Redis server).
24
24
 
25
25
  ```ruby
26
26
  require 'bundler'; Bundler.setup
27
- require 'fanforce/plugin'
28
- FanforcePlugin.config do |config|
29
- config._id = 'watch-youtube'
30
- config.type = :behavior # :data_connector, :data_processor, :broadcaster, :identifier, :behavior
31
- end
32
- run FanforcePlugin
27
+ require 'fanforce/plugin_factory'
28
+ Fanforce::Plugin.config { |config| config._id = 'facebook' }
29
+ run Fanforce::Plugin
33
30
  ```
34
31
  You can replace config._id (as in the example above) with an environment variable: ENV['FANFORCE_PLUGIN_ID']
35
32
 
@@ -38,23 +35,19 @@ Your plugin can now be added to the Fanforce Marketplace. Use the follow config
38
35
 
39
36
  ```ruby
40
37
  "public_urls": {
38
+ "marketplace_img": "http://${PRIMARY_DOMAIN}/assets/marketplace.png",
41
39
  "icon_16": "http://${PRIMARY_DOMAIN}/assets/icon-16.png",
42
- "icon_32": "http://${PRIMARY_DOMAIN}/assets/icon-32.png",
40
+ "icon_32": "http://${PRIMARY_DOMAIN}/assets/icon-32.png"
43
41
  "icon_42": "http://${PRIMARY_DOMAIN}/assets/icon-42.png"
44
42
  },
45
43
  "staffer_ui_urls": {
46
- "add_initiative": "http://${PRIMARY_DOMAIN}/add_initiative.html",
47
- "edit_initiative": "http://${PRIMARY_DOMAIN}/edit_initiative.html"
44
+ "dashboard": "http://${PRIMARY_DOMAIN}/dashboard.html"
48
45
  },
49
46
  "callback_urls": {
50
47
  "install": "http://${PRIMARY_DOMAIN}/install",
51
48
  "uninstall": "http://${PRIMARY_DOMAIN}/uninstall"
52
49
  },
53
- "widget_dependencies": [
54
- {
55
- "widget-name-here": "http://${PRIMARY_DOMAIN}/widget_tmpls"
56
- }
57
- ]
50
+ "plugin_dependencies": []
58
51
  ```
59
52
  Note: for development and testing we recommend using the [POW server](http://pow.cx/), but you can use rackup or any other server to run your new plugin.
60
53
 
@@ -67,44 +60,29 @@ There are lots of ways you can start building out and customizing your plugin...
67
60
  Use the assets folder to store all your images, css, and javascript files. There are six asset files that are required. If any are missing, the fanforce-plugin-factory sends default versions when requested.
68
61
 
69
62
  *Default Assets:*
70
- * /css
71
- * /add_edit_initiative.css - this is loaded from the add_edit_initiative.haml layout.
72
- * /add_source.css - this is loaded from the add_source.haml layout.
73
- * /engage.css - this is loaded from the engage.haml layout.
74
- * /new_message.css - this is loaded from the new_message.haml layout.
75
- * /source_details.css - this is loaded from the source_details.haml layout.
76
63
  * /js
77
- * /add_edit_initiative.js - this is loaded from the add_edit_initiative.haml layout.
78
- * /add_source.js - this is loaded from the add_source.haml layout.
79
- * /add_source_popup.js - this is loaded from the add_source_popup.haml layout.
80
- * /engage.js - this is loaded from the engage.haml layout.
81
- * /new_message.js - this is loaded from the new_message.haml layout.
82
- * /source_details.js - this is loaded from the source_details.haml layout.
64
+ * /dashboard.js - this is included in the dashboard.html file.
65
+ * /css
66
+ * /dashboard.css - this is also included in the dashboard.html file.
83
67
  * /img
84
68
  * /icon-16.png - this icon must be 16px by 16px.
85
69
  * /icon-32.png - this icon must be 32px by 32px.
86
70
  * /icon-42.png - this icon must be 42px by 42px.
71
+ * /marketplace.png - this icon must be 220px by 142px.
87
72
 
88
73
  ### /views
89
- HAML is the default layout engine. The .haml extension is converted to .html when served in the browser.
74
+ HAML is setup by default. The extension is changed to .html when served in the browser.
90
75
 
91
- *Default Views for Behavior Plugins:*
92
- * /add_initiative.haml - used in the Command Center.
93
- * /edit_initiative.haml - used in the Command Center.
94
- * /engage.haml - used in the Command Center.
95
-
96
- *Default Views for Broadcaster Plugins:*
97
- * /new_message.haml - used in the Command Center.
76
+ *Default Views:*
77
+ * /index.haml - default page visitors will see if they try to access domain
78
+ * /dashboard.haml - used in the Command Center
98
79
 
99
80
  ### /layouts
100
81
  You can turn off layouts from be used (see Advanced Configuration)
101
82
 
102
- *Default Layouts for Behavior Plugins:*
103
- * /add_edit_initiative.haml - the wrapper layout for views/add_initiative.haml and views/edit_initiative.haml
104
- * /engage.haml - the wrapper layout for views/engage.haml
105
-
106
- *Default Layouts for Broadcaster Plugins:*
107
- * /new_message.haml - the wrapper layout for views/new_message.haml
83
+ *Default Layouts:*
84
+ * /dashboard.haml - the wrapper layout for views/dashboard.haml
85
+ * /promotional.haml - the wrapper layout for views/index.haml
108
86
 
109
87
  ### /public
110
88
  Anything you put in here will be publicly available. The only folder you should not use is /assets, since it is used for precompiling assets (see below).
@@ -113,19 +91,19 @@ Anything you put in here will be publicly available. The only folder you should
113
91
  * /favicon.ico
114
92
 
115
93
  ### /config/routes.rb
116
- The fanforce-plugin-factory sets up all the required routes. If you want to customize existing routes or add new ones, create a routes.rb file in your home directory with a FanforcePlugin:Sinatra class:
94
+ The fanforce-plugin-factory sets up all the required routes. If you want to customize existing routes or add new ones, create a config/routes.rb file and specify routes within the Plugin:Sinatra class:
117
95
  ```
118
- class FanforcePlugin::Sinatra
96
+ class Plugin::Sinatra
119
97
  get '/test' do
120
98
  "Custom route!"
121
99
  end
122
100
  end
123
101
  ```
124
- Check out [Sinatra's](http://www.sinatrarb.com/documentation) documentation for more details on routes and much more. The FanforcePlugin::Sinatra inherits from the Sinatra::Base, which gives you full control to customize the fanforce-plugin-factory's sinatra implementation as much as you want.
102
+ Check out [Sinatra's](http://www.sinatrarb.com/documentation) documentation for more details on routes and much more. The Plugin::Sinatra inherits from the Sinatra::Base, which gives you full control to customize the fanforce-plugin-factory's sinatra implementation as much as you want.
125
103
 
126
- Overwrite any existing routes by specifying them in your routes.rb. You can also pull default route logic into your new custom routes by calling route_[NAME_OF_ROUTE] method.
104
+ Overwrite any existing routes by specifying them in your config/routes.rb. You can also pull default route logic into your new custom routes by calling route_[NAME_OF_ROUTE] method.
127
105
  ```
128
- class FanforcePlugin::Sinatra
106
+ class Plugin::Sinatra
129
107
  any '/install' do
130
108
  # do whatever you want here
131
109
  route_install
@@ -134,29 +112,17 @@ end
134
112
  ```
135
113
  *Default Routes:*
136
114
  - route_index: get ['/','/index.html']
115
+ - route_dashboard: get '/dashboard.html'
137
116
  - route_install: post '/install'
138
117
  - route_uninstall: post '/uninstall'
139
118
 
140
- *Default Routes for Behavior Plugins:*
141
- - route_add_initiative: get '/add_initiative.html'
142
- - route_edit_initiative: get '/add_initiative.html'
143
- - route_widget_tmpls: get '/widget_tmpls.html'
144
- - route_engage: get '/:organization_slug/:initiative_slug/engage.html'
145
-
146
- *Default Routes for Broadcaster Plugins:*
147
- - route_new_message: get '/new_message.html'
148
-
149
- *Default Routes for Data Connector Plugins:*
150
- - route_add_source: get '/add_source.html'
151
- - route_source_details: get '/source_details.html'
152
-
153
119
  ### /config/initializer.rb
154
120
  If you need to run Sinatra middleware or other non-route code, you'll want to create a config/initializer.rb file. This file is required before config/routes.rb. As an example, if you want to use the OmniAuth Facebook Strategy, you would include the following in config/initializer.rb:
155
121
  ```
156
122
  require 'omniauth'
157
123
  require 'omniauth-constantcontact2'
158
124
 
159
- class FanforcePlugin::Sinatra
125
+ class Plugin::Sinatra
160
126
 
161
127
  use Rack::Session::Cookie
162
128
  use OmniAuth::Builder do
@@ -169,7 +135,8 @@ end
169
135
  ### /lib/*
170
136
  If you create a lib/ folder in your plugin's home directory, it will be automatically added to your plugin's ruby path. This allows you to require 'any_file' that has been put in this folder.
171
137
 
172
- # Using Pages/Layouts In Controllers
138
+
139
+ # Loading Pages/Layouts In Controllers
173
140
  Fanforce-plugin-factory adds a helper method on top of the Sinatra code base to load pages and layouts. It's called page:
174
141
  ```
175
142
  get '/custom.html' do
@@ -189,42 +156,40 @@ end
189
156
  ```
190
157
  If a callback param is sent in the request then your json is automatically converted to JSONR[http://github.com/calebclark/rack-jsonr] (JSON Resource).
191
158
 
192
- # Asset Helpers
193
- Fanforce-plugin-factory comes with a few asset helpers you can use in your haml pages:
194
-
195
- - stylesheet(absolute_or_relative_path) - creates style tag
196
- - javascript(absolute_or_relative_path) - creates script tag
197
- - asset_path(absolute_or_relative_path) - prints path to asset
198
159
 
199
160
  # Precompile Your Assets for Faster Delivery
200
161
  Heroku tries to run `rake assets:precompile` when pushing new code changes. Fanforce-plugin-factory has this rake task built-in. To activate, just create a new Rakefile in your plugin directory with the following:
201
162
  ```
202
163
  require 'bundler'; Bundler.setup
203
164
  require 'fanforce/plugin'
204
- FanforcePlugin.config do |config|
205
- config.type = :behavior # :data_connector, :data_processor, :broadcaster, :identifier, :behavior
206
- end
207
165
  load 'fanforce/plugin.rake'
208
166
  ```
209
167
 
168
+ # Create Plugin-Specific ENV Variables In Development
169
+ Documentation coming soon.
170
+
210
171
  # Configure Redis
211
172
  By default fanforce-plugin-factory looks for ENV['REDIS_URL'] and if that isn't found, it falls back to redis://localhost:6379. You can specify a custom redis url with `config.redis_url = ` in config.ru:
212
173
  ```
213
- FanforcePlugin.config do |config|
174
+ require 'bundler'; Bundler.setup
175
+ require 'fanforce/plugin_factory'
176
+ Fanforce::Plugin.config do |config|
214
177
  config.redis_url = 'redis://USERNAME:PASSWORD@HOST:PORT'
215
178
  end
179
+ load 'fanforce/plugin.rake'
216
180
  ```
217
181
 
182
+
218
183
  # Using Fanforce::Worker
219
184
 
220
- FanforcePlugin includes the fanforce-workers gem by default and includes a convenience helper method. FanforcePlugin.enqueue
185
+ Fanforce::Plugin includes the fanforce-workers gem by default and includes a convenience helper method. Fanforce::Plugin.enqueue
221
186
  will prefix the name of your worker with the name of your plugin to ensure there are no conflicts across multiple plugins
222
- or apps. This is the naming convention used by Fanforce Factory when creating and uploading Iron.io workers.
187
+ or plugins. This is the naming convention used by Fanforce Factory when creating and uploading Iron.io workers.
223
188
 
224
189
  As an example, if you have a testing.worker file, you would use the following command:
225
190
 
226
191
  ```
227
- FanforcePlugin.enqueue 'testing', {params_to_send: 'whatever'}
192
+ Fanforce::Plugin.enqueue 'testing', {params_to_send: 'whatever'}
228
193
  ```
229
194
 
230
195
 
data/Rakefile CHANGED
@@ -3,14 +3,71 @@ require 'rake/testtask'
3
3
  require 'fileutils'
4
4
  include FileUtils
5
5
 
6
- # Default Rake task is compile
7
- #task :default => :compile
6
+ task :pre_build do
7
+ Rake::Task['test'].execute
8
+ puts '---------------------------------------------------------------------'
9
+ puts 'TESTS PASSED!'
10
+ puts '---------------------------------------------------------------------'
11
+ puts 'UPDATING SCAFFOLDING DIGESTS...'
12
+ Rake::Task['scaffolding:register'].execute
13
+ puts 'READY TO BUILD!'
14
+ puts '---------------------------------------------------------------------'
15
+ end
16
+
17
+ namespace :scaffolding do
18
+ require 'digest'
19
+
20
+ class Fanforce::CLI
21
+ DIR = ''
22
+ TYPE = ''
23
+ end
24
+
25
+ require 'fanforce/plugin_factory/cli'
26
+ require 'fanforce/plugin_factory/cli/lib/scaffolding_file'
27
+
28
+ task :register do
29
+ scaffolding_dir = File.expand_path('../lib/fanforce/plugin_factory/scaffolding', __FILE__)
30
+
31
+ Dir.glob("#{scaffolding_dir}/**/*", File::FNM_DOTMATCH).each do |scaffold_filepath|
32
+ next if scaffold_filepath =~ /\.registry/ or File.directory?(scaffold_filepath)
33
+
34
+ file_parts = scaffold_filepath.split('/')
35
+ registry_filepath = "#{file_parts[0...-1].join('/')}/._#{file_parts[-1]}.registry"
36
+
37
+ file = Fanforce::PluginFactory::CLI::ScaffoldingFile.new(scaffold_filepath)
38
+ if [:file,:image,:partial].include?(file.scaffold_type)
39
+ next if file.digest_exists_in_registry?(file.scaffold_digest)
40
+ File.open(registry_filepath, 'a') {|f|
41
+ f.puts "fanforce-plugin-factory-#{Fanforce::PluginFactory::VERSION}:#{file.scaffold_digest}"
42
+ }
43
+ elsif [:items].include?(file.scaffold_type)
44
+ scaffold_contents = File.open(file.scaffold_filepath).read
45
+ raise "item changes are not registered for #{file.scaffold_filepath}" if !file.list_matches_latest_registry?(scaffold_contents)
46
+ next
47
+ elsif [:json].include?(file.scaffold_type)
48
+ scaffold_contents = File.open(file.scaffold_filepath).read
49
+ raise "json changes are not registered for #{file.scaffold_filepath}" if !file.json_matches_latest_registry?(scaffold_contents)
50
+ next
51
+ elsif [:skipped].include?(file.scaffold_type)
52
+ next
53
+ else
54
+ raise "unknown scaffold type: #{file.scaffold_type}"
55
+ end
56
+
57
+ puts "- REGISTERED #{scaffold_filepath.gsub(scaffolding_dir, '')} (#{file.scaffold_type})"
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ task :build => :pre_build
64
+ task :default => :build
8
65
 
9
66
  ########################################################################
10
67
 
11
68
  Rake::TestTask.new do |t|
12
- t.libs.push "lib"
13
- t.libs.push "test"
69
+ t.libs.push 'lib'
70
+ t.libs.push 'test'
14
71
  t.pattern = 'test/**/*_test.rb'
15
72
  t.verbose = false
16
73
  end
@@ -10,34 +10,34 @@ Gem::Specification.new do |gem|
10
10
  gem.summary = %q{Everything needed to setup a new plugin on Fanforce}
11
11
  gem.authors = ['Caleb Clark']
12
12
  gem.email = ['cclark@fanforce.com']
13
- gem.homepage = 'http://github.com/mlabs/fanforce-plugin-factory'
13
+ gem.homepage = 'http://github.com/fanforce/gem-fanforce-plugin-factory'
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
- gem.require_paths = ["lib"]
17
+ gem.require_paths = ['lib']
18
18
 
19
- gem.add_runtime_dependency 'rake', '~> 0.8.7'
20
- gem.add_runtime_dependency 'redis', '~> 3.0.5'
21
- gem.add_runtime_dependency 'sinatra', '~> 1.4.3'
22
- gem.add_runtime_dependency 'sinatra-contrib', '~> 1.4.1'
19
+ gem.add_runtime_dependency 'rake', '~> 10.3.2'
20
+ gem.add_runtime_dependency 'redis', '~> 3.1.0'
21
+ gem.add_runtime_dependency 'sinatra', '~> 1.4.5'
22
+ gem.add_runtime_dependency 'sinatra-contrib', '~> 1.4.2'
23
23
  gem.add_runtime_dependency 'rack-contrib', '~> 1.1.0'
24
- gem.add_runtime_dependency 'haml', '~> 4.0.3'
25
- gem.add_runtime_dependency 'coffee-script', '~> 2.2.0'
26
- gem.add_runtime_dependency 'activesupport', '3.2.13'
24
+ gem.add_runtime_dependency 'haml', '~> 4.0.5'
25
+ gem.add_runtime_dependency 'coffee-script', '~> 2.3.0'
27
26
 
28
- gem.add_runtime_dependency 'sass', '~> 3.2.12'
29
- gem.add_runtime_dependency 'compass', '~> 0.12.2'
30
- gem.add_runtime_dependency 'sprockets', '~> 2.10.0'
31
- gem.add_runtime_dependency 'sprockets-sass', '~> 1.0.2'
27
+ gem.add_runtime_dependency 'sass', '~> 3.4.5'
28
+ gem.add_runtime_dependency 'compass', '~> 1.0.1'
29
+ gem.add_runtime_dependency 'sprockets', '~> 2.12.2'
30
+ gem.add_runtime_dependency 'sprockets-sass', '~> 1.2.0'
32
31
  gem.add_runtime_dependency 'yui-compressor', '~> 0.12.0'
33
- gem.add_runtime_dependency 'uglifier', '~> 2.2.1'
34
- gem.add_runtime_dependency 'therubyracer', '~> 0.12.0'
32
+ gem.add_runtime_dependency 'uglifier', '~> 2.5.3'
33
+ gem.add_runtime_dependency 'therubyracer', '~> 0.12.1'
35
34
 
36
- gem.add_runtime_dependency 'bugsnag', '~> 1.5.2'
37
- gem.add_runtime_dependency 'rack-jsonr', '~> 0.2.6'
35
+ gem.add_runtime_dependency 'bugsnag', '~> 2.5.0'
36
+ gem.add_runtime_dependency 'rack-jsonr', '~> 0.2.7'
38
37
 
39
- gem.add_runtime_dependency 'fanforce', '~> 0.18'
40
- gem.add_runtime_dependency 'fanforce-api', '~> 0.20'
41
- gem.add_runtime_dependency 'fanforce-exceptions', '~> 0.5'
42
- gem.add_runtime_dependency 'fanforce-worker', '~> 0.20'
38
+ gem.add_runtime_dependency 'rest_client', '= 1.7.3'
39
+
40
+ gem.add_runtime_dependency 'fanforce-base', '~> 1.6.0'
41
+ gem.add_runtime_dependency 'fanforce-api', '~> 1.6.0'
42
+ gem.add_runtime_dependency 'fanforce-plugin-worker', '~> 1.6.0'
43
43
  end
@@ -1,68 +1,26 @@
1
- ENV['RACK_ENV'] ||= 'development'
2
- ####################################################################################
3
- require 'rack/jsonr'
4
- require 'fanforce/api'
5
- require 'fanforce/worker'
6
- require 'active_support/all'
7
- require 'sinatra/base'
8
- require 'fileutils'
9
- require 'redis'
10
1
  require_relative 'plugin_factory/version'
2
+ require_relative 'plugin_factory/load'
11
3
 
12
- if ENV['RACK_ENV'] == 'development'
13
- require_relative 'plugin_factory/sprockets/hacks'
14
- require_relative 'plugin_factory/sprockets/compiler'
15
- end
16
-
17
- caller[0].split(':')[0] =~ /^(.+(config\.ru|Rakefile))$/ ? ROOT_DIR = File.dirname($1) : nil
18
-
19
- module FanforcePlugin
20
-
21
- def self.enqueue(queue_name, payload)
22
- Fanforce::Worker.enqueue "#{config._id}-#{queue_name}", payload
23
- end
4
+ ########################################################################################################################
24
5
 
25
- def self.config(&block)
26
- config = @@config ||= FanforcePlugin::CoreConfig.new(ROOT_DIR)
27
- if block.present?
28
- block.call(config)
29
- config.root_dir = File.dirname($1) if !config.root_dir and caller[0].split(':')[0] =~ /^(.+(config\.ru|Rakefile))$/
30
- end
31
- config
32
- end
6
+ class Fanforce::PluginFactory
33
7
 
34
- def self.root
35
- config.root_dir
36
- end
8
+ def self.generate(plugin_base_dir)
9
+ require_relative 'plugin_factory/plugin'
10
+ require_relative 'plugin_factory/load_sprockets' if ENV['RACK_ENV'] == 'development'
37
11
 
38
- def self.dir_name
39
- config.dir_name
40
- end
41
-
42
- def self._id
43
- config._id
12
+ Fanforce::Plugin.load(plugin_base_dir)
44
13
  end
14
+ end
45
15
 
46
- def self.type
47
- config.type
48
- end
16
+ ########################################################################################################################
49
17
 
50
- def self.load_config
51
- config.load
52
- end
18
+ # The following is run if file is required from config.ru or Rakefile
19
+ if caller[0].split(':')[0] =~ /^(.+)\/(config\.ru|Rakefile)$/
20
+ plugin_base_dir = $1
21
+ loader_filename = $2
22
+ ENV['RACK_ENV'] ||= 'development'
53
23
 
54
- def self.call(env)
55
- if ENV['RACK_ENV'] == 'development' and env['PATH_INFO'] =~ /^\/assets\//
56
- env['PATH_INFO'] = env['PATH_INFO'].gsub(/^\/assets/, '')
57
- sprockets = SprocketsCompiler.setup(FanforcePlugin.config.root_dir)
58
- return sprockets.index.call(env)
59
- end
60
- require_relative 'plugin_factory/_init_sinatra'
61
- request = Rack::Request.new(env)
62
- Rack::JSONR.intercept_method_override(env, request, request.params, :all)
63
- FanforcePlugin::Sinatra.new.call(env)
64
- end
65
-
66
- require_relative 'plugin_factory/config/core_config'
24
+ Fanforce::PluginFactory.generate(plugin_base_dir)
25
+ load "#{Fanforce::Plugin.config.factory_dir}/Rakefile" if loader_filename == 'Rakefile'
67
26
  end
68
-