-
Notifications
You must be signed in to change notification settings - Fork 122
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
Add option for generating RBIs for Rails engines #1220
Conversation
a665be6
to
c726440
Compare
c726440
to
3ce0dba
Compare
begin | ||
FileUtils.mkdir_p(engine_path) | ||
FileUtils.mv(@project.path + "/config", engine_path) | ||
FileUtils.mv(@project.path + "/lib", engine_path) |
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'd prefer writing the files to /test/dummy
directly on line 347 but not a blocker.
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.
Agreed, unfortunately the top-level before(:all)
sets the project path so we would need to restructure the tests first.
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'm a bit confused. I was only referring to the lib
files. More specifically I was thinking of changing the 2 writes to:
@project.write("test/dummy/lib/post.rb", <<~RB)
& @project.write("test/dummy/lib/comment.rb", <<~RB)
and removing the line FileUtils.mv(@project.path + "/lib", engine_path)
.
We don't have to do it, I'm just trying to understand the project path blocker 🙂
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.
Ah, I understand now. I was thinking of config/environment.rb
which gets created in the before(:all)
. I've opened #1225 to address this.
(Paired with @vinistock)
Motivation
Closes #1182
Implementation
An
--app_root
option was added to thetapioca dsl
command. This can be used to specify the path to the dummy app for an engine.There were several places in the code which assumed the app is always at the root of the project. These were updated to take the
app_root
option into consideration.Tests
The test approach is styled after the existing RBI generation tests. We create files for the app as normal, but then move the necessary files into the
test/dummy
path before running thedsl
commmand.