-
Notifications
You must be signed in to change notification settings - Fork 20
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
Rake task to add new adapter template #112
Conversation
008e73b
to
6c69e2e
Compare
Pull Request Test Coverage Report for Build 632
💛 - Coveralls |
Pull Request Test Coverage Report for Build 659
💛 - Coveralls |
Pull Request Test Coverage Report for Build 632
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attach screenshot how it is generating the files and folder. Run some code in irb for this adapter in screenshot.
lib/tasks/new_adapter.rake
Outdated
template_code_str << "\n module #{file_name.capitalize}Adapter" | ||
template_code_str << "\n extend self # rubocop:disable Style/ModuleFunction" | ||
template_code_str << "\n def init(data, options, _user_options={})" | ||
template_code_str << "\n # TODO" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this raise not implemented exception.
lib/tasks/new_adapter.rake
Outdated
template_code_str << "\n" | ||
end | ||
|
||
namespace :new do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document this feature in readme.md (and wiki page once it is completed) explaining about API and useage.
@@ -0,0 +1,57 @@ | |||
def extract_adapter_template_code(file_name, template_code_str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not good to have one single method that do all the things. We should have method to generate string for internal methods like init
, export_html_file
.
There are many ways to make it modular & extendable. Think/design good one.
2033c64
to
f9d0acf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine!
template_code_str << "\n module View" | ||
template_code_str << "\n module Adapter" | ||
template_code_str << "\n module #{file_name.capitalize}Adapter" | ||
template_code_str << "\n extend self # rubocop:disable Style/ModuleFunction" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still prefer \t
than spaces.
This PR aims to create a rake task to add a new adapter template.
Example:
will create a new file
charts.rb
with all the necessary methods to add an adapter like init, init_script, init_ruby, show_in_iruby and export_html_file as TODO.