Commit Graph

357 Commits

Author SHA1 Message Date
Katharina Irrgang
d2baf80d58
Optimised test folder structure (#9958)
refs #9866

- test/functional/
- test/functional/api
- test/functional/api/v0.1
- test/functional/api/v0.1/utils
- test/functional/api/v2
- test/functional/api/v2/admin
- test/functional/api/v2/admin/utils
- test/functional/api/v2/content
- test/functional/api/v2/content/utils

- updated grunt file
- instead of `grunt test-routes`, you now need to use `grunt test-functional` (docs are updated)

You can use `localUtils.API.getApiQuery('posts/')` and it will generate the correct API url.
2018-10-07 16:36:02 +02:00
kirrg001
f198343698 Removed test/functional/module/module_spec.js
no issue

- why? this is a unit test (!)
- we start+stop Ghost in the routing tests a lot, this implicit tested
- it has no priority for now to move this test to a unit test
- this was the only module test, removed related grunt tasks
2018-10-05 13:51:41 +02:00
Kevin Ansfield
3ec62499f5
Added --no-server-watch option to grunt-dev (#9719)
refs https://github.com/TryGhost/Ghost/issues/9718
- running `grunt dev --no-server-watch` will skip watching server and theme files
- reduces idle CPU usage from 20% to 0%
- useful for client-only development to save battery power
2018-07-09 10:12:33 +01:00
Kevin Ansfield
58aa531813 Cancel repeating client build log on build error
refs https://github.com/TryGhost/Ghost/pull/9611
- #9611 added a repeating message to `grunt dev` output whilst waiting for a successful build but there was no handling for failed builds
- modify bgShell config to cancel the repeating message when there is output on the `stderr` pipe from `ember-cli`
2018-05-03 13:03:29 +01:00
Kevin Ansfield
eef2d0bbb0 Log "Building client" message until client build finishes (#9611)
no issue

- display "Building admin client... (can take ~1min)" every 5 seconds when running `grunt dev` until the ember build finishes so that it's clear the command is still busy
2018-04-30 21:16:24 +02:00
kirrg001
4265afe580 Moved utils/url.js to UrlService
refs #9178

- we have to take care that we don't end up in circular dependencies
  - e.g. API requires UrlService and UrlService needs to require the API (for requesting data)
- update the references
- we would like to get rid of the utils folder, this is/was the most complicated change
2017-12-11 20:05:33 +01:00
Katharina Irrgang
7bcccc71dc
Moved apps into web folder (#9308)
refs #9178

- move express apps to one place (called `web`)
- requires https://github.com/TryGhost/Ghost-Admin/pull/923
- any further improvements are not part of this PR
- this PR just moves the files and ensures the paths are up-to-date
2017-12-06 17:37:54 +01:00
kirrg001
3e482254a3 Ensure test coverage exit in Travis
refs 611e8b5634

- looks like only grunt coverage won't tell Travis that the tests are finished
- second attempt
2017-12-04 15:18:12 +01:00
Katharina Irrgang
611e8b5634 Ensure tests exit in Travis (#9288)
refs https://github.com/mochajs/mocha/issues/3044

- there was a breaking change in mocha, which i have mentioned [here](ee7710ba68), but i thought it's not required, but it is
- it can happen that with mocha 4.x, travis does not complete a test run, because the process does not exit (maybe the test env does not shutdown everything completely)
- but it's hard to figure out why that happens, so we simply add `--exit` (this reflects the mocha 3.x behaviour)
- i've tested that failed tests are still counted and the build results in a red state
2017-11-29 15:22:21 +00:00
Kevin Ansfield
31ee7bb4e1 Clean the core/built dir often to avoid numerous duplicate files (#9245)
closes #8162

- remove `core/client/dist` from the `clean` task, Ghost-Admin takes care of this automatically
- run `clean:built` any time the following are run so that the built dir doesn't get _huge_ and cutting a release doesn't accidentally include tons of unused built files:
	- `grunt dev`
	- `grunt dev --client`
	- `grunt release`
2017-11-16 11:44:15 +01:00
Hannah Wolfe
bcf5a1bc34
Switch to Eslint (#9197)
refs #9178

* Add eslint deps, remove old lint deps
* Add eslint config, remove old lint configs
* Config for server and tests are different
* Tweaked rules to suit us
* Fix linting in codebase - lots of indent changes.
* Fix a real broken test
2017-11-01 13:44:54 +00:00
Hannah Wolfe
882a2361ee
Moved apps to /services/ & moved individual tests (#9187)
refs #9178

* Moved app handling code into services/apps
  - Apps is a service, that allows for the App lifecycle 
  - /server/apps = contains internal apps 
   - /server/services/apps = contains code for managing/handling app life cycle, providing the proxy, etc
* Split apps service tests into separate files
* Moved internal app tests into test folders
    - Problem: Not all the tests in apps were unit tests, yet they were treated like they were in Gruntfile.js
    - Unit tests now live in /test/unit/apps
    - Route tests now live in /test/functional/routes/apps
    - Gruntfile.js has been updated to match
* Switch api.read usage for settingsCache
* Add tests to cover the basic App lifecycle
* Simplify some of the init logic
2017-10-30 12:31:04 +00:00
Katharina Irrgang
bfade9f50d Tests: Renamed unit/server_helpers to unit/helpers (#9145)
no issue

- nothing to explain 😁
2017-10-19 12:02:21 +01:00
Hannah Wolfe
b6b299a8f7 Used ghost-ignition.debug, removed debug dep (#8881)
no issue

- Upgraded ghost-ignition
- Use debug from ghost-ignition everywhere in the code base
- Remove debug dependency
- Fixed random typo in Gruntfile.js
2017-08-15 18:29:27 +07:00
Katharina Irrgang
61158d5540 🐛 Fixed grunt release for development (#8831)
closes #8829

- `grunt release` build the admin assets in the folder you execute the command
- the admin build generates the admin views
- we copy the production view for development to avoid another ember build
- the copy command has to happen before we prepare the build zip, otherwise the release tree is incomplete
- this will prevent missing the development view for npm
2017-08-03 12:05:35 +04:00
Kevin Ansfield
665f9f3926 🎨 Don't include Ghost-Admin development assets in release builds
closes #6149

- speeds up and reduces size of releases by not building and including the development versions of Ghost-Admin
- ensures the server can still be run in both production and development by copying the admin  `default-prod.html` file to `default.html` as part of the release task
- development builds aren't useful in release zips (especially when the sourcemaps are stripped from releases) - if deep debugging or changes are to be made in Ghost-Admin then it should be checked out from git (see https://docs.ghost.org/docs/working-with-the-admin-client)
2017-08-02 11:54:45 +04:00
Hannah Wolfe
2ce1b5e071 🐛 fixed grunt dev restarting loads during tests (#8798)
closes #8599

- `grunt dev` was watching for changes to all config files
- added an ignore for config.testing.json
- now it won't restart constantly during tests
2017-08-01 10:07:17 +04:00
Hannah Wolfe
301696632f 🛠 🙈 Rename ghost-url.js to ghost-sdk.js (#8767)
closes #8605

- This file has already been moved, might as well get the rename out of the way
- Especially as we don't migrate clients - everyone will now need to make just one change
2017-07-28 18:23:32 +04:00
John O'Nolan
8f844a70fe 👌🏼 Grunt master for submodules
refs #8235

- the --remote option only works if your upstream is origin
- this version of the command should work for everyone
2017-04-17 19:55:07 +01:00
Hannah Wolfe
e9a537004b Added pre-commit hook to handle submodules (#8302)
refs #8235

Usage:
- for existing development setups: `grunt symlink` (will create the pre-commit symlink)
- for fresh development setups: `npm run init` (symlinking happens as part of the typical set up)

-  Added pre-commit hook to handle submodules
  - Checks to see if there are any submodules about to be committed
  - Output matches closely to `git st` to make it easy to read
  - Requires interaction from the committer to accept that this really should be committed
-  Use grunt symlink to register githooks
  - Grunt symlink will make a link to the pre-commit hook
  - It ONLY does this if there isn't already a pre-commit hook, so won't overwrite anything
  - It does this as part of npm run init, not grunt init, because a release repo would NEVER want this
  - This is a dev tool, that configures the repo for development
2017-04-13 08:26:48 +01:00
Kevin Ansfield
d0b9d16987 🛠 add npmInstall: true back for subgrunt:init
no issue
- fixes `grunt init` task when client submodules aren't already installed
2017-04-11 18:19:06 +01:00
Hannah Wolfe
352606fb28 grunt master improvements (#8301)
refs #8235

- Use yarn to install top-level dependencies
- Change to use git submodule update --remote to update submodules to master rather than the pinned commit
- Clarify that the existing submodule update will update to the pinned commits by naming it 'pinned'
- Use `upstream` as default remote
- Support --upstream= or GHOST_UPSTEAM env var
- Output a log line telling the user where master was pulled from
2017-04-10 15:51:32 +02:00
Hannah Wolfe
a413d70313 Asset amends (#8294)
refs #8221

🔥 Remove ghost=true concept from asset url helper

 💯 Introduce CSS minification with cssnano
- add new grunt-cssnano dependency
- wire up grunt task to minify public/ghost.css

🎨 Rename minification config & hash params
- Change minifyInProduction -> hasMinFile
  - this means this asset should have a .min file available
- Change minifyAssets -> useMinFiles
  - this means that in this env we want to serve .min files if available

🎨 Update public/ghost.css to serve .min for prod
- add the new `hasMinFile` property

🎨 Move minified asset handling to asset_url util
- this logic should be in the util, not the asset helper
- updated tests

📖 Error handler always needs asset helper
- this removes the TODO and adds a more sensible comment
- we also need to update our theme documentation around error templates

🔥 Don't use asset helper in ghost head
- use getAssetUrl util instead!
- removed TODO

📖 Update proxy docs
🎨 Simplify asset helper & add tests
- this refactor is a step prior to moving this from metadata to being a url util
- needed to skip some new tests

🐛 Add missing handler for css file
2017-04-10 11:30:21 +02:00
Aileen Nowak
83f084608f 💁🏻 Moveshared/ to server/public (#8273)
refs #8221

Instead of serving our shared assets from a `shared/` folder, we move the file, which are used server side to `server/public`.
Adds a new `config.paths` entry: `publicFilePath` and renames the middleware to serve the files to reflect the changes.
Adds `404-ghost.png` images to be used by the server side rendered default template `error.hbs`.
2017-04-07 13:21:41 +01:00
Katharina Irrgang
13fb0c68b4 🛠 grunt master (#8251)
refs #8235

- add a new grunt command `dev-master`
- this command will bring back your working directory to latest master
- plus it will update your dependencies and checks your database health
- it won't build the client (!)

* 🛠    grunt dev-master
* fix jscs 💣
* change to grunt master
2017-04-05 20:46:22 +01:00
Katharina Irrgang
8f7ee82122 🐛 fix grunt test (#8266)
no issue

- it was not possible to run a single test in core/server/apps/.../tests
2017-04-05 20:20:00 +02:00
Kevin Ansfield
1cb1ea105c 🛠 switch to using yarn in our Grunt tasks (#8261)
no issue

- use `yarn install` instead of `npm install` in grunt tasks
- remove `grunt deps` and `grunt shell:{shrinkwrap/prune/dedupe}` tasks as they are not needed when using `yarn`
- set `options.npmPath` to `yarn` for subgrunt so it doesn't use `npm install` automatically
- don't remove client contributors files in `grunt clean` - those files are now manually created and should be kept

* 🛠 switch to using yarn in our Grunt tasks
* 🛠 use yarn for `npm run init`, update README
2017-04-04 11:47:12 +01:00
Kevin Ansfield
5710e2f60e add --server/client options to grunt dev (#8241)
refs #8235

- adds `grunt dev --server` which will start the express server and restart on server changes but will not rebuild or watch any client files (if client files are missing or out of date you can run `grunt build` first)
- adds `grunt dev --client` which will only start the client server and rebuilding/livereload - useful if you are experiencing issues with one or the other crashing because you can run server/client in separate tabs
2017-03-30 14:51:22 +01:00
Kevin Ansfield
c9e0c252f0 grunt dev admin livereload (#8176)
refs https://github.com/TryGhost/Ghost/issues/8161, requires https://github.com/TryGhost/Ghost-Admin/pull/590
- adds a development-only route to the admin app that redirects to ember-cli's livereload script
- updates Gruntfile `watch` task to pass the `live-reload-base-url` param with subdirectory support
- updates Gruntfile `bgShell:client` task to filter potentially confusing output from `ember serve`
  - removes `Livereload server on http://localhost:49153`
  - removes `Serving on http://localhost:4200/`

With this and the required Ghost-Admin PR, when using `grunt dev` the admin screen will refresh any time a file is changed. It will also allow client tests to be run simultaneously by visiting http://localhost:4200/tests
2017-03-30 13:27:07 +01:00
Hannah Wolfe
d294177966 🔥 Remove handlebars from serving admin (#8184)
refs TryGhost/Ghost#8140
refs TryGhost/Ghost-Admin#593

- now that the admin index page is just html, we don't need handlebars anymore
- as we can use res.sendFile to send the static HTML file, don't need to "render" it anymore
- remove the view engine, hbs and the use of helpers - it's all unneeded
- change the filenames to .html to reflect this
2017-03-20 12:00:18 +00:00
Hannah Wolfe
4a6f58d8d1 🙅🏽 Admin server split (#8142)
refs #8140

 Support new default-prod.hbs template for admin
 Redirect ghost admin urls without a #
 Update admin urls to include #
🎨 Move the admin templates
🔥 Remove redirect to setup middleware
🚨 Tests for new middleware
2017-03-14 17:03:30 +01:00
Katharina Irrgang
b5cdc01ad1 🎨 Updates for Gruntfile (#8158)
* grunt docs did not work
  - the option "extras" did not work
  - https://github.com/jbt/docker/blob/v0.2.14/src/docker.js#L1280
  - there is a bug in docker docs
  - i removed it for now
* grunt watch-docs typo + remove old config
* remove client testing and client linting
* optimise grunt validate
  - validate is just a wrapper command for `npm test`
  - it will either run lint or the server tests
  - no build - why should validate build ember?
* config updates
  - we don't have a config.js anymore
  - use new config notation
* Update grunt dev
  - livereload for Ghost wasn't working correct, the server wasn't stopped correctly and after reload an address in use error was visibile
  - that is because the "spawn" option has changed to "nospawn"
  - add stdout/stderr info to the bgshell watch command
2017-03-14 13:51:32 +00:00
Katharina Irrgang
f8c51ac7e5 😱 🚀 🎨 tests: use truncate instead of database deletion (#8119)
* 😱  🚀  🎨  tests: use truncate instead of delete the database

refs #7718, refs #7470

- should bring massive speed improvement
- could also fix random test failures (e.g. sqlite database is busy)

* gruntfile: add knex-migrator command in test-setup
2017-03-09 19:38:20 +00:00
Katharina Irrgang
2d19ae2c6c 🔥 😎 remove old migrations (#7887)
refs #7489

- remove old migration code
- this logic was sourced out to knex-migrator
2017-01-25 13:47:49 +00:00
Katharina Irrgang
68741a1106 Revert "🎨 grunt release .knex-migrator" (#7874)
refs #7489
2017-01-23 12:33:03 +01:00
Katharina Irrgang
c8c696f659 🎨 grunt release .knex-migrator (#7591)
no issue
- the file was not copied over for the release
- @TODO: different solution?
2016-10-24 10:18:04 +01:00
Hannah Wolfe
b729597bf5 🔥 Remove the contributor list from Gruntfile (#7428)
refs #7427

- Moving all release-specific code out of the core repository
- Also found a different way to do this, without needing API access :)
2016-09-26 07:16:55 -05:00
kirrg001
8115d83782 🔥 remove postgres support
refs #1333, refs #5878, refs #5321
2016-09-20 15:59:34 +01:00
kirrg001
13f7d51213 🔥 remove ensureConfig from Gruntfile
refs #6982
[ci skip]
2016-09-20 15:59:34 +01:00
Hannah Wolfe
470000242d 🛠 Make it easy to test preparing dependencies (#7335)
no issue

- as part of a release, we run npm dedupe, npm prune and npm shrinkwrap. In certain cases this can change which dependencies are used
- with this change `grunt deps` will run those 3 tasks so it's easier to test what happens
2016-09-14 15:57:50 +02:00
Katharina Irrgang
a5840753fc 🚨 increase mocha timeout globally (#7378)
no issue
2016-09-14 14:16:57 +01:00
Katharina Irrgang
8c1e5fbc61 🐛 add missing dependency lodash.orderBy (#7333)
no issue
2016-09-14 11:22:16 +01:00
Austin Burdine
03d4137b86 Move remainder of ember tasks to client repo (#7172)
* Updating Ghost-Admin: Gruntfile work

* move remainder of ember tasks to client repo

refs #6977
- move ember build tasks to client repo
- remove unneeded dependencies
2016-08-07 11:53:28 +02:00
Austin Burdine
77464c59bd improve Ghost contributor tooling (#7042)
refs #6977
- update client ref
- add gh-contrib-list dependency
- remove buildAboutPage task
2016-07-22 12:53:48 +01:00
Katharina Irrgang
3f3ed61273 improvement: travis server (#7032)
no issue
- do not build client when running server tests
2016-07-20 04:39:40 -06:00
Austin Burdine
14c3d0e9ef Merge pull request #7006 from kevinansfield/subgrunt-init
Use subgrunt to install client dependencies
2016-06-18 15:11:35 -04:00
Kevin Ansfield
706d47fb5b Use subgrunt to install client dependencies
closes https://github.com/TryGhost/Ghost/pull/7005, requires https://github.com/TryGhost/Ghost-Admin/pull/79
- defers to client's Gruntfile to install client dependencies, avoids requirement for a global bower install
2016-06-18 18:35:51 +01:00
kirrg001
250d571fe6 improvement: jshint/jscs
no issue
- add mocha option to jshintrc, no need to define globals in files anymore
- call client grunt commands in case of jshint/jscs
2016-06-17 22:59:47 +02:00
Hannah Wolfe
6d0b4ba03c Merge pull request #6952 from kirrg001/fix/mocha-coverage
fix: require overrides for mocha coverage
2016-06-09 12:33:35 +01:00
Hannah Wolfe
0c44353e7a Merge pull request #6943 from kirrg001/improvement/single-test-with-autocompletion
improvement: offer a way to run single test with bash file completion
2016-06-09 12:28:54 +01:00