-
Notifications
You must be signed in to change notification settings - Fork 48
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
Adding ability to set custom directory when using custom.init #464
Conversation
@@ -38,6 +38,7 @@ require "../spec_helper" | |||
private def generate_heroku_app_name | |||
app_name_base + "-" + Random::Secure.hex(4) | |||
end | |||
|
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.
the crystal formatter did this
@@ -9,7 +9,7 @@ end | |||
describe "Initializing a new web project" do | |||
it "creates a full web app successfully" do | |||
puts "Web app: Running integration spec. This might take awhile...".colorize(:yellow) | |||
should_run_successfully "crystal run src/lucky.cr -- init.custom test-project test-project" |
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.
no clue why we had this doubled on all these specs lol
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.
@@ -13,14 +13,18 @@ class LuckyCli::CustomInit < LuckyCli::Init | |||
private def generate_project(project_name) | |||
api_only = false | |||
authentication = true | |||
project_directory = "." |
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.
Just default it to the current directory you're in like it does now
) | ||
Dir.cd(File.expand_path(project_directory)) |
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.
The expand_path
allows us to pass things like "."
or ~/Projects
and have it expand properly. We just cd in to the directory we want the project, then run everything as normal.
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 great. Just one note on the example for custom.init
@@ -9,7 +9,7 @@ end | |||
describe "Initializing a new web project" do | |||
it "creates a full web app successfully" do | |||
puts "Web app: Running integration spec. This might take awhile...".colorize(:yellow) | |||
should_run_successfully "crystal run src/lucky.cr -- init.custom test-project test-project" |
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.
…o custom.init. Adding another example to the OptionParser output to make it clear that the arguments are optional
* ran formatter * adding in custom directory support for custom.init generator. Fixes #339 * a few more spec updates to remove duplicate options being passed in to custom.init. Adding another example to the OptionParser output to make it clear that the arguments are optional
Fixes #339
Right now we have a
custom.init
generator that I don't think is used much. It only does the same as the wizard, but all through the command line. Now we can start to allow for some really custom options like setting a custom directory!This PR adds a new
--dir DIR
flag to set the directory of where to generate your application. All it really does is cd in to that custom directory, and then generate the app as normal from that directory. This may be helpful for people using docker, or automating a build on to a server.