From c18a6cbd8799bf4afed0773258cca7fbe7624474 Mon Sep 17 00:00:00 2001 From: Jonathan Loos Date: Wed, 15 Nov 2023 21:43:44 -0500 Subject: [PATCH 1/5] feat: add chartkick dependency --- README.md | 2 +- matey.gemspec | 1 + spec/sample/Gemfile | 3 +++ spec/sample/Gemfile.lock | 3 +++ spec/sample/app/javascript/application.js | 4 +++- spec/sample/config/application.rb | 2 +- spec/sample/config/importmap.rb | 2 ++ 7 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3106d8c..648f707 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ bundle install --gemfile spec/sample/Gemfile # run test cases and ensure everything is passing rake spec -# an interactive prompt that will allow you to experiment with matey (currently broken!) +# an interactive prompt that will allow you to experiment with matey bin/console ``` diff --git a/matey.gemspec b/matey.gemspec index f2687a6..8d95531 100644 --- a/matey.gemspec +++ b/matey.gemspec @@ -37,6 +37,7 @@ Gem::Specification.new do |spec| spec.add_dependency "view_component", "~> 2.74" spec.add_dependency "ahoy_matey", "~> 4.0" spec.add_dependency "groupdate", "~> 6.4.0" + spec.add_dependency "chartkick", "~>5.0.4" spec.add_development_dependency "rspec-rails", "~> 5.0" spec.add_development_dependency "factory_bot_rails", "~> 6.0" diff --git a/spec/sample/Gemfile b/spec/sample/Gemfile index 31abc67..9b6f3fd 100644 --- a/spec/sample/Gemfile +++ b/spec/sample/Gemfile @@ -44,6 +44,9 @@ gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ] # Reduces boot times through caching; required in config/boot.rb gem "bootsnap", require: false +# include charting styles +gem "chartkick", "~>5.0.4" + # Use Sass to process CSS # gem "sassc-rails" diff --git a/spec/sample/Gemfile.lock b/spec/sample/Gemfile.lock index 38e10cd..21148ad 100644 --- a/spec/sample/Gemfile.lock +++ b/spec/sample/Gemfile.lock @@ -3,6 +3,7 @@ PATH specs: matey (0.1.5) ahoy_matey (~> 4.0) + chartkick (~> 5.0.4) groupdate (~> 6.4.0) view_component (~> 2.74) @@ -94,6 +95,7 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) + chartkick (5.0.4) concurrent-ruby (1.2.2) crass (1.0.6) date (3.3.3) @@ -295,6 +297,7 @@ PLATFORMS DEPENDENCIES bootsnap capybara + chartkick (~> 5.0.4) debug importmap-rails jbuilder diff --git a/spec/sample/app/javascript/application.js b/spec/sample/app/javascript/application.js index 059eab2..3e24937 100644 --- a/spec/sample/app/javascript/application.js +++ b/spec/sample/app/javascript/application.js @@ -1,3 +1,5 @@ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails import "@hotwired/turbo-rails" -import "controllers" \ No newline at end of file +import "controllers" +import "chartkick" +import "Chart.bundle" \ No newline at end of file diff --git a/spec/sample/config/application.rb b/spec/sample/config/application.rb index 90ee93e..1934eea 100644 --- a/spec/sample/config/application.rb +++ b/spec/sample/config/application.rb @@ -26,7 +26,7 @@ class Application < Rails::Application # # config.time_zone = "Central Time (US & Canada)" # config.eager_load_paths << Rails.root.join("extras") - config.action_controller.asset_host = "http://assets.example.com" + # config.action_controller.asset_host = "http://assets.example.com" end end diff --git a/spec/sample/config/importmap.rb b/spec/sample/config/importmap.rb index d7b455b..2534845 100644 --- a/spec/sample/config/importmap.rb +++ b/spec/sample/config/importmap.rb @@ -6,3 +6,5 @@ pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true pin_all_from "app/javascript/controllers", under: "controllers" +pin "chartkick", to: "chartkick.js" +pin "Chart.bundle", to: "Chart.bundle.js" From b32f5c150f725fae6bcbba4c339cafae7cbcc481 Mon Sep 17 00:00:00 2001 From: Jonathan Loos Date: Thu, 16 Nov 2023 02:52:49 +0000 Subject: [PATCH 2/5] fix: update Gemfile.lock --- Gemfile.lock | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index abfd72c..5f3cfff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,6 +3,7 @@ PATH specs: matey (0.1.5) ahoy_matey (~> 4.0) + chartkick (~> 5.0.4) groupdate (~> 6.4.0) view_component (~> 2.74) @@ -81,6 +82,7 @@ GEM ast (2.4.2) base64 (0.1.1) builder (3.2.4) + chartkick (5.0.4) concurrent-ruby (1.2.2) crass (1.0.6) date (3.3.3) From acbdbfea632d1bd29fdf34dc649055134d42f987 Mon Sep 17 00:00:00 2001 From: Jonathan Loos Date: Fri, 22 Dec 2023 14:13:33 -0500 Subject: [PATCH 3/5] documentation: add reference to Chartkick documentation in readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 648f707..034253d 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,8 @@ View the available component color schemes [here](COLOR_SCHEMES.md). View the list of available components [here](COMPONENTS.md). +> Note: Some components leverage Chartkick for presenting charts. Refer to [Chartkick documentation](https://chartkick.com/#importmap) to include it in your project. + **Note**: The more data, the more interesting the components will be. A common and helpful pattern is to capture events on all controller actions. Details on doing this can be found [here](https://github.com/ankane/ahoy#ruby). ## Development From 65c600a828a98f7c497ae52b08adbaedfa719653 Mon Sep 17 00:00:00 2001 From: Jonathan Loos Date: Fri, 22 Dec 2023 19:20:25 +0000 Subject: [PATCH 4/5] fix: revert changes to gemfile --- Gemfile.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 05c4ce3..3619f24 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -81,7 +81,6 @@ GEM ast (2.4.2) base64 (0.1.1) builder (3.2.4) - chartkick (5.0.4) concurrent-ruby (1.2.2) crass (1.0.6) date (3.3.3) From 581d6c14be3a73dbfc0bcfe3fd7c7232849e662c Mon Sep 17 00:00:00 2001 From: Jonathan Loos Date: Fri, 22 Dec 2023 19:22:09 +0000 Subject: [PATCH 5/5] fix: add chartkick to gemfile.lock --- Gemfile.lock | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index 3619f24..5ccd856 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,6 +3,7 @@ PATH specs: matey (0.1.6) ahoy_matey (>= 4.0) + chartkick (~> 5.0.4) groupdate (~> 6.4.0) view_component (~> 2.74) @@ -81,6 +82,7 @@ GEM ast (2.4.2) base64 (0.1.1) builder (3.2.4) + chartkick (5.0.5) concurrent-ruby (1.2.2) crass (1.0.6) date (3.3.3)