Closed darinwilson closed 8 years ago
I just noticed that Semaphore is failing because bin/setup
now requires user input. I could change the script so that it accepts an optional parameter to use as the app name, but that would require making a change in the Semaphore setup to call the script with the parameter. Does that work? Or is there a better approach?
Now that I think about it some more, I think I'll change the script so that rather than prompting the user for the app name, it will just accept it as an optional argument to bin/setup
. If the user doesn't provide anything, it will leave it as "PhoenixBase", e.g.
# setup the app as MyApp
./bin/setup MyApp
# setup the app as PhoenixBase
./bin/setup
That seems cleaner to me, and will require no changes to Semaphore. Does that work?
I'd like to see this be a mix task. For example:
mix project.rename OldName NewName
We could then later extract it to its own hex package, and run it in bin/setup
like you are doing here.
I also don't think we have to run it as part of bin/setup
, since it doesn't really need to be run every time your project is set up (because ultimately your project will be renamed), it only has to be run by the very first person who works on the project.
Just including it in the base project with a comment in the README should be enough. "After you fork this project, rename it using mix project.rename
." Forkers don't need to change the bin/setup script at all.
I also don't think we have to run it as part of bin/setup, since it doesn't really need to be run every time your project is set up (because ultimately your project will be renamed), it only has to be run by the very first person who works on the project.
Yeah, that makes sense - I'll move it out to a mix task. Thanks for the feedback!
I'm working on a PR to add this to Elixir. If it's accepted, we'll get a mix app.rename NewName
task available to us everywhere.
That would be great! 👍
On Sat, Apr 16, 2016, 2:03 PM Daniel Berkompas notifications@github.com wrote:
I'm working on a PR to add this to Elixir. If it's accepted, we'll get a mix app.rename NewName task available to us everywhere.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/infinitered/phoenix_base/pull/6#issuecomment-210901280
When setting up a new app using this as a base, it's a little tedious to change every instance of
PhoenixBase
and:phoenix_base
throughout the codebase to the new app name. This PR adds a step tobin/setup
that prompts the user for the app name they'd like to use, then renames files and replaces strings in the repo as needed.This feature uses sed for the string replacement. It should work on Mac and Unix systems, but probably not Windows. Ideally, we would have a pure Elixir solution, but this will get the ball rolling.