diff --git a/Gemfile b/Gemfile index b992cc501..e8aaec961 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'hashie_rails', '~> 0.0.1' # model related gem 'pg', '~> 0.18.0' gem 'ransack', '~> 1.5.1' # for searching -gem 'paper_trail', '~> 3.0.6' # archiving +gem 'paper_trail', '~> 4.0.0.beta2' # archiving gem 'rails-settings-cached', '~> 0.4.1' # for settings gem 'delayed_job_active_record', '~> 4.0.3' # delayed job @@ -57,6 +57,7 @@ group :development do gem 'spring-commands-rspec', '~> 1.0.2' gem 'guard', '~> 2.6.1' # run tests automatically gem 'guard-rspec', '~> 4.3.1' + gem 'guard-rails', '~> 0.7.0' # run EPP server automatically gem 'rubocop', '~> 0.26.1' gem 'guard-rubocop', '~> 1.1.0' @@ -76,7 +77,7 @@ group :development, :test do gem 'phantomjs-binaries', '~> 1.9.2.4' gem 'poltergeist', '~> 1.5.1' # We are using PhantomJS instead gem 'phantomjs', '~> 1.9.7.1' - gem 'fabrication', '~> 2.11.3' # Replacement for fixtures + gem 'fabrication', '~> 2.12.2' # Replacement for fixtures gem 'shoulda-matchers', '~> 2.6.1', require: false # Additional matchers for RSpec gem 'launchy', '~> 2.4.3' # for opening browser automatically diff --git a/Gemfile.lock b/Gemfile.lock index 6bfc0b07b..0108658db 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -79,7 +79,7 @@ GEM slim (>= 1.3.6, < 3.0) terminal-table (~> 1.4) builder (3.2.2) - bullet (4.14.0) + bullet (4.14.2) activesupport (>= 3.0.0) uniform_notifier (>= 1.6.0) bundler-audit (0.3.1) @@ -134,7 +134,7 @@ GEM equalizer (0.0.9) erubis (2.7.0) execjs (2.2.2) - fabrication (2.11.3) + fabrication (2.12.2) faker (1.3.0) i18n (~> 0.5) fastercsv (1.5.5) @@ -164,6 +164,8 @@ GEM lumberjack (~> 1.0) pry (>= 0.9.12) thor (>= 0.18.1) + guard-rails (0.7.0) + guard (~> 2.0) guard-rspec (4.3.1) guard (~> 2.1) rspec (>= 2.14, < 4.0) @@ -198,14 +200,14 @@ GEM railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (1.8.2) - kaminari (0.16.1) + kaminari (0.16.2) actionpack (>= 3.0.0) activesupport (>= 3.0.0) - kgio (2.9.2) + kgio (2.9.3) launchy (2.4.3) addressable (~> 2.3) libv8 (3.16.14.7) - libxml-ruby (2.7.0) + libxml-ruby (2.8.0) listen (2.8.5) celluloid (>= 0.15.2) rb-fsevent (>= 0.9.3) @@ -230,12 +232,11 @@ GEM nprogress-rails (0.1.6.5) open4 (1.3.4) orm_adapter (0.5.0) - paper_trail (3.0.6) - activerecord (>= 3.0, < 5.0) - activesupport (>= 3.0, < 5.0) - parser (2.2.0.1) + paper_trail (4.0.0.beta2) + activerecord (>= 3.0, < 6.0) + activesupport (>= 3.0, < 6.0) + parser (2.2.0.2) ast (>= 1.1, < 3.0) - slop (~> 3.4, >= 3.4.5) pg (0.18.1) phantomjs (1.9.7.1) phantomjs-binaries (1.9.2.4) @@ -257,7 +258,7 @@ GEM rack (>= 0.4) rack-mount (0.8.3) rack (>= 1.0.0) - rack-test (0.6.2) + rack-test (0.6.3) rack (>= 1.0) railroady (1.3.0) rails (4.2.0) @@ -299,7 +300,6 @@ GEM rb-inotify (0.9.5) ffi (>= 0.5.0) rdoc (4.2.0) - json (~> 1.4) reek (1.3.8) rainbow (>= 1.99, < 3.0) ruby2ruby (>= 2.0.8, < 3.0) @@ -347,7 +347,7 @@ GEM reek (= 1.3.8) ruby2ruby (>= 2.1.1, < 3.0) virtus (~> 1.0) - sass (3.4.9) + sass (3.4.10) sass-rails (5.0.1) railties (>= 4.0.0, < 5.0) sass (~> 3.1) @@ -358,7 +358,7 @@ GEM json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) selectize-rails (0.11.2) - sexp_processor (4.4.4) + sexp_processor (4.4.5) shoulda-matchers (2.6.2) activesupport (>= 3.0.0) simplecov (0.9.1) @@ -379,7 +379,7 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.2.2) + sprockets-rails (2.2.3) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) @@ -445,10 +445,11 @@ DEPENDENCIES devise (~> 3.4.1) epp (~> 1.4.0) epp-xml (~> 0.10.4) - fabrication (~> 2.11.3) + fabrication (~> 2.12.2) faker (~> 1.3.0) grape (~> 0.10.1) guard (~> 2.6.1) + guard-rails (~> 0.7.0) guard-rspec (~> 4.3.1) guard-rubocop (~> 1.1.0) haml-rails (~> 0.6.0) @@ -464,7 +465,7 @@ DEPENDENCIES newrelic_rpm (~> 3.9.9.275) nokogiri (~> 1.6.2.1) nprogress-rails (~> 0.1.6.5) - paper_trail (~> 3.0.6) + paper_trail (~> 4.0.0.beta2) pg (~> 0.18.0) phantomjs (~> 1.9.7.1) phantomjs-binaries (~> 1.9.2.4) diff --git a/Guardfile b/Guardfile index c03e7c426..0d4ca4b62 100644 --- a/Guardfile +++ b/Guardfile @@ -1,4 +1,13 @@ group :red_green_refactor, halt_on_fail: true do + # start test EPP server automatically on port 8989, + # be sure you have apache2 configured to + # accept EPP request on port 701, what proxy to 8989. + # port and environment is just for correct notification, all is overwritten by CLI + guard :rails, port: 8989, environment: 'test', CLI: 'RAILS_ENV=test unicorn -p 8989' do + watch('Gemfile.lock') + watch(%r{^(config|lib)/.*}) + end + guard :rspec, cmd: 'bundle exec rspec', notification: false do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } diff --git a/config/deploy.rb b/config/deploy.rb index 8dd53d3d0..59bc02218 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -112,6 +112,7 @@ task setup: :environment do invoke :'git:clone' invoke :'deploy:link_shared_paths' to :launch do + queue! 'gem install bundler' invoke :'bundle:install' queue %(echo '\n NB! Please edit 'shared/config/database.yml'\n') end diff --git a/db/migrate/20150122091556_create_version_associations.rb b/db/migrate/20150122091556_create_version_associations.rb new file mode 100644 index 000000000..12c8f0647 --- /dev/null +++ b/db/migrate/20150122091556_create_version_associations.rb @@ -0,0 +1,17 @@ +class CreateVersionAssociations < ActiveRecord::Migration + def self.up + create_table :version_associations do |t| + t.integer :version_id + t.string :foreign_key_name, :null => false + t.integer :foreign_key_id + end + add_index :version_associations, [:version_id] + add_index :version_associations, [:foreign_key_name, :foreign_key_id], :name => 'index_version_associations_on_foreign_key' + end + + def self.down + remove_index :version_associations, [:version_id] + remove_index :version_associations, :name => 'index_version_associations_on_foreign_key' + drop_table :version_associations + end +end \ No newline at end of file diff --git a/db/migrate/20150122091557_add_transaction_id_column_to_versions.rb b/db/migrate/20150122091557_add_transaction_id_column_to_versions.rb new file mode 100644 index 000000000..67e0e2208 --- /dev/null +++ b/db/migrate/20150122091557_add_transaction_id_column_to_versions.rb @@ -0,0 +1,11 @@ +class AddTransactionIdColumnToVersions < ActiveRecord::Migration + def self.up + add_column :versions, :transaction_id, :integer + add_index :versions, [:transaction_id] + end + + def self.down + remove_index :versions, [:transaction_id] + remove_column :versions, :transaction_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 36415a165..92cdf145d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150120140346) do +ActiveRecord::Schema.define(version: 20150122091557) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -328,16 +328,27 @@ ActiveRecord::Schema.define(version: 20150120140346) do t.string "roles", array: true end + create_table "version_associations", force: :cascade do |t| + t.integer "version_id" + t.string "foreign_key_name", null: false + t.integer "foreign_key_id" + end + + add_index "version_associations", ["foreign_key_name", "foreign_key_id"], name: "index_version_associations_on_foreign_key", using: :btree + add_index "version_associations", ["version_id"], name: "index_version_associations_on_version_id", using: :btree + create_table "versions", force: :cascade do |t| - t.string "item_type", limit: 255, null: false - t.integer "item_id", null: false - t.string "event", limit: 255, null: false - t.string "whodunnit", limit: 255 + t.string "item_type", limit: 255, null: false + t.integer "item_id", null: false + t.string "event", limit: 255, null: false + t.string "whodunnit", limit: 255 t.text "object" t.datetime "created_at" + t.integer "transaction_id" end add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree + add_index "versions", ["transaction_id"], name: "index_versions_on_transaction_id", using: :btree create_table "zonefile_settings", force: :cascade do |t| t.string "origin", limit: 255