Commit Graph

7268 Commits

Author SHA1 Message Date
Greenkeeper
230da89e66 Update sinon to version 2.1.0 🚀 (#8198)
* chore(package): update sinon to version 2.1.0

https://greenkeeper.io/

* chore: yarn.lock
2017-04-04 09:01:26 +02:00
Katharina Irrgang
e9438c650d 🐛 fix get helper: public api labs (#8255)
no issue
2017-04-03 17:42:50 +01:00
Katharina Irrgang
be977a55cf 🎨 🚑 do not use testurl.com in tests (#8254)
no issue

- if we are using any random domain in our tests, it could be that the test behaviour changes over time
- in this case: the ghost_head_spec triggers a request for image diminsions (cover image, author image, blog logo)
- if the target blog url/domain can't be reached (connecting....), the timeout would be reached - but the test is not setup to handle longer waiting times
- even with https://github.com/TryGhost/Ghost/pull/8210/files, the default timeout would be 5s, which is not acceptable for a unit test
- that's why, we need to choose a blog url, which definitely is "down" - any long localhost port
2017-04-03 16:29:36 +01:00
Katharina Irrgang
6e24f0504d 🎨 hide npm error log if running npm run init (#8250)
refs #8235
- users share the general npm error log, which won't help
- so it's better to hide this log
2017-04-03 13:52:52 +01:00
Hannah Wolfe
0fff91c860 🐛 Fix the config for compression (#8226)
refs #7488

- This has always been documented as top-level "compress", and yet the code references server.compress
- Should be top level
2017-04-03 10:58:07 +02: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
Greenkeeper
b8e46137c8 Update icojs to version 0.7.1 🚀 (#8233)
* chore(package): update icojs to version 0.7.1

https://greenkeeper.io/

* chore: yarn.lock
2017-03-26 20:08:24 +02:00
Kevin Ansfield
b6d3490d8b Updated Ghost-Admin: renamed mobliedoc cards 2017-03-24 10:05:14 +00:00
Ryan McCarvill
d0dc7c5ee1 📦 Card-Rename (#8218)
no issue
- Renames Cards so they comply with the `card-{{name}}` convention rather than `{{name}}-card`
- Adds an unkonwnCardHandler to the editor.
2017-03-24 10:03:33 +00:00
Hannah Wolfe
3cea203459 🔥 🎨 Cleanup & simplify theme helpers (#8223)
no issue

🔥 Remove adminHbs concept from tests
🔥 Get rid of unnecessary helper test utils
🔥 Remove helper missing code
- this hasn't been registered / used for ages 😱
- gscan no longer allows us to activate themes that have missing helpers, so this wouldn't be used anyway
TODO: consider whether we should make a way to override this?

🎨 Reduce coupling inside of /helpers
🎨 Use settingsCache in ghost_foot
 Labs util for enabling helpers
🎨 Move loadCoreHelpers to blog
- This needs a proper home, but at the very least it doesn't belong
in server/app.js!

🎨 Use settingsCache in ghost_head
2017-03-23 20:00:58 +01:00
Hannah Wolfe
5b161a2856 🐛 Ensure that admin templates are on npm
fixes #8216

- Admin templates are now html files, we need to not ignore them
2017-03-23 11:05:50 -05:00
Katharina Irrgang
76fd1264a8 📖 Update README installation instructions (#8175)
- add contributing workflow link already
- i would suggest we merge this PR if the workflow guide was reviewed
2017-03-23 16:02:21 +00:00
Hannah Wolfe
c9500b11ea 🐛 Set timezone in time related tests (#8214)
closes #8017

- set the timezone, and use moment.tz to get the time now
2017-03-23 13:58:50 +01:00
Greenkeeper
a7d5682d16 Update icojs to version 0.7.0 🚀 (#8178)
* chore(package): update icojs to version 0.7.0

https://greenkeeper.io/

* chore: yarn.lock
2017-03-23 11:19:18 +01:00
kirrg001
bafb24bd07 Version bump to 1.0.0-alpha.17 2017-03-22 10:18:14 +01:00
kirrg001
c3b310161e Updated Ghost-Admin to 1.0.0-alpha.17 2017-03-22 10:18:14 +01:00
Hannah Wolfe
317daf5549 🎨 🚨 Split theme tests, clean config & add tests (#8205)
refs #7491

- split themes_spec up into several files
- clean up the code for configuration
- ensure its tested
2017-03-22 07:52:58 +01:00
Katharina Irrgang
e903be6679 🐛 fix favicon path (#8190)
closes #8187

- if you start Ghost via the Ghost-CLI, the path to the favicon must be absolute
- because the CLI spawns a Ghost process from the root folder of the CLI folder e.g. node current/index.js
2017-03-21 11:44:39 +00:00
Hannah Wolfe
495eee7747 Use "mounting" concept for active theme (#8193)
no issue

🔥 Remove DIRTY HACK for API
- this is no longer needed, because themes get mounted in every case

 Switch to concept of 'mounted' theme
- check if active theme is mounted
- if not, mount it
- mounting is a function OF the active theme

🎨 Move theme middleware to theme module

🎨 Update theme middleware function names
- update the function names and comments to be more representative of their current functions
- this was pretty old and out of date!

🚨 Fixup tests for middleware
- ensure the objects match what we expect
- based partially on theme docs

Update TODO
2017-03-21 10:03:09 +01:00
Hannah Wolfe
47e00900cc 💄 🐷 Test consistency (#8199)
no issue

- change out should.equal for // jshint ignore:line
- ensure should is the first require in every test, and ALWAYS require
- make sinon the second require, and sandbox the last thing
- ALWAYS use sandbox, futureproofs tests against contributors who don't know it
- change require formatting
2017-03-21 09:24:11 +01:00
Hannah Wolfe
fad0ac7213 🐛🎨 Theme API minor improvements (#8197)
no issue

🎨 🐛 Ensure cache is updated correctly for themes
- Insure the cache invalidation headers are always set correctly for the themes API

📖  Theme API comments / function naming
- this is an update for clarity, so we can see what further improvements can be made

🐛 🎨 Add permissions to themes.browse
2017-03-20 19:02:44 +01:00
Katharina Irrgang
4e3e1bdfc9 Call getImageSize with timeout (#8044) (#8189)
refs #8041

Calls `getImageSize` with an timeout of 6sec. and adds a default timeout (in case, function is called without optional timeout) of 10sec, to prevent node from using its default timeout of 2minutes 😱
2017-03-20 12:17:27 +00:00
Kevin Ansfield
b24b196fac Updated Ghost-Admin: admin default.hbs now default.html 2017-03-20 12:02:49 +00: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
Greenkeeper
2419c0ff2e Update knex-migrator to version 2.0.16 🚀 (#8174)
* chore(package): update knex-migrator to version 2.0.16

https://greenkeeper.io/

* chore: yarn.lock
2017-03-15 23:44:56 +01:00
Greenkeeper
c8cc492252 Update knex to version 0.12.8 🚀 (#8173)
* chore(package): update knex to version 0.12.8

https://greenkeeper.io/

* chore: yarn.lock
2017-03-15 23:15:19 +01:00
Greenkeeper
c289508c4c Update knex-migrator to version 2.0.14 🚀 (#8167)
* chore(package): update knex-migrator to version 2.0.14

https://greenkeeper.io/

* chore: yarn.lock
2017-03-15 09:36:59 +01:00
Kevin Ansfield
b1ea91da92 Version bump to 1.0.0-alpha.16 2017-03-14 19:06:41 +00:00
Kevin Ansfield
5afcfe092b Updated Ghost-Admin to 1.0.0-alpha.16 2017-03-14 19:06:41 +00:00
Ryan McCarvill
f61aa662c1 Removed ghost editor dependency (#8137)
refs #7429
- ☢️ 👷🏻‍♀️ This PR removes the dependency on Ghost-Editor and replaces it with the Mobiledoc DOM renderer. It includes new DOM based default cards and atoms.
2017-03-14 18:07:33 +00:00
kirrg001
8382be1ada Upgrading Casper to ghost-1.0 2017-03-14 18:13:39 +01:00
Hannah Wolfe
3416c05064 Posts per page as theme-config (#8149)
closes #8131

- Remove ppp from default-settings.json
- Remove ppp from meta (unused?\!)
-  Basic concept of theme config
- use theme config ppp setting
-  Make @config.posts_per_page helper available
- rather than @blog.posts_per_page, we now have @config.posts_per_page
- 🚨 Test updates
- Adding TODO note
2017-03-14 18:03:36 +01:00
Hannah Wolfe
b8162b15e3 🐛 Move meta description into ghost head (#8150)
closes #4424

- meta description is an optional SEO tag that we can provide when we have sensible output
- in the cases where we have no useful output, we should not output the tag at all
- ghost_head now takes care of this, and themes should not include their own meta description tag
2017-03-14 17:50:35 +01:00
Hannah Wolfe
f52e3e779b 🎨 Allow foreach else inside of get helper (#8160)
closes #7242

- before this, the get helper's else was used for empty resultsets
- the argument was made that we should fall through to a foreach or with helper's else instead
- I agree that this is the more natural, consistent approach, and so would like to change it for Ghost 1.0

E.g. as of this PR we now have:

{{#get "posts" filter="tag:doesnt-exist"}}
  {{#foreach posts}}
  {{else}}
    this ges executed because there are no results
  {{/foreach}}
{{/get}}

instead of

{{#get "posts" filter="tag:doesnt-exist"}}
  {{#foreach posts}}
  {{else}}
  {{/foreach}}
{{each}}
    this ges executed because there are no results
{{/get}}
2017-03-14 17:44:52 +01:00
kirrg001
6be00b1e33 Updated Ghost-Admin 2017-03-14 17:10:31 +01: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
f4a68a2e52 🔥 remove gulp (#8159)
* remove gulpfile
* remove gulp dependencies
* Update README.md
2017-03-14 14:20:53 +00:00
Hannah Wolfe
5605c964e4 🔥 Remove legacy content zero hack (#8156)
refs #7491

- this hack is so legacy I almost forgot about it 😈
- in the beginning of Ghost there were no post images
- someone figured out you could do {{content words="0"}} and it would pull out the first image in your post
- this was never documented, but enough theme developers found it that when we upgraded downsize to get rid of the bug
- we needed to add a hack to keep compatibility.
- This has to die in 🔥  for Ghost 1.0
2017-03-14 14:56:46 +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
974adee932 🔥 remove fileStorage option (#8144)
refs #8032

- this was used to disable the upload image functionality in Ghost-Admin
- we no longer need this boolean, because people can add their own storage adapter
2017-03-14 10:31:33 +00:00
Hannah Wolfe
27ee1dc7b8 Implement custom errors 2.0 (#8148)
closes #8079

- add a new view type of defaultViews, as this is NOTHING to do with the admin!
- rename user-error.hbs to error.hbs, because this can be for any sort of error
- reimplement custom errors, but with a stack like channels & single templates
- change ghost_head to only not output on 500+ server errors, rather than 400+ user errors
- add coverage for the new template functions
2017-03-14 10:06:42 +01:00
Hannah Wolfe
bb3cc8c0f8 Reimplement custom theme templates (#8147)
closes #8082

- Update the `pickTemplate` logic to
  a) rely on getActive().hasTemplate() instead of being passed a list of paths
  b) support the concept of a fallback, which is returned if there is no theme, or if the theme doesn't have a more specific template
- Update every instance of template picking, across the 3 internalApps, and render-channel, to use this new logic
- update the tests
2017-03-14 00:15:50 +01:00
Hannah Wolfe
b06f03b370 New fully-loaded & validated activeTheme concept (#8146)
📡 Add debug for the 3 theme activation methods
There are 3 different ways that a theme can be activated in Ghost:

A. On boot: we load the active theme from the file system, according to the `activeTheme` setting
B. On API "activate": when an /activate/ request is triggered for a theme, we validate & change the `activeTheme` setting
C. On API "override": if uploading a theme with the same name, we override. Using a dirty hack to make this work.

A: setting is done, should load & validate + next request does mounting
B: load is done, should validate & change setting + next request does mounting
C: load, validate & setting are all done + a hack is needed to ensure the next request does mounting

 Validate w/ gscan when theme activating on boot
- use the new gscan validation validate.check() method when activating on boot

 New concept of active theme
- add ActiveTheme class
- make it possible to set a theme to be active, and to get the active theme
- call the new themes.activate() method in all 3 cases where we activate a theme

🎨 Use new activeTheme to simplify theme code
- make use of the new concept where we can, to reduce & simplify code
- use new hasPartials() method so we don't have to do file lookups
- use path & name getters to reduce use of getContentPath etc
- remove requirement on req.app.get('activeTheme') from static-theme middleware (more on this soon)

🚨 Improve theme unit tests (TODO: fix inter-dep)
- The theme unit tests are borked! They all pass because they don't test the right things.
- This improves them, but they are still dependent on each-other
- configHbsForContext tests don't pass if the activateTheme tests aren't run first
- I will fix this in a later PR
2017-03-13 21:13:17 +01:00
Katharina Irrgang
7556e68c48 🎨 Ghost bootstrap: optimise requires (#8121)
* 🎨  Ghost bootstrap: optimise requires

no issue

- require as less as possible on bootstrap

* do not load icojs on bootstrap
2017-03-13 20:07:12 +00:00
Katharina Irrgang
e0cd5b55ce 🎨 fetch user profile by auth id (#8110)
no issue

- this is secured by client credentials
- you can only fetch the user info if the user is connected to your blog (invited, owner)
- passport ghost instance stores the client credentials in the instance, no need to pass them into
- tested on staging
2017-03-13 19:49:30 +00:00
Katharina Irrgang
ea0f696c4d 🐛 fix usages of logError (#8138)
no issue
2017-03-13 19:47:09 +00:00
Hannah Wolfe
e060a4f811 🎨 🐛 Improve theme lib, middleware & error handling (#8145)
no issue

🎨 simplify loader - use loadOneTheme for init
- use loadOneTheme for init
- move updateThemeList to the one place that it is used
- this just reduces the surface area of the loader

🎨 Move init up to index temporarily
- need to figure out what stuff goes in here as well as loading themes
- will move it again later once I've got it figured out

🎨 Reorder & cleanup theme middleware
- move the order in blog/app.js so that theme middleware isn't called for shared assets
- add comments & cleanup in the middleware itself, for clarity

🎨 Simplify the logic in themes middleware
- Separate out config dependent on settings changing and config dependent on request
- Move blogApp.set('views') - no reason why this isn't in the theme activation method as
  it's actually simpler if it is there, we already know the active theme exists & can remove the if-guard

🎨 Improve error handling for missing theme
- ensure we display a warning
- don't have complex logic for handling errors
- move loading of an empty hbs object into the error-handler as this will support more cases

🐛 Fix assetHash clearing bug on theme switch
- asset hash wasn't correctly being set on theme switch

🎨 Remove themes.read & test loader instead
- Previously, we've simplified loader & improved error handling
- We are now able to completely remove theme.read as it's nothing more than a wrapper for package.read
- This also means we can change our tests from testing the theme reader to loader
2017-03-13 17:30:35 +01:00
Katharina Irrgang
c9f551eb96 suspend user feature (#8114)
refs #8111 
- Ghost returns now all (active+none active) users by default
- protect login with suspended status
- test permissions and add extra protection for suspending myself
- if a user is suspended and tries to activate himself, he won't be able to proceed the login to get a new token
2017-03-13 12:03:26 +00:00
Hannah Wolfe
b2f1d0559b Themes API activation permissions & validation (#8104)
refs #8093

 Add activate theme permission
- add permission to activate themes
- update tests
- also: update tests for invites
TODO: change how the active theme setting is updated to reduce extra permissions

 Move theme validation to gscan
- add a new gscan validation method and use it for upload
- update activate endpoint to do validation also using gscan
- change to using SettingsModel instead of API so that we don't call validation or permissions on the settings API
- remove validation from the settings model
- remove the old validation function
- add new invalid theme message to translations & remove a bunch of theme validation related unused keys

📖  Planned changes

🚨 Tests for theme activation API endpoint
🐛 Don't allow deleting the active theme

🚫 Prevent activeTheme being set via settings API
- We want to control how this happens in future.
- We still want to store the information in settings, via the model.
- We just don't want to be able to change this info via the settings edit endpoint

🐛  Fix warnings for uploads & add for activations
- warnings for uploads were broken in f8b498d
- fix the response + adds tests to cover that warnings are correctly returned
- add the same response to activations + more tests
- activations now return a single theme object - the theme that was activated + any warnings

🎨 Improve how we generate theme API responses
- remove the requirement to pass in the active theme!
- move this to a specialist function, away from the list

🎨 Do not load gscan on boot
2017-03-13 12:44:44 +01:00