diff --git a/Gemfile.lock b/Gemfile.lock index 422f0c14..dfb86192 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,62 +11,62 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (6.1.3) - actionpack (= 6.1.3) - activesupport (= 6.1.3) + actioncable (6.1.3.1) + actionpack (= 6.1.3.1) + activesupport (= 6.1.3.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.3) - actionpack (= 6.1.3) - activejob (= 6.1.3) - activerecord (= 6.1.3) - activestorage (= 6.1.3) - activesupport (= 6.1.3) + actionmailbox (6.1.3.1) + actionpack (= 6.1.3.1) + activejob (= 6.1.3.1) + activerecord (= 6.1.3.1) + activestorage (= 6.1.3.1) + activesupport (= 6.1.3.1) mail (>= 2.7.1) - actionmailer (6.1.3) - actionpack (= 6.1.3) - actionview (= 6.1.3) - activejob (= 6.1.3) - activesupport (= 6.1.3) + actionmailer (6.1.3.1) + actionpack (= 6.1.3.1) + actionview (= 6.1.3.1) + activejob (= 6.1.3.1) + activesupport (= 6.1.3.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.3) - actionview (= 6.1.3) - activesupport (= 6.1.3) + actionpack (6.1.3.1) + actionview (= 6.1.3.1) + activesupport (= 6.1.3.1) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.3) - actionpack (= 6.1.3) - activerecord (= 6.1.3) - activestorage (= 6.1.3) - activesupport (= 6.1.3) + actiontext (6.1.3.1) + actionpack (= 6.1.3.1) + activerecord (= 6.1.3.1) + activestorage (= 6.1.3.1) + activesupport (= 6.1.3.1) nokogiri (>= 1.8.5) - actionview (6.1.3) - activesupport (= 6.1.3) + actionview (6.1.3.1) + activesupport (= 6.1.3.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.3) - activesupport (= 6.1.3) + activejob (6.1.3.1) + activesupport (= 6.1.3.1) globalid (>= 0.3.6) - activemodel (6.1.3) - activesupport (= 6.1.3) - activerecord (6.1.3) - activemodel (= 6.1.3) - activesupport (= 6.1.3) + activemodel (6.1.3.1) + activesupport (= 6.1.3.1) + activerecord (6.1.3.1) + activemodel (= 6.1.3.1) + activesupport (= 6.1.3.1) activerecord-import (1.0.8) activerecord (>= 3.2) - activestorage (6.1.3) - actionpack (= 6.1.3) - activejob (= 6.1.3) - activerecord (= 6.1.3) - activesupport (= 6.1.3) - marcel (~> 0.3.1) - mimemagic (~> 0.3.2) - activesupport (6.1.3) + activestorage (6.1.3.1) + actionpack (= 6.1.3.1) + activejob (= 6.1.3.1) + activerecord (= 6.1.3.1) + activesupport (= 6.1.3.1) + marcel (~> 1.0.0) + mini_mime (~> 1.0.2) + activesupport (6.1.3.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -85,14 +85,15 @@ GEM concurrent-ruby (= 1.1.8) crass (1.0.6) database_cleaner (1.99.0) - ddtrace (0.46.0) + ddtrace (0.48.0) + ffi (~> 1.0) msgpack diff-lcs (1.4.4) digest-crc (0.6.3) rake (>= 12.0.0, < 14.0.0) dogstatsd-ruby (4.8.3) erubi (1.10.0) - excon (0.79.0) + excon (0.80.1) exponential-backoff (0.0.4) ffi (1.15.0) fig_tree (0.0.2) @@ -117,26 +118,24 @@ GEM guard-rubocop (1.4.0) guard (~> 2.0) rubocop (< 2.0) - i18n (1.8.9) + i18n (1.8.10) concurrent-ruby (~> 1.0) - listen (3.4.1) + listen (3.5.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) little-plugger (1.1.4) logging (2.3.0) little-plugger (~> 1.1) multi_json (~> 1.14) - loofah (2.9.0) + loofah (2.9.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) mail (2.7.1) mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) + marcel (1.0.1) method_source (1.0.0) - mimemagic (0.3.5) - mini_mime (1.0.2) + mini_mime (1.0.3) mini_portile2 (2.5.0) minitest (5.14.4) msgpack (1.4.2) @@ -144,14 +143,14 @@ GEM mysql2 (0.5.3) nenv (0.3.0) nio4r (2.5.7) - nokogiri (1.11.1) + nokogiri (1.11.3) mini_portile2 (~> 2.5.0) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) parallel (1.20.1) - parser (3.0.0.0) + parser (3.0.1.0) ast (~> 2.4.1) pg (1.2.3) phobos (2.0.2) @@ -162,36 +161,36 @@ GEM logging ruby-kafka thor - pry (0.14.0) + pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) racc (1.5.2) rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.1.3) - actioncable (= 6.1.3) - actionmailbox (= 6.1.3) - actionmailer (= 6.1.3) - actionpack (= 6.1.3) - actiontext (= 6.1.3) - actionview (= 6.1.3) - activejob (= 6.1.3) - activemodel (= 6.1.3) - activerecord (= 6.1.3) - activestorage (= 6.1.3) - activesupport (= 6.1.3) + rails (6.1.3.1) + actioncable (= 6.1.3.1) + actionmailbox (= 6.1.3.1) + actionmailer (= 6.1.3.1) + actionpack (= 6.1.3.1) + actiontext (= 6.1.3.1) + actionview (= 6.1.3.1) + activejob (= 6.1.3.1) + activemodel (= 6.1.3.1) + activerecord (= 6.1.3.1) + activestorage (= 6.1.3.1) + activesupport (= 6.1.3.1) bundler (>= 1.15.0) - railties (= 6.1.3) + railties (= 6.1.3.1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - railties (6.1.3) - actionpack (= 6.1.3) - activesupport (= 6.1.3) + railties (6.1.3.1) + actionpack (= 6.1.3.1) + activesupport (= 6.1.3.1) method_source rake (>= 0.8.7) thor (~> 1.0) @@ -201,7 +200,7 @@ GEM rb-inotify (0.10.1) ffi (~> 1.0) regexp_parser (2.1.1) - rexml (3.2.4) + rexml (3.2.5) rspec (3.10.0) rspec-core (~> 3.10.0) rspec-expectations (~> 3.10.0) @@ -214,7 +213,7 @@ GEM rspec-mocks (3.10.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.10.0) - rspec-rails (4.1.1) + rspec-rails (4.1.2) actionpack (>= 4.2) activesupport (>= 4.2) railties (>= 4.2) diff --git a/lib/generators/deimos/active_record_generator.rb b/lib/generators/deimos/active_record_generator.rb index cc3dba03..66444668 100644 --- a/lib/generators/deimos/active_record_generator.rb +++ b/lib/generators/deimos/active_record_generator.rb @@ -73,6 +73,37 @@ def fields def generate migration_template('migration.rb', "db/migrate/create_#{table_name.underscore}.rb") template('model.rb', "app/models/#{table_name.underscore}.rb") + say("\n") + say( + "Migration and model added! To consume this data, add the following class to your Kafka folder:", + :green) + say("\n") + say(<<-RUBY, :blue) + class #{table_name.classify}Consumer < Deimos::ActiveRecordConsumer + # can override this to make changes to the hash that is passed to the record + def generate_payload(attrs, class) + super + end + end +RUBY + say("\n") + say("...and add the following to your Deimos configuration:") + say("\n") + say(<<-RUBY, :blue) + Deimos.configure do + + ... + + consumer do + class_name '#{table_name.classify}Consumer' + namespace '#{namespace}' + schema '#{schema}' + group_id 'my_app_#{table_name}' # replace with name of the app + topic "NewTopicName" # replace with name of the topic + key_config none: true # change this if using a key schema or field + end + end + RUBY end end end