This repository has been archived by the owner on Jan 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/generator-dependency-upgrade' into develop
- Loading branch information
Showing
12 changed files
with
158 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"generator-generator": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,103 @@ | ||
|
||
'use strict'; | ||
|
||
var util = require('util'); | ||
var path = require('path'); | ||
var yeoman = require('yeoman-generator'); | ||
var yosay = require('yosay'); | ||
|
||
var TumblrThemeGenerator = yeoman.generators.Base.extend({ | ||
|
||
initializing: function () { | ||
this.pkg = require('../package.json'); | ||
}, | ||
|
||
prompting: function () { | ||
var done = this.async(); | ||
|
||
// Have Yeoman greet the user. | ||
this.log(yosay( | ||
'Welcome to the cool Tumblr Theme generator!' | ||
)); | ||
|
||
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://' | ||
}]; | ||
|
||
this.prompt(prompts, function (props) { | ||
this.contentURL= props.contentURL; | ||
|
||
done(); | ||
}.bind(this)); | ||
}, | ||
|
||
writing: { | ||
|
||
app: function () { | ||
this.dest.mkdir('app'); | ||
this.dest.mkdir('app/themr'); | ||
this.dest.mkdir('app/themr/javascripts'); | ||
this.dest.mkdir('app/theme'); | ||
this.dest.mkdir('app/theme/styles'); | ||
this.dest.mkdir('app/theme/scripts'); | ||
this.src.copy('_package.json', 'package.json'); | ||
this.src.copy('_bower.json', 'bower.json'); | ||
}, | ||
|
||
createconfig: function () { | ||
|
||
var TumblrGenerator = module.exports = function TumblrGenerator(args, options, config) { | ||
|
||
yeoman.generators.Base.apply(this, arguments); | ||
var url = 'tumblrthemr.tumblr.com'; | ||
var userURL = this.contentURL; | ||
|
||
this.on('end', function () { | ||
this.installDependencies({ skipInstall: options['skip-install'] }); | ||
}); | ||
if (typeof userURL === 'string') { | ||
url = userURL; | ||
} | ||
|
||
this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json'))); | ||
}; | ||
this.write( | ||
'app/themr/javascripts/tumblr-themr-1.0.config.js', | ||
'var themrConf = { url: \'' + url + '\', theme: \'theme\' };' | ||
); | ||
}, | ||
|
||
util.inherits(TumblrGenerator, yeoman.generators.Base); | ||
gruntfile: function () { | ||
this.template('Gruntfile.js'); | ||
}, | ||
|
||
TumblrGenerator.prototype.askFor = function askFor() { | ||
projectfiles: function () { | ||
this.src.copy('editorconfig', '.editorconfig'); | ||
this.src.copy('jshintrc', '.jshintrc'); | ||
}, | ||
|
||
var cb = this.async(); | ||
createthemr: function () { | ||
this.src.copy('index.html', 'app/index.html'); | ||
this.src.copy('spinner.gif', 'app/themr/images/spinner.gif'); | ||
this.src.copy('tumblr-themr-1.0.js', 'app/themr/javascripts/tumblr-themr-1.0.js'); | ||
this.src.copy('jquery-1.6.4.min.js', 'app/themr/javascripts/jquery-1.6.4.min.js'); | ||
this.src.copy('sammy.js', 'app/themr/javascripts/sammy.js'); | ||
this.src.copy('sammy.handlebars.js', 'app/themr/javascripts/sammy.handlebars.js'); | ||
}, | ||
|
||
// have Yeoman greet the user. | ||
console.log(this.yeoman); | ||
demotheme: function () { | ||
this.src.copy('theme.tumblr', 'app/theme.tumblr'); | ||
this.src.copy('jquery-1.6.4.min.js', 'app/theme/scripts/jquery-1.6.4.min.js'); | ||
this.src.copy('theme.scss', 'app/theme/styles/main.scss'); | ||
this.src.copy('theme.js', 'app/theme/scripts/main.js'); | ||
} | ||
}, | ||
|
||
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?' | ||
},{ | ||
type: 'confirm', | ||
name: 'agree', | ||
message: 'Would you like to proceed?' | ||
}*/]; | ||
|
||
this.prompt(prompts, function (props) { | ||
//this.themeID = this.sanitizeName(props.themeName); | ||
//this.themeName = props.themeName; | ||
this.contentURL= props.contentURL; | ||
cb(); | ||
}.bind(this)); | ||
|
||
}; | ||
|
||
/** | ||
* TODO: add find and replace to sanitize | ||
*/ | ||
TumblrGenerator.prototype.sanitizeName = function sanitizeName(name) { | ||
return this._.slugify(name); | ||
}; | ||
|
||
TumblrGenerator.prototype.app = function app() { | ||
this.mkdir('app'); | ||
this.mkdir('app/themr'); | ||
this.mkdir('app/themr/javascripts'); | ||
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; | ||
end: function () { | ||
this.installDependencies(); | ||
} | ||
}); | ||
|
||
module.exports = TumblrThemeGenerator; | ||
|
||
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'); | ||
}; | ||
TumblrGenerator.prototype.projectfiles = function projectfiles() { | ||
this.copy('editorconfig', '.editorconfig'); | ||
this.copy('jshintrc', '.jshintrc'); | ||
}; | ||
|
||
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('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'); | ||
}; | ||
TumblrGenerator.prototype.demoTheme = function demotheme() { | ||
this.copy('theme.tumblr', 'app/theme.tumblr'); | ||
this.copy('jquery-1.6.4.min.js', 'app/theme/scripts/jquery-1.6.4.min.js'); | ||
this.copy('theme.scss', 'app/theme/styles/main.scss'); | ||
this.copy('theme.js', 'app/theme/scripts/main.js'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,37 @@ | ||
{ | ||
"name": "generator-tumblr-theme", | ||
"version": "0.2.1", | ||
"description": "A tumblr theme generator for Yeoman", | ||
"keywords": [ | ||
"tumblr", | ||
"theme", | ||
"yeoman-generator" | ||
], | ||
"homepage": "https://github.com/ffffranklin/generator-tumblr-theme", | ||
"bugs": "https://github.com/ffffranklin/generator-tumblr-theme/issues", | ||
"author": { | ||
"name": "Franklin Clark", | ||
"email": "", | ||
"url": "https://github.com/ffffranklin" | ||
}, | ||
"main": "app/index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/ffffranklin/generator-tumblr-theme.git" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"yeoman-generator": "~0.14.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~1.14.0" | ||
}, | ||
"peerDependencies": { | ||
"yo": ">=1.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0", | ||
"npm": ">=1.2.14" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT" | ||
"name": "generator-tumblr-theme", | ||
"version": "0.2.3", | ||
"description": "A tumblr theme generator for Yeoman", | ||
"homepage": "https://github.com/ffffranklin/generator-tumblr-theme", | ||
"bugs": "https://github.com/ffffranklin/generator-tumblr-theme/issues", | ||
"license": "BSD", | ||
"main": "app/index.js", | ||
"repository": "ffffranklin/generator-tumblr-theme", | ||
"author": { | ||
"name": "Franklin Clark", | ||
"email": "", | ||
"url": "https://github.com/ffffranklin" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"keywords": [ | ||
"tumblr", | ||
"theme", | ||
"yeoman-generator" | ||
], | ||
"dependencies": { | ||
"yeoman-generator": "^0.17.0", | ||
"chalk": "^0.5.0", | ||
"yosay": "^0.3.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*" | ||
}, | ||
"peerDependencies": { | ||
"yo": ">=1.0.0" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/*global describe, beforeEach, it*/ | ||
'use strict'; | ||
|
||
var path = require('path'); | ||
var assert = require('yeoman-generator').assert; | ||
var helpers = require('yeoman-generator').test; | ||
var os = require('os'); | ||
|
||
describe('tumblr-theme:app', function () { | ||
before(function (done) { | ||
helpers.run(path.join(__dirname, '../app')) | ||
.inDir(path.join(os.tmpdir(), './temp-test')) | ||
.withOptions({ 'skip-install': true }) | ||
.withPrompt({ | ||
someOption: true | ||
}) | ||
.on('end', done); | ||
}); | ||
|
||
it('creates files', function () { | ||
assert.file([ | ||
'bower.json', | ||
'package.json', | ||
'.editorconfig', | ||
'.jshintrc' | ||
]); | ||
}); | ||
}); |
Oops, something went wrong.