var _ = require('lodash'), uuid = require('uuid'), ObjectId = require('bson-objectid'), moment = require('moment'), globalUtils = require('../../../server/utils'), DataGenerator = {}; /*jshint quotmark:false*/ // jscs:disable validateQuoteMarks, requireCamelCaseOrUpperCaseIdentifiers DataGenerator.Content = { posts: [ { id: ObjectId.generate(), title: "HTML Ipsum", slug: "html-ipsum", markdown: "

HTML Ipsum Presents

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.

Header Level 2

  1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  2. Aliquam tincidunt mauris eu risus.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.

Header Level 3

#header h1 a{display: block;width: 300px;height: 80px;}
", published_at: new Date("2015-01-01") }, { id: ObjectId.generate(), title: "Ghostly Kitchen Sink", slug: "ghostly-kitchen-sink", markdown: "

HTML Ipsum Presents

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.

Header Level 2

  1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  2. Aliquam tincidunt mauris eu risus.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.

Header Level 3

#header h1 a{display: block;width: 300px;height: 80px;}
", published_at: new Date("2015-01-02") }, { id: ObjectId.generate(), title: "Short and Sweet", slug: "short-and-sweet", markdown: "## testing\n\nmctesters\n\n- test\n- line\n- items", html: "

testing

\n\n

mctesters

\n\n", image: "http://placekitten.com/500/200", meta_description: "test stuff", published_at: new Date("2015-01-03"), uuid: "2ac6b4f6-e1f3-406c-9247-c94a0496d39d" }, { id: ObjectId.generate(), title: "Not finished yet", slug: "unfinished", markdown: "

HTML Ipsum Presents

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.

Header Level 2

  1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  2. Aliquam tincidunt mauris eu risus.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.

Header Level 3

#header h1 a{display: block;width: 300px;height: 80px;}
", status: "draft", uuid: "d52c42ae-2755-455c-80ec-70b2ec55c903", featured: false }, { id: ObjectId.generate(), title: "Not so short, bit complex", slug: "not-so-short-bit-complex", markdown: "

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.

1234
abcd
efgh
ijkl
Definition list
Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Lorem ipsum dolor sit amet
Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

" }, { id: ObjectId.generate(), title: "This is a static page", slug: "static-page-test", markdown: "

Static page test is what this is for.

Hopefully you don't find it a bore.

", page: 1 }, { id: ObjectId.generate(), title: "This is a draft static page", slug: "static-page-draft", markdown: "

Static page test is what this is for.

Hopefully you don't find it a bore.

", page: 1, status: "draft" }, { id: ObjectId.generate(), title: "This is a scheduled post!!", slug: "scheduled-post", markdown: "

Welcome to my invisible post!

", status: "scheduled", published_at: moment().add(2, 'days').toDate() } ], tags: [ { id: ObjectId.generate(), name: "kitchen sink", slug: "kitchen-sink" }, { id: ObjectId.generate(), name: "bacon", slug: "bacon" }, { id: ObjectId.generate(), name: "chorizo", slug: "chorizo" }, { id: ObjectId.generate(), name: "pollo", slug: "pollo" }, { id: ObjectId.generate(), name: "injection", slug: "injection" } ], // Password = Sl1m3rson users: [ { // owner (owner is still id 1 because of permissions) id: '1', name: 'Joe Bloggs', slug: 'joe-bloggs', email: 'jbloggs@example.com', password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6' }, { // admin id: ObjectId.generate(), name: 'Smith Wellingsworth', slug: 'smith-wellingsworth', email: 'swellingsworth@example.com', password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6' }, { // editor id: ObjectId.generate(), name: 'Jimothy Bogendath', slug: 'jimothy-bogendath', email: 'jbOgendAth@example.com', password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6' }, { // author id: ObjectId.generate(), name: 'Slimer McEctoplasm', slug: 'slimer-mcectoplasm', email: 'smcectoplasm@example.com', password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6' }, { // editor 2 id: ObjectId.generate(), name: 'Ivan Email', slug: 'ivan-email', email: 'info1@ghost.org', password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6' }, { // author 2 id: ObjectId.generate(), name: 'Author2', slug: 'a-2', email: 'info2@ghost.org', password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6' }, { // admin 2 id: ObjectId.generate(), name: 'admin2', slug: 'ad-2', email: 'info3@ghost.org', password: '$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKZL6' } ], permissions: [ { id: ObjectId.generate(), name: 'Browse posts', action_type: 'browse', object_type: 'post' }, { id: ObjectId.generate(), name: 'test', action_type: 'edit', object_type: 'post' }, { id: ObjectId.generate(), name: 'test', action_type: 'edit', object_type: 'tag' }, { id: ObjectId.generate(), name: 'test', action_type: 'edit', object_type: 'user' }, { id: ObjectId.generate(), name: 'test', action_type: 'edit', object_type: 'page' }, { id: ObjectId.generate(), name: 'test', action_type: 'add', object_type: 'post' }, { id: ObjectId.generate(), name: 'test', action_type: 'add', object_type: 'user' }, { id: ObjectId.generate(), name: 'test', action_type: 'add', object_type: 'page' }, { id: ObjectId.generate(), name: 'test', action_type: 'destroy', object_type: 'post' }, { id: ObjectId.generate(), name: 'test', action_type: 'destroy', object_type: 'user' } ], roles: [ { id: ObjectId.generate(), name: 'Administrator', description: 'Administrators' }, { id: ObjectId.generate(), name: 'Editor', description: 'Editors' }, { id: ObjectId.generate(), name: 'Author', description: 'Authors' }, { id: ObjectId.generate(), name: 'Owner', description: 'Blog Owner' } ], apps: [ { id: ObjectId.generate(), name: 'Kudos', slug: 'kudos', version: '0.0.1', status: 'installed' }, { id: ObjectId.generate(), name: 'Importer', slug: 'importer', version: '0.1.0', status: 'inactive' }, { id: ObjectId.generate(), name: 'Hemingway', slug: 'hemingway', version: '1.0.0', status: 'installed' } ], app_fields: [ { id: ObjectId.generate(), key: 'count', value: '120', type: 'number', active: true }, { id: ObjectId.generate(), key: 'words', value: '512', type: 'number', active: true } ], app_settings: [ { id: ObjectId.generate(), key: 'color', value: 'ghosty' }, { id: ObjectId.generate(), key: 'setting', value: 'value' } ], subscribers: [ { id: ObjectId.generate(), email: 'subscriber1@test.com' }, { id: ObjectId.generate(), email: 'subscriber2@test.com' } ] }; DataGenerator.Content.subscribers[0].post_id = DataGenerator.Content.posts[0].id; DataGenerator.forKnex = (function () { var posts, tags, posts_tags, apps, app_fields, roles, users, roles_users, clients, invites; function createBasic(overrides) { var newObj = _.cloneDeep(overrides); return _.defaults(newObj, { id: ObjectId.generate(), created_by: DataGenerator.Content.users[0].id, created_at: new Date(), updated_by: DataGenerator.Content.users[0].id, updated_at: new Date() }); } function createPost(overrides) { var newObj = _.cloneDeep(overrides); return _.defaults(newObj, { id: ObjectId.generate(), uuid: uuid.v4(), title: 'title', status: 'published', html: overrides.markdown, language: 'en_US', featured: true, page: false, author_id: DataGenerator.Content.users[0].id, updated_at: new Date(), updated_by: DataGenerator.Content.users[0].id, created_at: new Date(), created_by: DataGenerator.Content.users[0].id, published_at: new Date(), published_by: DataGenerator.Content.users[0].id }); } function createGenericPost(uniqueInteger, status, language, author_id) { status = status || 'draft'; language = language || 'en_US'; author_id = author_id || DataGenerator.Content.users[0].id; return createPost({ id: ObjectId.generate(), title: 'Test Post ' + uniqueInteger, slug: 'ghost-from-fiction-to-function-' + uniqueInteger, author_id: author_id, markdown: "Three days ago I released a concept page<\/a> for a lite version of WordPress that I've been thinking about for a long time, called Ghost. I think it's fair to say that I didn't quite anticipate how strong the reaction would be - and I've hardly had time to catch my breath in the last 72 hours.\n\nThe response was overwhelming, and overwhelmingly positive. In the first 6 hours my site got 35,000 page views after hitting the number 1 slot on Hacker News<\/a>. As of right now, the traffic count is just over 91,000 page views<\/a> - and Ghost has been featured all over the place. Notable mentions so far include Christina Warren from Mashable, who wrote about it<\/a>. Michael Carney from PandoDaily interviewed me about it<\/a>. Someone even wrote about it in Chinese<\/a>. That's pretty cool.\n\n\nThe feedback has been amazing, and while it's impossible to reply to all of the messages individually, I'm getting to as many of them as I can and I want to thank each and every one of you who took the time to send me a message or share the concept because you liked it. Now that the initial storm has died down a bit, I wanted to take some time to answer some of the more common questions and talk about what's next.\n

FAQ - Continued...<\/h2>\n\nThe most common question, bizarrely:\n

Oh my god, why is that whole page made of images? What's wrong with you? \/\/ I can't take you seriously \/\/ Don't you know anything about the web? \/\/ You are literally Satan re-incarnate.<\/strong><\/em><\/h5>\n\nThis was really the only negativity I got in response to the post, and it surprised me. I put together the concept page as... just that... a concept. It was a way for me to get the ideas out of my head and \"down on paper\" - or so to speak. I used photoshop as a tool<\/em> to write down my idea with text and images. If I used a sketchbook as a tool <\/em>to create images and handwritten notes, then uploaded scans of it, I doubt anyone would complain. The concept page was never supposed to be a finished product because I had no idea if there would be any interest in it. I had no motivation to waste hours coding a custom layout for something might only ever be read by a few people and then forgotten.\n\nHardware manufacturers make hundreds of foam cutout prototypes of products before they build one with working buttons and screens. I'm aware of all the usability problems with a web page made of images, and equally, foam cutouts without buttons or screens aren't particularly user friendly either. They're not supposed to be.\n\nLet's move on.\n
What? Why no comments? I need comments.<\/strong><\/em><\/h5>\n\nBecause comments add a layer of complexity that is beyond the core focus of this platform, which is publishing. Again, that's not to say you couldn't have any comments. This could easily be added with a dedicated plugin where you own the data or (as mentioned) there are third party providers such as Disqus, IntenseDebate, Livefyre and Facebook who all have great platforms. The point of this isn't to say \"you can't have comments\" - it's to say \"comments aren't on by default\". It's about simplicity, more than anything else.\n
Yeah, but WordPress are already going to revise their dashboard, WordPress.com is experimenting with a potential simplified version... so why bother with this?<\/strong><\/em><\/h5>\n\n\"\"<\/a>\n\nSorry, but Tumblr already did this - it's not the future of blogging, it's the past.\n\nGhost isn't about sharing \"Fuck Yeah [Dogs<\/a>\/Sharks<\/a>\/Girls with Tattoos<\/a>]\" - it's about publishing - which means writing - rather than mashing a few buttons to make sure that everyone can see and appreciate your latest funny picture\/status, which is surely the most funny picture\/status you've ever posted.\n\nTumblr, Pinterest and Facebook already have this locked down. It's not the future.\n
So... are you actually going to build this thing?<\/strong><\/em><\/h5>\n\nThe concept page was a way for me to test demand and interest. To see if anyone actually agreed with my frustrations and, more importantly, my solutions. I plucked a random figure of \"10,000 pageviews\" out of the air before I hit the publish button. If it got less than 10,000 pageviews, I would surrender to the fact that it would only ever be an idea. I've now exceeded that goal 9 times over, so yes, I'm looking at how Ghost can now be made into a reality.\n
How can I find out when it's done? \/\/ SHUT UP AND TAKE MY MONEY<\/strong><\/em><\/h5>\n\nOk, ok - there's a holding page up on http:\/\/TryGhost.org<\/a> - put your email address in.\n
\n

How are you going to do this?<\/h3>\n\nThere's three main ways of going about this, each has merits as well as drawbacks.\n\n1.) Build it from scratch<\/strong><\/em> - Many people (particularly the Hacker News crowd) expressed the sentiment that there was little point in forking WordPress. When you're going to strip out so much, you get to a point where you might as well start from scratch anyway. Take away the crutches of being stuck with older technologies and put together something which is as sophisticated in code as it is in UI\/UX.\n