diff --git a/.gitignore b/.gitignore index 445beaab..fa176e84 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .bundle .yardoc node_modules -doc/fdoc-html tmp/cache/* diff --git a/.rspec b/.rspec index 62c58f04..43ae2036 100644 --- a/.rspec +++ b/.rspec @@ -1 +1,3 @@ --cfs +--color +--require spec_helper +--format documentation diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 00000000..0ca3a58d --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +squash diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..276cbf9e --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.3.0 diff --git a/.rvmrc b/.rvmrc deleted file mode 100644 index 27517c2a..00000000 --- a/.rvmrc +++ /dev/null @@ -1 +0,0 @@ -rvm 1.9.3@squash --create diff --git a/Gemfile b/Gemfile index 66653d80..0fa8cf6e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,80 +1,7 @@ source 'https://rubygems.org' -ruby "1.9.3" +# Load all files under the Gemfile.d directory. -# FRAMEWORK -gem 'rails', git: 'git://github.com/rails/rails.git', branch: '3-2-stable' -# We need to use this branch of Rails because it includes fixes for ActiveRecord -# and concurrency that we need for our thread-spawning background job paradigm -# to work -gem 'configoro' -gem 'rack-cors', require: 'rack/cors' - -# MODELS -gem 'pg', platform: :mri -# Version 1.2.6 introduces a bug relating to SQL binds -gem 'activerecord-jdbc-adapter', '1.2.5', platform: :jruby -gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby -gem 'has_metadata_column', git: 'git://github.com/RISCfuture/has_metadata_column.git' -gem 'slugalicious' -gem 'email_validation' -gem 'url_validation' -gem 'json_serialize' -gem 'validates_timeliness' -gem 'find_or_create_on_scopes', '>= 1.2.1' -gem 'composite_primary_keys', git: 'git://github.com/RISCfuture/composite_primary_keys.git' -gem 'activerecord-postgresql-cursors' - -# VIEWS -gem 'erector' -gem 'jquery-rails' -gem 'kramdown' - -# UTILITIES -gem 'json' -gem 'git', git: 'git://github.com/RISCfuture/ruby-git.git' -gem 'user-agent' - -# AUTH -gem 'net-ldap', require: 'net/ldap' - -# INTEGRATION -gem 'jira-ruby', require: 'jira' - -# DOGFOOD -gem 'squash_ruby', require: 'squash/ruby' -gem 'squash_rails', require: 'squash/rails' -gem 'squash_ios_symbolicator', require: 'squash/symbolicator' -gem 'squash_javascript', require: 'squash/javascript' -gem 'squash_java', require: 'squash/java' - -group :assets do - gem 'sass-rails' - gem 'libv8', '~> 3.11.8', platform: :mri - gem 'therubyracer', '>= 0.11.1', platform: :mri - # Version 2.0 of TheRubyRhino breaks asset compilation - gem 'therubyrhino', '< 2.0', platform: :jruby - gem 'less-rails' - - gem 'coffee-rails' - gem 'uglifier' - - gem 'font-awesome-rails' -end - -group :development do - # DOCS - gem 'yard', require: nil - gem 'redcarpet', require: nil, platform: :mri - gem 'fdoc' +Dir.glob(File.join(File.dirname(__FILE__), 'Gemfile.d', '*.rb')).sort.each do |file| + eval File.read(file), binding, file end - - -group :test do - # SPECS - gem 'rspec-rails' - gem 'factory_girl_rails' - gem 'fakeweb' -end - -gem 'sql_origin', groups: [:development, :test] diff --git a/Gemfile.d/_before.rb b/Gemfile.d/_before.rb new file mode 100644 index 00000000..28e26877 --- /dev/null +++ b/Gemfile.d/_before.rb @@ -0,0 +1,45 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Load our frozen Configoro +require File.join(File.dirname(__FILE__), '..', 'vendor', 'configoro', 'simple') + +rails_root = ENV['RAILS_ROOT'] || File.join(File.dirname(__FILE__), '..') +Configoro.paths << File.join(rails_root, 'config', 'environments') + +$_squash_environments = Dir.glob(File.join(rails_root, 'config', 'environments', '*.rb')).map { |f| File.basename f, '.rb' } + +def load_groups(configuration_path, values) + configuration_path = configuration_path.split('.') + + $_squash_environments.select do |env| + settings = Configoro.load_environment(env) + values.include?(traverse_hash(settings, *configuration_path)) + end +end + +def traverse_hash(hsh, *keys) + return nil unless hsh + + if keys.size == 1 + hsh[keys.first] + else + traverse_hash hsh[keys.shift], *keys + end +end + +def conditionally(configuration_path, *values, &block) + groups = load_groups(configuration_path, values) + groups.each { |g| group g.to_sym, &block } +end diff --git a/script/rails b/Gemfile.d/assets.rb old mode 100755 new mode 100644 similarity index 64% rename from script/rails rename to Gemfile.d/assets.rb index 6469b1c8..4a887aad --- a/script/rails +++ b/Gemfile.d/assets.rb @@ -1,6 +1,4 @@ -#!/usr/bin/env ruby - -# Copyright 2012 Square Inc. +# Copyright 2014 Square Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. +gem 'sass-rails' +gem 'sprockets' # fix nil error +gem 'libv8', platform: :mri +gem 'therubyracer', platform: :mri +gem 'therubyrhino', platform: :jruby +gem 'less-rails' + +gem 'font-awesome-rails' -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) -require 'rails/commands' +gem 'coffee-rails' +gem 'closure-compiler' +gem 'jquery-rails' diff --git a/Gemfile.d/authentication.rb b/Gemfile.d/authentication.rb new file mode 100644 index 00000000..644fdd92 --- /dev/null +++ b/Gemfile.d/authentication.rb @@ -0,0 +1,17 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +conditionally('authentication.strategy', 'ldap') do + gem 'net-ldap', github: 'ruby-ldap/ruby-net-ldap', require: 'net/ldap' +end diff --git a/Gemfile.d/concurrency.rb b/Gemfile.d/concurrency.rb new file mode 100644 index 00000000..be2e2a0b --- /dev/null +++ b/Gemfile.d/concurrency.rb @@ -0,0 +1,27 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +conditionally('concurrency.background_runner', 'Resque') do + gem 'resque' + gem 'resque-pool' +end + +conditionally('concurrency.background_runner', 'Sidekiq') do + gem 'sidekiq' + gem 'capistrano-sidekiq' + + # disable if you don't need Sidekiq monitoring + gem 'slim' + gem 'sinatra' +end diff --git a/Gemfile.d/development.rb b/Gemfile.d/development.rb new file mode 100644 index 00000000..d2a7b2c2 --- /dev/null +++ b/Gemfile.d/development.rb @@ -0,0 +1,20 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +group :development do + gem 'yard', require: nil + gem 'redcarpet', require: nil, platform: :mri +end + +gem 'sql_origin', groups: [:development, :test] diff --git a/Gemfile.d/dogfood.rb b/Gemfile.d/dogfood.rb new file mode 100644 index 00000000..d128da95 --- /dev/null +++ b/Gemfile.d/dogfood.rb @@ -0,0 +1,20 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +gem 'squash_ruby', require: 'squash/ruby' +gem 'squash_rails', require: 'squash/rails' +gem 'squash_ios_symbolicator', require: 'squash/symbolicator' +gem 'squash_javascript', require: 'squash/javascript' +gem 'sourcemap' +gem 'squash_java', require: 'squash/java' diff --git a/Gemfile.d/framework.rb b/Gemfile.d/framework.rb new file mode 100644 index 00000000..9604117f --- /dev/null +++ b/Gemfile.d/framework.rb @@ -0,0 +1,20 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +gem 'rails', '4.2.5.2' +gem 'responders' +gem 'psych' # fix TypeError: superclass mismatch for class Mark + +gem 'configoro' +gem 'rack-cors', require: 'rack/cors' diff --git a/Gemfile.d/integration.rb b/Gemfile.d/integration.rb new file mode 100644 index 00000000..5ccfc225 --- /dev/null +++ b/Gemfile.d/integration.rb @@ -0,0 +1,17 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +conditionally('jira.disabled', false, nil) do + gem 'jira-ruby', require: 'jira' +end diff --git a/Gemfile.d/mail.rb b/Gemfile.d/mail.rb new file mode 100644 index 00000000..c820a8de --- /dev/null +++ b/Gemfile.d/mail.rb @@ -0,0 +1,18 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +conditionally('mailer.smtp_settings.authentication', 'ntlm') do + gem 'ruby-ntlm', require: 'ntlm/smtp' +end + diff --git a/Gemfile.d/models.rb b/Gemfile.d/models.rb new file mode 100644 index 00000000..babce78d --- /dev/null +++ b/Gemfile.d/models.rb @@ -0,0 +1,29 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +gem 'pg', platform: :mri +gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby +gem 'has_metadata_column' +gem 'slugalicious' +gem 'email_validation' +gem 'url_validation' +gem 'json_serialize' +gem 'validates_timeliness' +gem 'find_or_create_on_scopes' +gem 'composite_primary_keys' +gem 'rails-observers' + +conditionally('activerecord.cursors', true) do + gem 'activerecord-postgresql-cursors' +end diff --git a/Gemfile.d/specs.rb b/Gemfile.d/specs.rb new file mode 100644 index 00000000..0d9e465e --- /dev/null +++ b/Gemfile.d/specs.rb @@ -0,0 +1,20 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +group :test do + gem 'rspec-rails' + gem 'factory_girl_rails' + + gem 'fakeweb' +end diff --git a/Gemfile.d/utilities.rb b/Gemfile.d/utilities.rb new file mode 100644 index 00000000..83a3020d --- /dev/null +++ b/Gemfile.d/utilities.rb @@ -0,0 +1,19 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +gem 'json' +gem 'git', github: 'RISCfuture/ruby-git' +gem 'user-agent' + +gem 'safe_yaml' diff --git a/Gemfile.d/views.rb b/Gemfile.d/views.rb new file mode 100644 index 00000000..46a4abba --- /dev/null +++ b/Gemfile.d/views.rb @@ -0,0 +1,16 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +gem 'erector', github: 'RISCfuture/erector' +gem 'kramdown' diff --git a/Gemfile.d/~after.rb b/Gemfile.d/~after.rb new file mode 100644 index 00000000..e46588b8 --- /dev/null +++ b/Gemfile.d/~after.rb @@ -0,0 +1,17 @@ +# Copyright 2014 Square Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if defined?(Configoro) + Configoro.reset_paths # reset configoro +end diff --git a/Gemfile.lock b/Gemfile.lock index b2286667..2b221b84 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,199 +1,204 @@ GIT - remote: git://github.com/RISCfuture/composite_primary_keys.git - revision: 4f624f3a431b5ad3fa2d80e58b118896c356dffe + remote: git://github.com/RISCfuture/erector.git + revision: d741e01ba7f16fef30abfa424cc72d2b2b4758e2 specs: - composite_primary_keys (5.0.12) - activerecord (~> 3.2.0, >= 3.2.9) - -GIT - remote: git://github.com/RISCfuture/has_metadata_column.git - revision: 2aebf034ab97365cfbf56073c24c3a28fe2dc4ae - specs: - has_metadata_column (1.0.3) - boolean - rails (>= 3.0) + erector (0.9.0) + treetop (>= 1.2.3) GIT remote: git://github.com/RISCfuture/ruby-git.git - revision: c4c3e3b9b956918e03c210ff24c0a955e5f13635 + revision: 88076a50eb70fd96f2417b646fe37fb2f6c4cca4 specs: - git (1.2.5) - -GIT - remote: git://github.com/rails/rails.git - revision: 2c8f34995378e4a18711cf5f947e8465227d3748 - branch: 3-2-stable - specs: - actionmailer (3.2.13) - actionpack (= 3.2.13) - mail (~> 2.5.3) - actionpack (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - activerecord (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - activesupport (3.2.13) - i18n (~> 0.6, >= 0.6.4) - multi_json (~> 1.0) - rails (3.2.13) - actionmailer (= 3.2.13) - actionpack (= 3.2.13) - activerecord (= 3.2.13) - activeresource (= 3.2.13) - activesupport (= 3.2.13) - bundler (~> 1.0) - railties (= 3.2.13) - railties (3.2.13) - actionpack (= 3.2.13) - activesupport (= 3.2.13) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) + git (1.2.6) GEM remote: https://rubygems.org/ specs: - activerecord-jdbc-adapter (1.2.5) - activerecord-jdbcpostgresql-adapter (1.2.5) - activerecord-jdbc-adapter (~> 1.2.5) - jdbc-postgres (>= 9.1, < 9.3) - activerecord-postgresql-cursors (0.0.2) - addressable (2.3.3) - arel (3.0.2) + actionmailer (4.2.5.2) + actionpack (= 4.2.5.2) + actionview (= 4.2.5.2) + activejob (= 4.2.5.2) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.5.2) + actionview (= 4.2.5.2) + activesupport (= 4.2.5.2) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.5.2) + activesupport (= 4.2.5.2) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.5.2) + activesupport (= 4.2.5.2) + globalid (>= 0.3.0) + activemodel (4.2.5.2) + activesupport (= 4.2.5.2) + builder (~> 3.1) + activerecord (4.2.5.2) + activemodel (= 4.2.5.2) + activesupport (= 4.2.5.2) + arel (~> 6.0) + activesupport (4.2.5.2) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.4.0) + arel (6.0.3) boolean (1.0.1) - builder (3.0.4) - coffee-rails (3.2.2) + builder (3.2.2) + closure-compiler (1.1.12) + coffee-rails (4.1.1) coffee-script (>= 2.2.0) - railties (~> 3.2.0) - coffee-script (2.2.0) + railties (>= 4.0.0, < 5.1.x) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.6.2) - commonjs (0.2.6) - configoro (1.1.0) - rails (>= 3.0) - diff-lcs (1.2.1) - email_validation (1.1.1) + coffee-script-source (1.10.0) + commonjs (0.2.7) + composite_primary_keys (8.1.2) + activerecord (~> 4.2.0) + concurrent-ruby (1.0.1) + configoro (1.4.0) + activesupport + diff-lcs (1.2.5) + email_validation (1.2.0) localized_each_validator (>= 1.0.1) - erector (0.9.0) - treetop (>= 1.2.3) erubis (2.7.0) - execjs (1.4.0) - multi_json (~> 1.0) - factory_girl (4.2.0) + execjs (2.6.0) + factory_girl (4.5.0) activesupport (>= 3.0.0) - factory_girl_rails (4.2.1) - factory_girl (~> 4.2.0) + factory_girl_rails (4.6.0) + factory_girl (~> 4.5.0) railties (>= 3.0.0) fakeweb (1.3.0) - fdoc (0.2.7) - json - json-schema (>= 1.0.1) - kramdown - find_or_create_on_scopes (1.3.0) + find_or_create_on_scopes (1.4.1) activerecord (>= 3.1) - font-awesome-rails (3.0.2.0) - railties (>= 3.1) - hike (1.2.1) - httpi (2.0.2) + font-awesome-rails (4.5.0.1) + railties (>= 3.2, < 5.1) + globalid (0.3.6) + activesupport (>= 4.1.0) + has_metadata_column (1.1.5) + boolean + rails (>= 4.2) + httpi (2.4.1) rack - i18n (0.6.4) - jdbc-postgres (9.2.1002.1) - jira-ruby (0.1.2) - activesupport - oauth - railties - journey (1.0.4) - jquery-rails (2.2.1) - railties (>= 3.0, < 5.0) + i18n (0.7.0) + jquery-rails (4.1.0) + rails-dom-testing (~> 1.0) + railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (1.7.7) - json (1.7.7-java) - json-schema (1.1.1) - json_serialize (2.2.1) + json (1.8.3) + json_serialize (2.2.2) activerecord (>= 3.0) activesupport (>= 3.0) - kramdown (1.0.1) - less (2.3.1) - commonjs (~> 0.2.6) - less-rails (2.3.2) - actionpack (>= 3.1) - less (~> 2.3.1) - libv8 (3.11.8.13) - localized_each_validator (1.0.1) - activerecord (>= 3.0) + kramdown (1.9.0) + less (2.6.0) + commonjs (~> 0.2.7) + less-rails (2.7.1) + actionpack (>= 4.0) + less (~> 2.6.0) + sprockets (> 2, < 4) + tilt + libv8 (3.16.14.13) + localized_each_validator (1.0.3) + activemodel (>= 3.0) activesupport (>= 3.0) - mail (2.5.3) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.21) - multi_json (1.7.1) - net-ldap (0.3.1) - oauth (0.4.7) - pg (0.14.1) - plist (3.1.0) - polyglot (0.3.3) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-cors (0.2.7) - rack - rack-ssl (1.3.3) - rack - rack-test (0.6.2) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + mime-types (2.99.1) + mini_portile2 (2.0.0) + minitest (5.8.4) + nokogiri (1.6.7.2) + mini_portile2 (~> 2.0.0.rc2) + pg (0.18.4) + plist (3.2.0) + polyglot (0.3.5) + psych (2.0.17) + rack (1.6.4) + rack-cors (0.4.0) + rack-test (0.6.3) rack (>= 1.0) - rake (10.0.3) - rdoc (3.12.2) - json (~> 1.4) - redcarpet (2.2.2) - ref (1.0.4) - rspec-core (2.13.1) - rspec-expectations (2.13.0) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.13.0) - rspec-rails (2.13.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 2.13.0) - rspec-expectations (~> 2.13.0) - rspec-mocks (~> 2.13.0) - sass (3.2.7) - sass-rails (3.2.6) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) + rails (4.2.5.2) + actionmailer (= 4.2.5.2) + actionpack (= 4.2.5.2) + actionview (= 4.2.5.2) + activejob (= 4.2.5.2) + activemodel (= 4.2.5.2) + activerecord (= 4.2.5.2) + activesupport (= 4.2.5.2) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.5.2) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.7) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) + rails-observers (0.1.2) + activemodel (~> 4.0) + railties (4.2.5.2) + actionpack (= 4.2.5.2) + activesupport (= 4.2.5.2) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (10.5.0) + redcarpet (3.3.4) + ref (2.0.0) + responders (2.1.1) + railties (>= 4.2.0, < 5.1) + rspec-core (3.4.3) + rspec-support (~> 3.4.0) + rspec-expectations (3.4.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-mocks (3.4.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-rails (3.4.2) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) + rspec-core (~> 3.4.0) + rspec-expectations (~> 3.4.0) + rspec-mocks (~> 3.4.0) + rspec-support (~> 3.4.0) + rspec-support (3.4.1) + safe_yaml (1.0.4) + sass (3.4.21) + sass-rails (5.0.4) + railties (>= 4.0.0, < 5.0) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) serialbox (1.0.0) activesupport json - slugalicious (2.0.0) - rails (>= 3.1) + slugalicious (2.1.0) + rails (>= 4.0) stringex - sprockets (2.2.2) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sql_origin (1.0.2) - rails (~> 3.2) + sourcemap (0.1.1) + sprockets (3.5.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.0.3) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sql_origin (1.1.2) + rails (>= 4.0) squash_ios_symbolicator (1.1.1) plist serialbox @@ -201,86 +206,89 @@ GEM squash_java (1.0.3) json squash_uploader (>= 1.0.1) - squash_javascript (1.0.2) + squash_javascript (2.0.9) + coffee-rails json railties (>= 3.1) + sourcemap + sprockets-rails (>= 3.0) squash_uploader - squash_rails (1.1.0) + squash_rails (1.3.4) squash_ruby - squash_ruby (1.1.1) + squash_ruby (2.0.0) json squash_uploader (1.0.1) json - stringex (1.5.1) - therubyracer (0.11.4) - libv8 (~> 3.11.8.12) + stringex (2.6.0) + therubyracer (0.12.2) + libv8 (~> 3.16.14.0) ref - therubyrhino (1.73.5) - thor (0.17.0) - tilt (1.3.6) - timeliness (0.3.7) - treetop (1.4.12) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.37) - uglifier (1.3.0) - execjs (>= 0.3.0) - multi_json (~> 1.0, >= 1.0.2) - url_validation (1.0.0) + thor (0.19.1) + thread_safe (0.3.5) + tilt (2.0.2) + timeliness (0.3.8) + treetop (1.6.5) + polyglot (~> 0.3) + tzinfo (1.2.2) + thread_safe (~> 0.1) + url_validation (1.1.0) activerecord activesupport addressable httpi user-agent (1.0.0) - validates_timeliness (3.0.14) - timeliness (~> 0.3.6) - yard (0.8.5.2) + validates_timeliness (4.0.2) + timeliness (~> 0.3.7) + yard (0.8.7.6) PLATFORMS - java ruby DEPENDENCIES - activerecord-jdbc-adapter (= 1.2.5) activerecord-jdbcpostgresql-adapter - activerecord-postgresql-cursors + closure-compiler coffee-rails - composite_primary_keys! + composite_primary_keys configoro email_validation - erector + erector! factory_girl_rails fakeweb - fdoc - find_or_create_on_scopes (>= 1.2.1) + find_or_create_on_scopes font-awesome-rails git! - has_metadata_column! - jira-ruby + has_metadata_column jquery-rails json json_serialize kramdown less-rails - libv8 (~> 3.11.8) - net-ldap + libv8 pg + psych rack-cors - rails! + rails (= 4.2.5.2) + rails-observers redcarpet + responders rspec-rails + safe_yaml sass-rails slugalicious + sourcemap + sprockets sql_origin squash_ios_symbolicator squash_java squash_javascript squash_rails squash_ruby - therubyracer (>= 0.11.1) - therubyrhino (< 2.0) - uglifier + therubyracer + therubyrhino url_validation user-agent validates_timeliness yard + +BUNDLED WITH + 1.11.2 diff --git a/LICENSE.txt b/LICENSE.txt index 6e5be056..e18b191e 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2012 Square Inc. + Copyright 2014 Square Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md deleted file mode 120000 index 1df17956..00000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -doc/README_FOR_APP.md \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..43c0191b --- /dev/null +++ b/README.md @@ -0,0 +1,466 @@ +Squash: A squarish bug spray +============================ + +**An open-source project from [Square](http://github.com/square)** + +Squash is a collection of tools that help engineers find and kill bugs in their +code by automatically collecting, collating and analyzing run time exceptions. +Squash consists of the following components: + +* **Client libraries:** Client libraries for different systems (Ruby, Ruby on + Rails, Cocoa with Objective-C, etc.) catch and record errors when they occur, + then send them to the API endpoint. Client libraries can be found under the + [SquareSquash organization](https://github.com/SquareSquash). +* **Front-end:** This website displays Bug information and helps the engineer + find the root cause for a Bug, and fix it. It also lets engineers manage, + assign, and comment on Bugs, as well as view statistics about the Bug. +* **API endpoints:** These routes (part of the front-end app) receive exception + notifications from the client libraries and process them. + +This project is the front-end and the API. + +Pull requests are more than welcome; please check out +[CONTRIBUTING.md](file.CONTRIBUTING.html) for details. + +How to Install +-------------- + +To get started, run the `bin/setup` file. This script will ask you a series of +questions and generate a preliminary configuration for your site install. When +the script is completed, you can run `git status` to see what files it changed, +and refine your configuration from there. + +Once the script is complete, Squash should run for most typical development +environments. Simply run `rails s` and visit the site in your Web browser. You +should be able to start using it immediately. You can also verify correctness by +running `rspec spec`. + +Configuring and deploying the production instance is entirely up to you and your +particular production environment. + +Additional configuration options can be found in the following locations: + +* `config/application.rb` +* `config/environments/*.rb` +* `config/environments/*/*.yml` + +If you don't see what you're looking for in any of those files, you'll probably +have to change the code to make it work. Don't be afraid -- the code is +thoroughly documented and should (hopefully) be very accessible. + +### Requirements + +Squash requires the following: + +* Ruby 1.9.2 or newer (JRuby with `--1.9` is supported) +* Multithreading support (see the next section) +* PostgreSQL 9.1 or newer +* The Bundler gem +* Git 1.7 or newer + +### Notes on some of the gem and library choices + +**Why do you specifically require PostgreSQL?** Squash uses a lot of +PostgreSQL-specific features to make efficient use of the database and maintain +referential integrity, such as: + +* foreign key constraints, +* triggered cached counters, +* check constraints, and +* semantic indexes for text-based search. + +If PostgreSQL is out of the question, some of these features can be ported to +other RDBMSes; simply edit the `InitialSchema` migration and update the SQL as +necessary. If portability is required, a lot of these features can be +reimplemented in the Rails layer (e.g., cached counters), at the risk of +degraded referential integrity. (If you are reimplementing the cached counters +in Ruby, be sure to modify the `config/initializers/active_record.rb` file as +appropriate.) + +If you do successfully port Squash to another RDBMS, let me know. I'd be happy +to take your changes. + +**Why do you bundle an edge version of Rails?** The `3-2-stable` branch of Ruby +on Rails includes some changes to Active Record that are required by Squash's +multithreaded concurrency model (see next question). In particular, that version +of Active Record includes crucial changes to the connection pool and connection +reopening logic. If you set the `background_runner` option in the +`concurrency.yml` file to something other than `Multithread`, the Gemfile will +automatically drop Rails back down to the latest release version. + +**Why don't you use my favorite backgrounding library?** Squash was originally +built for Square, which runs all its services on JRuby. Using threads is very +efficient in JRuby, and avoids the overhead of having to deploy both a website +and workers. + +If you are running Squash in a non-thread-safe (or multithreading-unfriendly) +environment, you can use Sidekiq or Resque instead. If you want to use some +other backgrounding library, you can easily write your own adapter. All threaded +code is invoked using {BackgroundRunner.run}, which then uses the settings in +the `concurrency.yml` Configoro file to invoke the correct module under +`lib/background_runner`. The default is to use {BackgroundRunner::Multithread}, +which uses the {Multithread} module to execute the task in its own thread. You +can edit the YAML file and switch the background runner to Resque, or implement +your own `BackgroundRunner` module. See the {BackgroundRunner} documentation for +more details. + +If you do this successfully and wish to save future Squash users the effort, +feel free to turn your changes into a pull request. + +**Why aren't you using RedCarpet?** As mentioned above, Squash was originally +built to run under JRuby. RedCarpet has compiled C extensions; Kramdown is pure +Ruby. + +**Why do you require a recent version of Git?** Squash uses the +`git clone --mirror` command to create local mirrors of client projects' Git +repositories. + +**Why don't you have integration tests or acceptance tests?** To be 100% honest, +lack of familiarity on these things in Ruby/Rails. Happy for any help people +want to extend towards this goal. + +**Why are you using Erector?** I like Erector. + +Documentation +------------- + +Comprehensive documentation is written in YARD- and Markdown-formatted comments +throughout the source. To view this documentation as an HTML site, run +`rake yard`. + +CoffeeScript libraries are documented using the YARD format as well, but YARD +does not as yet recognize them as documentable files. A `.codoopts` file is +included in case you wish to use [Codo](https://github.com/netzpirat/codo) to +generate the CoffeeScript docs, but as of now Codo does not recognize the ERb +files, and does not use the full set of Markdown syntax features used in the +documentation. + +Project Overview +---------------- + +### Views + +This is a pretty typical Rails website, save for the views, which are written +using Erector. The views forgo the traditional Rails concepts of partials and +templates in favor of analogous OOP concepts more familiar to software +developers: methods and inheritance. All views inherit from an abstract Erector +widget which provides layout; and all views have their content split into +multiple private methods. + +In addition to the usual helpers (in `app/helpers`), there are view mixins under +`app/views/additions` that simplify view coding. + +Embedded code snippets are all rendered using the {CommitsController#context} +action. This action loads the appropriate file and revision from the Git +repository and returns a snippet plus the name of the SyntaxHighlighter brush to +use. The brush is determined from the file name/extension; the mapping can be +found in `data/brushes.yml`. + +This view behavior is provided from a JavaScript library file in +`lib/assets/javascripts`. There are many similar helper classes in there; they +are documented but the documentation is not recognized by YARD and so is not +included in this documentation set. + +JavaScript files are organized into four possible locations: + +* Third-party JavaScript libraries are in `vendor/assets/javascripts` and + loaded in the `application.js` manifest. +* JavaScript modules or helpers that are not specific to a particular page or + site area are in `lib/assets/javascripts` and also loaded in `application.js`. +* JavaScript modules or helpers specific to a particular area of the site are in + `app/assets/javascripts` and also loaded in `application.js`. +* Small JavaScript snippets, glue code, or other code intended to add dynamic + behavior to a specific page is in a `.js` file named the same as, and placed + alongside, the `.html.rb` view file. For example, if + `app/views/projects/new.html.rb` needed a bit of JS glue code, it would be + placed in `app/views/projects/new.js`. This code is placed in a `