Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TR#400] Add blazer generator #97

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

reedrolemodel
Copy link
Member

@reedrolemodel reedrolemodel commented Feb 1, 2023

Task

TR #400

Why?

Blazer is quickly becoming a tool that we reach for on almost every project. What is missing from our use of it? What common customizations or fixes can we package?

A few things we could/should do

Switch from passing SQL back and forth in Blazer (except where absolutely necessary) to eliminate SQL injection.

Could also package Blazer for non-admin reporting as used on BGEA & Maverick

And one last thing is to create a rolemodel_rails generator

What Changed

What changed in this PR?

  • Added generator for blazer
  • Improve security by preventing executing raw sql from POST data

Screenshots

If any UI changes need to be shown off, please add screenshots here.

require_relative '../../../bundler_helpers'

module Rolemodel
module Saas
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saas?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I see that's nesting approach. Could see it simply being rolemodel:blazer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, will change

def add_styles
copy_file 'app/assets/stylesheets/blazer.css'
copy_file 'app/assets/stylesheets/selectize.css'
append_to_file 'app/assets/config/manifest.js', "\n//= link blazer.css"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be different base on the CSS approach being used right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I defer to @reedrolemodel on that one. I forget why we needed that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this assumes sprockets is being used which is also an assumption of blazer. This issue is for adding support for jsbundling and cssbundling to blazer. Until more gems support newer approaches, it seems likely that sprockets will be needed.

if File.readlines('Gemfile').grep(/capybara|webdrivers/).none?
gem_group :test do
gem 'capybara' unless File.readlines('Gemfile').grep(/capybara/).any?
gem 'webdrivers' unless File.readlines('Gemfile').grep(/webdrivers/).any?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update this now.

end

def add_tests
copy_file 'spec/factories/blazer_queries.rb'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be copying blazer_dashboards.rb too?

Suggested change
copy_file 'spec/factories/blazer_queries.rb'
copy_file 'spec/factories/blazer_dashboards.rb'
copy_file 'spec/factories/blazer_queries.rb'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants