houston-core 0.6.3 → 0.7.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile.lock +53 -63
  4. data/app/adapters/houston/adapters/error_tracker/errbit_adapter.rb +2 -2
  5. data/app/adapters/houston/adapters/ticket_tracker/github_adapter.rb +1 -1
  6. data/app/adapters/houston/adapters/ticket_tracker/unfuddle_adapter.rb +5 -5
  7. data/app/adapters/houston/adapters/version_control/git_adapter.rb +4 -4
  8. data/app/assets/javascripts/{app → houston/app}/boot.coffee +0 -0
  9. data/app/assets/javascripts/{app → houston/app}/emoji.coffee.erb +0 -0
  10. data/app/assets/javascripts/{app → houston/app}/infinite_scroll.coffee +0 -0
  11. data/app/assets/javascripts/{app → houston/app}/models/commit.coffee +0 -0
  12. data/app/assets/javascripts/{app → houston/app}/models/release.coffee +0 -0
  13. data/app/assets/javascripts/{app → houston/app}/models/task.coffee +0 -0
  14. data/app/assets/javascripts/{app → houston/app}/models/tester.coffee +0 -0
  15. data/app/assets/javascripts/{app → houston/app}/models/testing_note.coffee +0 -0
  16. data/app/assets/javascripts/{app → houston/app}/models/ticket.coffee +0 -0
  17. data/app/assets/javascripts/{app → houston/app}/models/user.coffee +0 -0
  18. data/app/assets/javascripts/{app → houston/app}/mousetrap-bind-scoped.js +0 -0
  19. data/app/assets/javascripts/{app → houston/app}/releases.coffee +0 -0
  20. data/app/assets/javascripts/{app → houston/app}/table_row_expander.coffee +0 -0
  21. data/app/assets/javascripts/{app → houston/app}/ticket_tracker_refresh.coffee +0 -0
  22. data/app/assets/javascripts/{app → houston/app}/views/_show_sprint_view.coffee +0 -0
  23. data/app/assets/javascripts/{app → houston/app}/views/_tickets_view.coffee +0 -0
  24. data/app/assets/javascripts/{app → houston/app}/views/all_tickets_view.coffee +0 -0
  25. data/app/assets/javascripts/{app → houston/app}/views/commit_view.coffee +0 -0
  26. data/app/assets/javascripts/{app → houston/app}/views/edit_sprint_view.coffee +0 -0
  27. data/app/assets/javascripts/{app → houston/app}/views/edit_ticket_view.coffee +0 -0
  28. data/app/assets/javascripts/{app → houston/app}/views/find_or_create_ticket_view.coffee +0 -0
  29. data/app/assets/javascripts/{app → houston/app}/views/keyboard_shortcuts_modal.coffee +0 -0
  30. data/app/assets/javascripts/{app → houston/app}/views/new_ticket_modal.coffee +0 -0
  31. data/app/assets/javascripts/{app → houston/app}/views/new_ticket_view.coffee +0 -0
  32. data/app/assets/javascripts/{app → houston/app}/views/problems_view.coffee +0 -0
  33. data/app/assets/javascripts/{app → houston/app}/views/testing_note_view.coffee +0 -0
  34. data/app/assets/javascripts/{app → houston/app}/views/testing_report_view.coffee +0 -0
  35. data/app/assets/javascripts/{app → houston/app}/views/testing_ticket_view.coffee +0 -0
  36. data/app/assets/javascripts/{app → houston/app}/views/ticket_modal_view.coffee +0 -0
  37. data/app/assets/javascripts/{application.js → houston/application.js} +1 -1
  38. data/app/assets/javascripts/{core → houston/core}/app.coffee +0 -0
  39. data/app/assets/javascripts/{core → houston/core}/burndown_chart.coffee +0 -0
  40. data/app/assets/javascripts/{core → houston/core}/core_ext/array.coffee +0 -0
  41. data/app/assets/javascripts/{core → houston/core}/core_ext/date.coffee +0 -0
  42. data/app/assets/javascripts/{core → houston/core}/core_ext/number.coffee +0 -0
  43. data/app/assets/javascripts/{core → houston/core}/errors.coffee +1 -1
  44. data/app/assets/javascripts/{core → houston/core}/handlebars_helpers.coffee +0 -0
  45. data/app/assets/javascripts/{core → houston/core}/helpers.coffee +0 -0
  46. data/app/assets/javascripts/{core → houston/core}/jquery_extensions.coffee +5 -3
  47. data/app/assets/javascripts/{core → houston/core}/stacked_area_graph.coffee +0 -0
  48. data/app/assets/javascripts/{core → houston/core}/stacked_bar_graph.coffee +0 -0
  49. data/app/assets/javascripts/{dashboard.js → houston/dashboard.js} +1 -1
  50. data/app/assets/javascripts/{dashboard → houston/dashboard}/refresher.coffee +0 -0
  51. data/app/assets/javascripts/{vendor.js → houston/vendor.js} +0 -0
  52. data/app/assets/stylesheets/{application.css → houston/application.css} +0 -0
  53. data/app/assets/stylesheets/{application → houston/application}/ansi.scss +0 -0
  54. data/app/assets/stylesheets/{application → houston/application}/commit.scss +0 -0
  55. data/app/assets/stylesheets/{application → houston/application}/emoji.scss +0 -0
  56. data/app/assets/stylesheets/{application → houston/application}/exceptions.scss +1 -1
  57. data/app/assets/stylesheets/{application → houston/application}/find_or_create_ticket.scss +0 -0
  58. data/app/assets/stylesheets/{application → houston/application}/follow_up.scss +0 -0
  59. data/app/assets/stylesheets/{application → houston/application}/forms.scss +0 -0
  60. data/app/assets/stylesheets/{application → houston/application}/freight_train.css.scss +0 -0
  61. data/app/assets/stylesheets/{application → houston/application}/full_screen.scss +0 -0
  62. data/app/assets/stylesheets/{application → houston/application}/github_repos.scss +0 -0
  63. data/app/assets/stylesheets/{application → houston/application}/infinite_scroll.scss +0 -0
  64. data/app/assets/stylesheets/houston/application/jobs.scss +5 -0
  65. data/app/assets/stylesheets/{application → houston/application}/keyboard_shortcuts.scss +0 -0
  66. data/app/assets/stylesheets/{application → houston/application}/markdown.scss +0 -0
  67. data/app/assets/stylesheets/{application → houston/application}/mobile.scss +0 -0
  68. data/app/assets/stylesheets/{application → houston/application}/modals.scss +0 -0
  69. data/app/assets/stylesheets/{application → houston/application}/navigation.scss +0 -0
  70. data/app/assets/stylesheets/{application → houston/application}/new_ticket_view.scss +0 -0
  71. data/app/assets/stylesheets/{application → houston/application}/omnibar.scss +0 -0
  72. data/app/assets/stylesheets/{application → houston/application}/project_banner_buttons.scss +0 -0
  73. data/app/assets/stylesheets/{application → houston/application}/project_tiles.scss +0 -0
  74. data/app/assets/stylesheets/{application → houston/application}/projects.css.scss +0 -0
  75. data/app/assets/stylesheets/{application → houston/application}/pull_requests.scss +0 -0
  76. data/app/assets/stylesheets/{application → houston/application}/queue.scss +0 -0
  77. data/app/assets/stylesheets/{application → houston/application}/release_form.scss +0 -0
  78. data/app/assets/stylesheets/{application → houston/application}/releases.scss +1 -1
  79. data/app/assets/stylesheets/{application → houston/application}/sortable_table.scss +0 -0
  80. data/app/assets/stylesheets/{application → houston/application}/sprint.scss +0 -0
  81. data/app/assets/stylesheets/{application → houston/application}/tables.scss +0 -0
  82. data/app/assets/stylesheets/{application → houston/application}/test.scss +0 -0
  83. data/app/assets/stylesheets/{application → houston/application}/test_run.scss +0 -0
  84. data/app/assets/stylesheets/{application → houston/application}/testing_report.scss +0 -0
  85. data/app/assets/stylesheets/{application → houston/application}/ticket.scss +0 -0
  86. data/app/assets/stylesheets/{application → houston/application}/ticket_modal.scss +0 -0
  87. data/app/assets/stylesheets/{application → houston/application}/tickets.scss +0 -0
  88. data/app/assets/stylesheets/{application → houston/application}/timeline.scss +0 -0
  89. data/app/assets/stylesheets/{application → houston/application}/tips.scss +0 -0
  90. data/app/assets/stylesheets/{application → houston/application}/typeahead.scss +0 -0
  91. data/app/assets/stylesheets/{application → houston/application}/uploading.scss +0 -0
  92. data/app/assets/stylesheets/{application → houston/application}/user_wall.scss +0 -0
  93. data/app/assets/stylesheets/{application → houston/application}/users.scss +0 -0
  94. data/app/assets/stylesheets/{application → houston/application}/welcome.scss +0 -0
  95. data/app/assets/stylesheets/{core → houston/core}/alerts.scss +0 -0
  96. data/app/assets/stylesheets/{core → houston/core}/avatars.scss +0 -0
  97. data/app/assets/stylesheets/{core → houston/core}/burndown_chart.scss +0 -0
  98. data/app/assets/stylesheets/{core → houston/core}/colors.scss.erb +0 -0
  99. data/app/assets/stylesheets/{core → houston/core}/misc.scss +3 -0
  100. data/app/assets/stylesheets/{core → houston/core}/octicons-icons.scss +0 -0
  101. data/app/assets/stylesheets/{core → houston/core}/octicons.scss.erb +0 -0
  102. data/app/assets/stylesheets/{core → houston/core}/overrides.scss +0 -0
  103. data/app/assets/stylesheets/{core → houston/core}/roboto.scss.erb +0 -0
  104. data/app/assets/stylesheets/{core → houston/core}/scores.scss +0 -0
  105. data/app/assets/stylesheets/{dashboard.css → houston/dashboard.css} +0 -0
  106. data/app/assets/stylesheets/{dashboard → houston/dashboard}/dashboard.scss +0 -0
  107. data/app/assets/stylesheets/{print.css.scss → houston/print.css.scss} +0 -0
  108. data/app/assets/stylesheets/{variables.scss → houston/variables.scss} +0 -0
  109. data/app/assets/stylesheets/{vendor.css → houston/vendor.css} +0 -0
  110. data/app/concerns/houston/props.rb +96 -0
  111. data/app/concerns/project_adapter.rb +1 -1
  112. data/app/controllers/api/v1/measurements_controller.rb +32 -0
  113. data/app/controllers/application_controller.rb +1 -1
  114. data/app/controllers/authorizations_controller.rb +61 -0
  115. data/app/controllers/github/pulls_controller.rb +1 -1
  116. data/app/controllers/jobs_controller.rb +30 -1
  117. data/app/controllers/oauth/providers_controller.rb +45 -0
  118. data/app/controllers/project_options_controller.rb +2 -2
  119. data/app/controllers/projects_controller.rb +3 -3
  120. data/app/controllers/releases_controller.rb +3 -3
  121. data/app/controllers/user_options_controller.rb +2 -2
  122. data/app/controllers/users_controller.rb +1 -2
  123. data/app/helpers/application_helper.rb +49 -3
  124. data/app/helpers/email_helper.rb +19 -1
  125. data/app/helpers/release_helper.rb +1 -1
  126. data/app/helpers/ticket_helper.rb +0 -32
  127. data/app/interactors/cache_key_dependencies.rb +3 -8
  128. data/app/mailers/view_mailer.rb +8 -8
  129. data/app/models/authorization.rb +54 -0
  130. data/app/models/commit.rb +1 -1
  131. data/app/models/error.rb +14 -0
  132. data/app/models/github/comment_event.rb +4 -4
  133. data/app/models/github/pull_request.rb +39 -17
  134. data/app/models/github/pull_request_event.rb +1 -7
  135. data/app/models/job.rb +81 -0
  136. data/app/models/measurement.rb +2 -1
  137. data/app/models/oauth/provider.rb +35 -0
  138. data/app/models/project.rb +12 -3
  139. data/app/models/slackdown.rb +1 -1
  140. data/app/models/user.rb +28 -35
  141. data/app/presenters/measurements_presenter.rb +26 -0
  142. data/app/presenters/project_presenter.rb +1 -1
  143. data/app/views/authorizations/_form.html.erb +33 -0
  144. data/app/views/authorizations/edit.html.erb +7 -0
  145. data/app/views/authorizations/granted.html.erb +7 -0
  146. data/app/views/authorizations/index.html.erb +47 -0
  147. data/app/views/authorizations/new.html.erb +7 -0
  148. data/app/views/configuration_error/_no_ticket_tracker.html.erb +1 -1
  149. data/app/views/github/pulls/index.html.erb +5 -1
  150. data/app/views/jobs/index.html.erb +72 -0
  151. data/app/views/jobs/show.html.erb +25 -32
  152. data/app/views/layouts/_navigation.html.erb +1 -1
  153. data/app/views/layouts/application.html.erb +14 -15
  154. data/app/views/layouts/dashboard.html.erb +9 -10
  155. data/app/views/layouts/minimal.html.erb +14 -15
  156. data/app/views/layouts/naked.html.erb +52 -0
  157. data/app/views/layouts/naked_dashboard.html.erb +9 -10
  158. data/app/views/oauth/providers/_form.html.erb +54 -0
  159. data/app/views/oauth/providers/edit.html.erb +7 -0
  160. data/app/views/oauth/providers/index.html.erb +41 -0
  161. data/app/views/oauth/providers/new.html.erb +7 -0
  162. data/app/views/projects/_form.html.erb +8 -9
  163. data/app/views/projects/index.html.erb +1 -1
  164. data/app/views/users/_form.html.erb +20 -19
  165. data/bin/rails +1 -1
  166. data/config/application.rb +11 -10
  167. data/config/boot.rb +1 -2
  168. data/config/environments/development.rb +8 -6
  169. data/config/environments/production.rb +11 -16
  170. data/config/environments/test.rb +5 -5
  171. data/config/initializers/assets.rb +17 -7
  172. data/config/initializers/cookies_serializer.rb +1 -1
  173. data/config/initializers/houston_async.rb +22 -4
  174. data/config/initializers/houston_report_exception.rb +16 -11
  175. data/config/initializers/houston_scheduler.rb +1 -1
  176. data/config/initializers/houston_try.rb +12 -0
  177. data/config/routes.rb +29 -19
  178. data/db/fixtures/projects.yml +2 -2
  179. data/db/migrate/20160317140151_remove_limit_from_users_invitation_token.rb +9 -0
  180. data/db/migrate/20160419230411_create_oauth_providers.rb +14 -0
  181. data/db/migrate/20160420000616_create_authorizations.rb +16 -0
  182. data/db/migrate/20160507135209_create_jobs.rb +14 -0
  183. data/db/migrate/20160507135846_create_errors_2.rb +12 -0
  184. data/db/migrate/20160510233329_add_closed_at_and_merged_at_to_pull_requests.rb +7 -0
  185. data/db/migrate/20160625203412_convert_user_view_options_to_props.rb +21 -0
  186. data/db/migrate/20160625221840_convert_project_extended_attributes_to_props.rb +32 -0
  187. data/db/migrate/20160625230420_move_users_unfuddle_id_to_props.rb +14 -0
  188. data/db/structure.sql +247 -4
  189. data/{houston.gemspec → houston-core.gemspec} +8 -9
  190. data/lib/configuration.rb +15 -43
  191. data/lib/houston/version.rb +1 -1
  192. data/lib/houston_observer.rb +2 -7
  193. data/lib/parallel_enumerable.rb +2 -8
  194. data/templates/new-instance/app/assets/javascripts/.keep +0 -0
  195. data/templates/new-instance/app/assets/javascripts/application.js +13 -0
  196. data/templates/new-instance/app/assets/stylesheets/.keep +0 -0
  197. data/templates/new-instance/app/assets/stylesheets/application.css +13 -0
  198. data/templates/new-instance/app/controllers/.keep +0 -0
  199. data/templates/new-instance/app/models/.keep +0 -0
  200. data/templates/new-instance/app/views/.keep +0 -0
  201. data/templates/new-instance/config/alerts/errs.rb +1 -1
  202. data/templates/new-instance/config/jobs/purge_jobs.rb +3 -0
  203. data/templates/new-instance/config/main.rb +1 -0
  204. data/templates/new-instance/config/routes.rb +5 -0
  205. data/templates/new-instance/config/triggers/github/publish_comments_on_slack.rb +3 -3
  206. data/templates/new-instance/lib/houston/engine.rb +25 -0
  207. data/test/acceptance/creating_a_release_test.rb +1 -1
  208. data/test/integration/ci_integration_test.rb +2 -2
  209. data/test/integration/commits_api_test.rb +1 -1
  210. data/test/unit/controllers/hooks_controller_test.rb +1 -6
  211. data/test/unit/controllers/project_options_controller_test.rb +11 -11
  212. data/test/unit/controllers/user_options_controller_test.rb +13 -13
  213. data/test/unit/models/code_climate_coverage_report_test.rb +1 -1
  214. data/test/unit/models/commit_test.rb +4 -2
  215. data/test/unit/models/project_test.rb +5 -5
  216. data/test/unit/models/props_test.rb +57 -0
  217. data/test/unit/models/pull_request_test.rb +2 -2
  218. data/test/unit/models/test_run_test.rb +1 -1
  219. metadata +166 -151
  220. data/app/assets/javascripts/app/views/reports_view.coffee +0 -51
  221. data/app/controllers/oauth_consumers_controller.rb +0 -68
  222. data/app/controllers/reports_controller.rb +0 -215
  223. data/app/models/consumer_token.rb +0 -13
  224. data/app/models/github_token.rb +0 -8
  225. data/app/views/oauth_consumers/error.html.erb +0 -5
  226. data/app/views/oauth_consumers/index.html.erb +0 -29
  227. data/app/views/oauth_consumers/show.html.erb +0 -7
  228. data/app/views/reports/index.html.erb +0 -9
  229. data/app/views/reports/sprint.html.erb +0 -21
  230. data/app/views/reports/velocity.html.erb +0 -104
  231. data/config/initializers/oauth_consumers.rb +0 -18
  232. data/lib/patches/sprockets_output_path_for_assets.rb +0 -29
@@ -16,11 +16,13 @@ Rails.application.configure do
16
16
 
17
17
  # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
18
  # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
19
+ # For large-scale production use, consider using a caching reverse proxy like
20
+ # NGINX, varnish or squid.
20
21
  # config.action_dispatch.rack_cache = true
21
22
 
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_files = false
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
24
26
 
25
27
  # Compress JavaScripts and CSS.
26
28
  config.assets.js_compressor = :uglifier
@@ -29,15 +31,15 @@ Rails.application.configure do
29
31
  # Do not fallback to assets pipeline if a precompiled asset is missed.
30
32
  config.assets.compile = false
31
33
 
32
- # Generate digests for assets URLs.
34
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
+ # yet still be able to expire them through the digest params.
33
36
  config.assets.digest = true
34
37
 
35
- # Version of your assets, change this if you want to expire all your assets.
36
- config.assets.version = '1.0'
38
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
37
39
 
38
40
  # Specifies the header that your server uses for sending files.
39
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
41
43
 
42
44
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
45
  # config.force_ssl = true
@@ -55,11 +57,7 @@ Rails.application.configure do
55
57
  # config.cache_store = :mem_cache_store
56
58
 
57
59
  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
- # config.action_controller.asset_host = "http://assets.example.com"
59
-
60
- # Precompile additional assets.
61
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
- # config.assets.precompile += %w( search.js )
60
+ # config.action_controller.asset_host = 'http://assets.example.com'
63
61
 
64
62
  # Ignore bad email addresses and do not raise email delivery errors.
65
63
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
@@ -72,9 +70,6 @@ Rails.application.configure do
72
70
  # Send deprecation notices to registered listeners.
73
71
  config.active_support.deprecation = :notify
74
72
 
75
- # Disable automatic flushing of the log to improve performance.
76
- # config.autoflush_log = false
77
-
78
73
  # Use default logging formatter so that PID and timestamp are not suppressed.
79
74
  config.log_formatter = ::Logger::Formatter.new
80
75
 
@@ -12,8 +12,8 @@ Rails.application.configure do
12
12
  # preloads Rails for running tests, you may have to set it to true.
13
13
  config.eager_load = false
14
14
 
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
17
  config.static_cache_control = 'public, max-age=3600'
18
18
 
19
19
  # Show full error reports and disable caching.
@@ -31,6 +31,9 @@ Rails.application.configure do
31
31
  # ActionMailer::Base.deliveries array.
32
32
  config.action_mailer.delivery_method = :test
33
33
 
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
36
+
34
37
  # Print deprecation notices to the stderr.
35
38
  config.active_support.deprecation = :stderr
36
39
 
@@ -42,7 +45,4 @@ Rails.application.configure do
42
45
 
43
46
  # Do not dump schema after migrations.
44
47
  config.active_record.dump_schema_after_migration = false
45
-
46
- # Specify test order
47
- config.active_support.test_order = :random
48
48
  end
@@ -1,9 +1,19 @@
1
- Rails.application.config.assets.precompile += %w{
2
- print.css
3
- vendor.js
4
- vendor.css
5
- dashboard.js
6
- dashboard.css
7
- }
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = "1.0"
8
5
 
6
+ # Add additional assets to the asset load path
9
7
  Rails.application.config.assets.paths << Rails.root.join("app", "assets", "fonts")
8
+
9
+ # Precompile additional assets.
10
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
+ Rails.application.config.assets.precompile += %w{
12
+ houston/application.js
13
+ houston/application.css
14
+ houston/print.css
15
+ houston/vendor.js
16
+ houston/vendor.css
17
+ houston/dashboard.js
18
+ houston/dashboard.css
19
+ }
@@ -1,3 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Rails.application.config.action_dispatch.cookies_serializer = :json
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,11 +1,29 @@
1
1
  module Houston
2
2
 
3
+ # Rescues exceptions and reports them
3
4
  def self.async
4
5
  Thread.new do
5
- begin
6
- yield
7
- rescue Exception # rescues StandardError by default; but we want to rescue and report all errors
8
- Houston.report_exception($!)
6
+ ActiveRecord::Base.connection_pool.with_connection do
7
+ begin
8
+ yield
9
+ rescue Exception # rescues StandardError by default; but we want to rescue and report all errors
10
+ Houston.report_exception($!)
11
+ ensure
12
+ Rails.logger.flush # http://stackoverflow.com/a/3516003/731300
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ # Allows exceptions to bubble up
19
+ def self.async!
20
+ Thread.new do
21
+ ActiveRecord::Base.connection_pool.with_connection do
22
+ begin
23
+ yield
24
+ ensure
25
+ Rails.logger.flush # http://stackoverflow.com/a/3516003/731300
26
+ end
9
27
  end
10
28
  end
11
29
  end
@@ -1,21 +1,26 @@
1
1
  module Houston
2
2
 
3
3
  def self.report_exception(exception, other_data={})
4
- raise if Rails.env.test? || Rails.env.development?
4
+ if Rails.env.test? || Rails.env.development?
5
+ Rails.logger.error "\e[31;1m#{exception.class}: #{exception.message}\n#{exception.backtrace.join("\n ")}\e[0m"
6
+ return
7
+ end
5
8
 
6
- Rails.logger.error "#{exception.class}: #{exception.message}\n#{exception.backtrace.join("\n ")}"
9
+ begin
10
+ Rails.logger.error "#{exception.class}: #{exception.message}\n#{exception.backtrace.join("\n ")}"
7
11
 
8
- if defined?(Airbrake)
9
- other_data[:parameters] ||= {}
10
- case exception
11
- when Faraday::HTTP::Error
12
- other_data[:parameters].merge!(_normalize_faraday_env(exception.env))
12
+ if defined?(Airbrake)
13
+ other_data[:parameters] ||= {}
14
+ case exception
15
+ when Faraday::HTTP::Error
16
+ other_data[:parameters].merge!(_normalize_faraday_env(exception.env))
17
+ end
18
+ other_data[:parameters].merge!(exception.additional_information)
19
+ Airbrake.notify(exception, other_data)
13
20
  end
14
- other_data[:parameters].merge!(exception.additional_information)
15
- Airbrake.notify(exception, other_data)
21
+ rescue Exception => e
22
+ Rails.logger.error "\e[31;1mAn error occurred reporting the exception: \e[0;31m#{e.class}: #{e.message}\n #{e.backtrace.join("\n ")}\e[0m"
16
23
  end
17
- rescue Exception => e
18
- Rails.logger.error "\e[31;1mAn error occurred reporting the exception: \e[0;31m#{e.class}: #{e.message}\n #{e.backtrace.join("\n ")}\e[0m"
19
24
  end
20
25
 
21
26
  def self._normalize_faraday_env(env)
@@ -4,7 +4,7 @@ Houston.daemonize "scheduler" do
4
4
  $scheduler = Rufus::Scheduler.new
5
5
 
6
6
  Houston.config.timers.each do |(type, param, name, options, block)|
7
- wrapped_block = Houston.jobs.method(:run_job)
7
+ wrapped_block = Houston.jobs.method(:run)
8
8
 
9
9
  case type
10
10
  when :cron
@@ -21,4 +21,16 @@ module Houston
21
21
  end
22
22
  end
23
23
 
24
+ def self.reconnect(options={})
25
+ max_tries = options.fetch(:max_tries, 2)
26
+ tries = 1
27
+ begin
28
+ yield
29
+ rescue exceptions_wrapping(PG::ConnectionBad)
30
+ ActiveRecord::Base.connection.reconnect!
31
+ retry unless (tries += 1) > 2
32
+ raise
33
+ end
34
+ end
35
+
24
36
  end
data/config/routes.rb CHANGED
@@ -1,13 +1,5 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
- resources :oauth_consumers do
4
- member do
5
- get :callback
6
- get :callback2
7
- match 'client/*endpoint' => 'oauth_consumers#client', via: [:get, :post, :put, :delete]
8
- end
9
- end
10
-
11
3
  devise_for :users, :controllers => { :sessions => "sessions" }
12
4
 
13
5
  root to: "welcome#index", via: :get
@@ -205,6 +197,8 @@ Rails.application.routes.draw do
205
197
  get "sprint/tasks/mine", to: "sprint_tasks#mine"
206
198
  post "sprint/tasks/:project_slug/:shorthand", :to => "sprint_tasks#create"
207
199
  delete "sprint/tasks/:project_slug/:shorthand", :to => "sprint_tasks#destroy"
200
+
201
+ get "measurements", to: "measurements#index"
208
202
  end
209
203
  end
210
204
 
@@ -232,12 +226,29 @@ Rails.application.routes.draw do
232
226
  put "credentials", to: "user_credentials#upsert"
233
227
  delete "credentials/:id", to: "user_credentials#destroy"
234
228
 
229
+ get "authorizations" => "authorizations#index", as: :authorizations
230
+ get "authorizations/new" => "authorizations#new", as: :new_authorization
231
+ post "authorizations" => "authorizations#create"
232
+ get "authorizations/:id/edit" => "authorizations#edit", as: :edit_authorization
233
+ patch "authorizations/:id" => "authorizations#update", as: :authorization
234
+
235
+ get "authorizations/:id/grant" => "authorizations#grant", as: :grant_authorization
236
+ get "authorizations/:id/granted" => "authorizations#granted", as: :authorization_granted
237
+ get "oauth2/callback" => "authorizations#oauth2_callback", as: :oauth2_callback
238
+
239
+ get "oauth/providers" => "oauth/providers#index", as: :oauth_providers
240
+ get "oauth/providers/new" => "oauth/providers#new", as: :new_oauth_provider
241
+ post "oauth/providers" => "oauth/providers#create"
242
+ get "oauth/providers/:id/edit" => "oauth/providers#edit", as: :edit_oauth_provider
243
+ patch "oauth/providers/:id" => "oauth/providers#update", as: :oauth_provider
244
+
235
245
 
236
246
 
237
247
  # Jobs
238
248
 
239
- get "jobs", to: "jobs#show"
240
- post "jobs/:slug", to: "jobs#run", :as => :run_job
249
+ get "jobs", to: "jobs#index", as: :jobs
250
+ get "jobs/:slug", to: "jobs#show", as: :job, constraints: { slug: /[^\/]+/ }
251
+ post "jobs/:slug", to: "jobs#run", as: :run_job, constraints: { slug: /[^\/]+/ }
241
252
 
242
253
 
243
254
 
@@ -254,15 +265,6 @@ Rails.application.routes.draw do
254
265
  # Other
255
266
 
256
267
  # Experiments
257
- get "reports", to: "reports#index"
258
- %w{queue-age cycle-time time-to-first-test time-to-release}.each do |report|
259
- get "reports/#{report}", to: "reports##{report.underscore}"
260
- end
261
- get "reports/velocity", to: "reports#velocity"
262
- get "reports/tasks.xlsx", to: "reports#tasks_excel"
263
-
264
- get "sprint/reports", to: "reports#sprint"
265
-
266
268
  get "pulls", to: "github/pulls#index"
267
269
 
268
270
  # Tester Bar
@@ -297,4 +299,12 @@ Rails.application.routes.draw do
297
299
  mount mod.engine => "/"
298
300
  end
299
301
 
302
+
303
+
304
+ # The Instance
305
+
306
+ if defined?(Houston::Engine)
307
+ mount Houston::Engine => "/"
308
+ end
309
+
300
310
  end
@@ -5,7 +5,7 @@ houston:
5
5
  ticket_tracker_name: Github
6
6
  version_control_name: Git
7
7
  error_tracker_name: Errbit
8
- extended_attributes: '"github_repo" => "houston/houston", "git_location" => "<%= Rails.root %>", "errbit_app_id" => "503638de8348fd1de9000004"'
8
+ props: '"github.repo" => "houston/houston", "git.location" => "<%= Rails.root %>", "errbit.appId" => "503638de8348fd1de9000004"'
9
9
 
10
10
  tsatsiki:
11
11
  name: Tsatsiki
@@ -18,4 +18,4 @@ test:
18
18
  color: bark
19
19
  ticket_tracker_name: Unfuddle
20
20
  version_control_name: Git
21
- extended_attributes: '"unfuddle_project_id" => "20", "git_location" => "<%= File.expand_path("~/Code/test") %>"'
21
+ props: '"unfuddle.projectId" => "20", "git.location" => "<%= File.expand_path("~/Code/test") %>"'
@@ -0,0 +1,9 @@
1
+ class RemoveLimitFromUsersInvitationToken < ActiveRecord::Migration
2
+ def up
3
+ change_column :users, :invitation_token, :string, limit: nil
4
+ end
5
+
6
+ def down
7
+ change_column :users, :invitation_token, :string, limit: 60
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ class CreateOauthProviders < ActiveRecord::Migration
2
+ def change
3
+ create_table :oauth_providers do |t|
4
+ t.string :name, null: false
5
+ t.string :site, null: false
6
+ t.string :authorize_path, null: false
7
+ t.string :token_path, null: false
8
+ t.string :client_id, null: false
9
+ t.string :client_secret, null: false
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ class CreateAuthorizations < ActiveRecord::Migration
2
+ def change
3
+ create_table :authorizations do |t|
4
+ t.string :name, null: false
5
+ t.integer :provider_id
6
+ t.string :scope
7
+ t.string :access_token, length: 1024
8
+ t.string :refresh_token
9
+ t.string :secret
10
+ t.integer :expires_in
11
+ t.timestamp :expires_at
12
+
13
+ t.timestamps
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ class CreateJobs < ActiveRecord::Migration
2
+ def change
3
+ create_table :jobs do |t|
4
+ t.string :name, null: false
5
+ t.datetime :started_at, null: false
6
+
7
+ t.datetime :finished_at
8
+ t.boolean :succeeded
9
+ t.integer :error_id
10
+
11
+ t.index :name
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ class CreateErrors2 < ActiveRecord::Migration
2
+ def change
3
+ create_table :errors do |t|
4
+ t.string :sha, null: false
5
+ t.text :message, null: false
6
+ t.text :backtrace, null: false
7
+ t.timestamps
8
+
9
+ t.index :sha, unique: true
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ class AddClosedAtAndMergedAtToPullRequests < ActiveRecord::Migration
2
+ def change
3
+ add_column :pull_requests, :closed_at, :datetime
4
+ add_column :pull_requests, :merged_at, :datetime
5
+ add_index :pull_requests, :closed_at
6
+ end
7
+ end
@@ -0,0 +1,21 @@
1
+ class ConvertUserViewOptionsToProps < ActiveRecord::Migration
2
+ def up
3
+ add_column :users, :props, :jsonb, default: "{}"
4
+
5
+ require "progressbar"
6
+ users = User.all
7
+ pbar = ProgressBar.new("users", users.count)
8
+ users.find_each do |user|
9
+ props = user.read_attribute(:view_options) || {}
10
+ props["github.username"] = props.delete("github_username") if props.key?("github_username")
11
+ props["slack.username"] = props.delete("slack_username") if props.key?("slack_username")
12
+ user.update_column :props, props
13
+ pbar.inc
14
+ end
15
+ pbar.finish
16
+ end
17
+
18
+ def down
19
+ remove_column :users, :props
20
+ end
21
+ end
@@ -0,0 +1,32 @@
1
+ class ConvertProjectExtendedAttributesToProps < ActiveRecord::Migration
2
+ def up
3
+ add_column :projects, :props, :jsonb, default: "{}"
4
+
5
+ require "progressbar"
6
+ projects = Project.all
7
+ pbar = ProgressBar.new("projects", projects.count)
8
+ projects.find_each do |project|
9
+ props = project.read_attribute(:extended_attributes) || {}
10
+ props.merge!(project.read_attribute(:view_options) || {})
11
+
12
+ props["unfuddle.projectId"] = props.delete("unfuddle_project_id") if props.key?("unfuddle_project_id")
13
+ props["errbit.appId"] = props.delete("errbit_app_id") if props.key?("errbit_app_id")
14
+ props["github.repo"] = props.delete("github_repo") if props.key?("github_repo")
15
+ props["git.location"] = props.delete("git_location") if props.key?("git_location")
16
+
17
+ props.keys.each do |old_key|
18
+ next unless dependency_name = old_key[/^key_dependency\.(.*)$/, 1]
19
+ new_key = "keyDependency.#{dependency_name}"
20
+ props[new_key] = props.delete(old_key)
21
+ end
22
+
23
+ project.update_column :props, props
24
+ pbar.inc
25
+ end
26
+ pbar.finish
27
+ end
28
+
29
+ def down
30
+ remove_column :projects, :props
31
+ end
32
+ end