Move Ghost-UI back into the Ghost repository #3886

Closed
ErisDS opened this Issue Aug 26, 2014 · 14 comments

Projects

None yet

4 participants

@ErisDS
Member
ErisDS commented Aug 26, 2014

Back in March we moved all of Ghost's SASS over to the Ghost-UI repository so that we no longer had a ruby dependency here in the main Ghost repo.

We also hoped to turn the SASS into a Bootstrap-esque framework for creating interfaces that look like Ghost. We hoped to share the code between Ghost and Ghost.org, as well as provide an easy way for people building internal and external apps for Ghost to maintain consistency.

This was an experiment, and the experiment has failed for a number of reasons.

Firstly, maintaining code across 2 repositories is a nightmare. Issues get raised in one, the other, or both, and it's always confusing, pull requests which change html & css have to be done in 2 places, and links between issues in the 2 repos aren't clear.

Secondly, the move to Ember makes it almost impossible to build flexible, generic and reusable components outside of the Ghost repository. This removes half the point of having a separate framework for the UI. It makes it less likely the code will be shared, and it means creating components is just a lot more work.

Whilst the SASS has been in the Ghost-UI repo, it has been reviewed, refactored and a big redesign done. The result is that we no longer really need to use ruby SASS, as we are no longer depending on the extended features of it and of bourbon.

Therefore, the plan is to switch to libsass, move the SASS code back to the Ghost repository, and go back to the way things were but still without the awful ruby dependency.

  • convert the SASS to libsass (@pauladamdavis)
  • move the code back to the Ghost repo (@ErisDS)
  • wire up grunt to build the SASS (@ErisDS)
  • move the ghost-ui issues back to the Ghost repo
@ErisDS ErisDS added this to the 0.5.x Feature Release Backlog milestone Aug 26, 2014
@ErisDS ErisDS added the ghost-ui label Aug 26, 2014
@PaulAdamDavis
Contributor

Part 1 is now complete - TryGhost/Ghost-UI@cbbe5af...a6934d1

@ErisDS ErisDS assigned ErisDS and unassigned PaulAdamDavis Aug 27, 2014
@ErisDS
Member
ErisDS commented Aug 29, 2014

I've made a start on Task 2, I have an example of how this will look in terms of the structure of core/client/assets on a branch called master-with-ui and you can see that this has also maintained / merged the history.

Imported from Ghost-UI is:

/core/client/assets/docs
/core/client/assets/fonts
/core/client/assets/sass
/core/client/assets/README.md

If you're interested, this was done with the following git-fu:

  • git remote add ghost-ui git@github.com:TryGhost/Ghost-UI.git
  • git merge -s ours --no-commit ghost-ui/gui2.0-nodesass
  • git read-tree --prefix=core/client/assets/ -u ghost-ui/gui2.0-nodesass
  • git reset HEAD [all the files we don't want, like /dist]
  • git commit

There are a couple of outstanding questions to wrap up:

  • Should we keep the /docs folder?
  • Do we need to keep the full history of the conversion to libsass?

Once we've decided on these things I'll complete and push the merge.

@PaulAdamDavis
Contributor
  1. I think the docs should (eventually) be moved to http://docs.ghost.org/ as a reference for when Apps can be built. But the docs we have now are mostly there so we had some markup to style when creating GUI2.
  2. I don't think it's needed. Squashing those 20~30 commits is much cleaner. :D
@JohnONolan
Member

So in my mind the concept of GUI as a named thing is now dead. The new "thing" is the Ember app, which comprises of both GUI and Ember. I wouldn't be against naming it something, for the sake of easy reference.

To that end, I think the "root directory" for this project is /client/ - that's where the readme should live, that's where the docs should live, that's maybe even where (in future) a subset of tests or specialised build tasks should live.

The only other thing I noticed was that the assets/lib folder doesn't feel right. Lib should be 3rd party components, these are not that that, as far as I can tell. I don't know where they should live, but not in a lib directory and probably not in /assets/ either?

@PaulAdamDavis
Contributor

I can't see the sense in having all the docs for Ghost at docs.ghost.org, but docs for GUI somewhere else. As for getting GUI styles into docs, that could be a submobule, as GitHub pages can now compile Sass. Maybe this is another issue though.

@JohnONolan
Member

What docs actually are / where they live / what's in them is a very different issue. My comment is purely directed at the structure in which GUI is merged into core. Which is to say that, if anything, /docs/ of any kind should not live inside /assets/

@ErisDS
Member
ErisDS commented Aug 29, 2014

That's totally fine, /docs/ can go into the root of client.

/lib/ contains two jquery things which need to be emberified and die and lib will die with them

@JohnONolan
Member

ok so then readme + docs => client, and that's it. Make it so!

Oh yes and +1 for squashing the sass=>libsass conversion commits into 1, and any others which fit the same pattern.

@ErisDS
Member
ErisDS commented Aug 29, 2014

/docs/ and the readme*

@ErisDS
Member
ErisDS commented Aug 29, 2014

Jinx! All good, this is super easy as well, bloody love git, and learning new git-fu

@novaugust
Member

@ErisDS ping me if you need a workhouse for the jQ -> Ember fun

@novaugust
Member

@JohnONolan lib is standard fair for "the code that we wrote for our project", I don't associate it with vendor code. Maybe this is a dev/design split, or maybe it's just a Matt/John split ^ ^

@ErisDS
Member
ErisDS commented Aug 30, 2014

@novaugust would <3 you to look at Emberifying those 2 jQuery files. Guess I should raise an issue to make it so.

With regard to merging these 2 repos, this has taken a lot of reading and messing around and testing, but I think I have achieved the following 3 goals:

  • the right files from Ghost-UI are in the right place in Ghost
  • the histories have been merged
  • files mentioned in the histories point to the correct paths (this was the hard part)

I've changed my approach quite drastically. On Ghost-UI, I took Paul's branch, squashed some commits and then ran:

  1. git filter-branch -f --prune-empty --index-filter 'git rm --cached --ignore-unmatch -rf -- dist* js* bower.json .bowerrc .editorconfig .gitattributes .gitignore CONTRIBUTING.md Gruntfile.js LICENSE package.json'
  2. git filter-branch --tree-filter "mkdir -p assets; git mv -fk sass fonts assets"
  3. git filter-branch -f --tree-filter "mkdir -p core/client; git mv -fk assets docs README.md _config.yml core/client"

Command 1. deleted everything from Ghost-UI we don't want to keep
Command 2. moved the sass and fonts subdirectories down a level in the hierarchy to a folder called assets
Command 3. did a similar thing, moving everything into /core/client so that the hierarchy of Ghost-UI matches Ghost

The important thing is that using filter-branch means that the files and directories didn't just get deleted and moved, but the history gets updated to match meaning every commit is amended, or if there's no reason for the commit to exist anymore it's completely removed. This means that all of @PaulAdamDavis's version bump commits are gone because both the package.json and bower.json files have been deleted and those commits no longer apply to anything.

I think this is what we want. Those version bump commits only made sense in the context of Ghost-UI as a separate repo. The history of how the files we have kept have changed remains, and all editors and git should still be able to understand the history, because the history has been updated so the files match their new locations.

Finally, all this was merged into Ghost by simply adding Ghost-UI as a remote and doing a pull. Here's the result: https://github.com/TryGhost/Ghost/commits/master-with-ui

@ErisDS
Member
ErisDS commented Sep 2, 2014

This is now complete.

@ErisDS ErisDS closed this Sep 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment