From 869edecb1d2f0a0955c35bdfffe94989d22a400a Mon Sep 17 00:00:00 2001 From: Franklin Clark Date: Thu, 21 Aug 2014 01:34:03 -0700 Subject: [PATCH 1/5] Removing irrelevant readme content --- README.md | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 47c54f3..1f1c9f3 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,16 @@ -# generator-tumblr-theme [![Build Status](https://secure.travis-ci.org/ffffranklin/generator-tumblr-theme.png?branch=master)](https://travis-ci.org/ffffranklin/generator-tumblr-theme) +# Tumblr Theme generator [![Build Status](https://secure.travis-ci.org/ffffranklin/generator-tumblr-theme.png?branch=master)](https://travis-ci.org/ffffranklin/generator-tumblr-theme) -A generator for [Yeoman](http://yeoman.io). +A Tumblr Theme generator for [Yeoman](http://yeoman.io) that allows you to create a theme for Tumblr ## Getting Started -### What is Yeoman? - -Trick question. It's not a thing. It's this guy: - -![](http://i.imgur.com/JHaAlBJ.png) - -Basically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create. - -Not every new computer comes with a Yeoman pre-installed. He lives in the [npm](https://npmjs.org) package repository. You only have to ask for him once, then he packs up and moves into your hard drive. *Make sure you clean up, he likes new and shiny things.* +First install [Yeoman](http://yeoman.io) globally ``` $ npm install -g yo ``` -### Yeoman Generators - -Yeoman travels light. He didn't pack any generators when he moved in. You can think of a generator like a plug-in. You get to choose what type of application you wish to create, such as a Backbone application or even a Chrome extension. To install generator-tumblr-theme from npm, run: @@ -35,11 +24,7 @@ Finally, initiate the generator: $ yo tumblr-theme ``` -### Getting To Know Yeoman - -Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced. - -If you'd like to get to know Yeoman better and meet some of his friends, [Grunt](http://gruntjs.com) and [Bower](http://bower.io), check out the complete [Getting Started Guide](https://github.com/yeoman/yeoman/wiki/Getting-Started). +This will expand the themer assets into your current directory ## License From 7196f51dbdd14eb2b8a5c0fb1b3b258b8ab76dd7 Mon Sep 17 00:00:00 2001 From: ffffranklin Date: Thu, 21 Aug 2014 02:00:48 -0700 Subject: [PATCH 2/5] Update README.md --- README.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1f1c9f3..0087eb4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Tumblr Theme generator [![Build Status](https://secure.travis-ci.org/ffffranklin/generator-tumblr-theme.png?branch=master)](https://travis-ci.org/ffffranklin/generator-tumblr-theme) -A Tumblr Theme generator for [Yeoman](http://yeoman.io) that allows you to create a theme for Tumblr +A Tumblr Theme generator for [Yeoman](http://yeoman.io) that allows you to create a theme for Tumblr. ## Getting Started @@ -11,21 +11,34 @@ First install [Yeoman](http://yeoman.io) globally $ npm install -g yo ``` - To install generator-tumblr-theme from npm, run: ``` $ npm install -g generator-tumblr-theme ``` +Create a theme project folder + +``` +$ mkdir my-theme && cd my-theme +``` + Finally, initiate the generator: ``` $ yo tumblr-theme ``` -This will expand the themer assets into your current directory +This will expand the themer scripts and assets into your theme project directory + +## Custom Content + +By default generator-tumblr-theme uses http://tumblrthemr.tumblr.com as it's content source. In order to use your own blog as a source of test content you need to convert an existing tumblr blog to XML. + +Copy and paste the content of this tumblr theme file to your blog's theme editor +https://raw.githubusercontent.com/ffffranklin/tumblrthemr-xml-theme/master/xml.tumblr +When you visit your tumblr blog you should see an rendered XML ## License From daa98e7a1adbc9af0b30fe80a1946e5960ae1a3d Mon Sep 17 00:00:00 2001 From: ffffranklin Date: Fri, 22 Aug 2014 01:40:01 -0700 Subject: [PATCH 3/5] Update README.md --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0087eb4..1ca2a14 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,23 @@ This will expand the themer scripts and assets into your theme project directory ## Custom Content -By default generator-tumblr-theme uses http://tumblrthemr.tumblr.com as it's content source. In order to use your own blog as a source of test content you need to convert an existing tumblr blog to XML. +By default generator-tumblr-theme uses http://tumblrthemr.tumblr.com as it's content source. In order to use your own blog as a source of test content, you need to convert an existing tumblr blog to XML. + +### Tumblr XML Template Copy and paste the content of this tumblr theme file to your blog's theme editor https://raw.githubusercontent.com/ffffranklin/tumblrthemr-xml-theme/master/xml.tumblr +![](http://i.imgur.com/XvcUpvZ.png) + When you visit your tumblr blog you should see an rendered XML +![](http://i.imgur.com/AhmkkFx.png) + +Configure your tumbler themer to use your new source by entering in a content source when you initially run the generator + +Now your Tumblr Theme will render in your themer app + ## License [MIT License](http://en.wikipedia.org/wiki/MIT_License) From df7a0e08b54f6ac0e1e3e8f00bbfacf5b9a5a254 Mon Sep 17 00:00:00 2001 From: Franklin Clark Date: Sat, 23 Aug 2014 19:50:15 -0700 Subject: [PATCH 4/5] Adding custom content path configuration * Removed config source * Updating README.md with screenshot of new prompt (http://imgur.com/2loXTep) --- README.md | 2 ++ app/index.js | 45 +++++++++++++++++++----- app/templates/index.html | 14 ++++---- app/templates/tumblr-themr-1.0.config.js | 4 --- 4 files changed, 47 insertions(+), 18 deletions(-) delete mode 100644 app/templates/tumblr-themr-1.0.config.js diff --git a/README.md b/README.md index 1ca2a14..e805965 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ When you visit your tumblr blog you should see an rendered XML Configure your tumbler themer to use your new source by entering in a content source when you initially run the generator +![](http://i.imgur.com/2loXTep.png) + Now your Tumblr Theme will render in your themer app ## License diff --git a/app/index.js b/app/index.js index bd963e6..a41799f 100644 --- a/app/index.js +++ b/app/index.js @@ -1,10 +1,13 @@ + 'use strict'; + var util = require('util'); var path = require('path'); var yeoman = require('yeoman-generator'); var TumblrGenerator = module.exports = function TumblrGenerator(args, options, config) { + yeoman.generators.Base.apply(this, arguments); this.on('end', function () { @@ -17,12 +20,25 @@ var TumblrGenerator = module.exports = function TumblrGenerator(args, options, c util.inherits(TumblrGenerator, yeoman.generators.Base); TumblrGenerator.prototype.askFor = function askFor() { + var cb = this.async(); // have Yeoman greet the user. console.log(this.yeoman); - var prompts = [/*{ + var prompts = [{ + type: 'confirm', + name: 'customContent', + message: 'Would you like to use custom content? [No]', + default: false + },{ + // todo: should test url to make sure it's properly configured + when: function (answers) { + return answers && answers.customContent; + }, + name: 'contentURL', + message: 'What is the URL of the content source for this theme? http://' + }/*,{ name: 'themeName', message: 'What is your tumblr name?' },{ @@ -32,18 +48,19 @@ TumblrGenerator.prototype.askFor = function askFor() { }*/]; this.prompt(prompts, function (props) { - this.themeID = this.normalizeName(props.themeName); - this.themeName = props.themeName; + //this.themeID = this.sanitizeName(props.themeName); + //this.themeName = props.themeName; + this.contentURL= props.contentURL; cb(); }.bind(this)); }; /** - * TODO: add find and replace + * TODO: add find and replace to sanitize */ -TumblrGenerator.prototype.normalizeName = function normalizeName(name) { - return name; +TumblrGenerator.prototype.sanitizeName = function sanitizeName(name) { + return this._.slugify(name); }; TumblrGenerator.prototype.app = function app() { @@ -53,11 +70,24 @@ TumblrGenerator.prototype.app = function app() { this.mkdir('app/theme'); this.mkdir('app/theme/styles'); this.mkdir('app/theme/scripts'); - this.copy('_package.json', 'package.json'); this.copy('_bower.json', 'bower.json'); }; +TumblrGenerator.prototype.createConfig= function createConfig() { + + var url = 'tumblrthemr.tumblr.com'; + var userURL = this.contentURL; + + if (typeof userURL === 'string') { + url = userURL; + } + + this.write( + 'app/themr/javascripts/tumblr-themr-1.0.config.js', + 'var themrConf = { url: \'' + url + '\', theme: \'theme\' };' + ); +}; TumblrGenerator.prototype.gruntfile = function gruntfile() { this.template('Gruntfile.js'); }; @@ -70,7 +100,6 @@ TumblrGenerator.prototype.createThemr = function createthemr() { this.copy('index.html', 'app/index.html'); this.copy('spinner.gif', 'app/themr/images/spinner.gif'); this.copy('tumblr-themr-1.0.js', 'app/themr/javascripts/tumblr-themr-1.0.js'); - this.copy('tumblr-themr-1.0.config.js', 'app/themr/javascripts/tumblr-themr-1.0.config.js'); this.copy('jquery-1.6.4.min.js', 'app/themr/javascripts/jquery-1.6.4.min.js'); this.copy('sammy.js', 'app/themr/javascripts/sammy.js'); this.copy('sammy.handlebars.js', 'app/themr/javascripts/sammy.handlebars.js'); diff --git a/app/templates/index.html b/app/templates/index.html index 2033f2d..e8d8c3d 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -217,12 +217,14 @@ diff --git a/app/templates/tumblr-themr-1.0.config.js b/app/templates/tumblr-themr-1.0.config.js deleted file mode 100644 index e4170b5..0000000 --- a/app/templates/tumblr-themr-1.0.config.js +++ /dev/null @@ -1,4 +0,0 @@ -var themrConf = { - url: 'tumblrthemr.tumblr.com', - theme: 'theme' -}; \ No newline at end of file From 4bb0e7293ed23171b99d924d062c81e831c02038 Mon Sep 17 00:00:00 2001 From: ffffranklin Date: Sat, 23 Aug 2014 19:58:52 -0700 Subject: [PATCH 5/5] Update README.md --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e805965..2495f24 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,17 @@ When you visit your tumblr blog you should see an rendered XML ![](http://i.imgur.com/AhmkkFx.png) -Configure your tumbler themer to use your new source by entering in a content source when you initially run the generator +Configure your tumbler themer to use your new source by entering in a content source when you initially run the generator. ![](http://i.imgur.com/2loXTep.png) +You can always update the config file, post generation, here: + +``` +$ cat app/themr/javascripts/tumblr-themr-1.0.config.js +var themrConf = { url: 'myblog.tumblr.com', theme: 'theme' }; +``` + Now your Tumblr Theme will render in your themer app ## License