Strider-CD / strider-heroku

Strider plugin for heroku deployment
2 stars 8 forks source link

Unable to Add Heroku Account to Project for Depoyment #5

Closed terraboops closed 9 years ago

terraboops commented 9 years ago

I have successfully configured my user account so that it is connected to Heroku via a custom client. The SSH key generated by the plugin was added to my Heroku account.

I can add the Heroku plugin to my project, which is provided by a GitHub repo. The project builds without the Heroku plugin. When I add the plugin, the project fails to build with the message 'Invalid Heroku configuration. Account not found' (worker.js:8).

When I attempt to configure the Heroku plugin, the 'Add a Heroku Account' button redirects me to Heroku and the OAuth flow is performed, but I end up on the main Project Settings page. When I go back to the Configure Heroku Plugin page, the account appears to not have been added. Once this is working, I should be able to select which app to deploy the verified build to and the project will be configured correctly.

I will continue investigating this and will contribute any solutions that I find.

terraboops commented 9 years ago

I determined that the account is being added correctly in the back-end, but that the AngularJS front-end code isn't incorporating the values correctly.

I have hacked up the code to make this work. I am a bit of an AngularJS noob, so I don't really understand why this is failing. It seems like only the last HerokuController definition is being honoured. The plugins' Angular controller definitions are packaged up into two different compiled files: account-plugins-compiled.js and plugins-config-compiled.js. There is also a base HerokuController defined in app.js -- within the main strider package.

The app.controller call in plugins-config-compiled.js happens at the right time, but the controller's constructor is never triggered. As a result, most of the functionality remains unbound from the view.

If I move all of the code from inside the HerokuController definition of config.js to the top of user.js, the functionality is bound to the view correctly.

Obviously this is a gross hack, so I won't be opening a pull request just yet. I can commit my WIP workaround / fix to a branch on my fork if anyone wants to take a look.

terraboops commented 9 years ago

I have figured out why this is happening, you can't define a controller more than once. There are ways to extend it without adding a directive, but that doesn't appear to be the recommended way to do this.

I am submitting a pull-request for review, you can see the solution I have arrived at.

knownasilya commented 9 years ago

Deployed your fix as 0.1.2, use your plugin manager to update