Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added file missing in previous commit.
- Loading branch information
Showing
30 changed files
with
229 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env node | ||
require('../lib').cli() |
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,19 @@ | ||
program = require 'commander' | ||
|
||
program | ||
.command('new [name]') | ||
.description('create a new app and/or extension') | ||
.usage('[name] [options]') | ||
.option('-t, --template [name]', 'template to use') | ||
.option('-c, --config [config file]', 'config file to use') | ||
.action (name, opts={}) -> | ||
if not name | ||
return console.log 'Name of project required' | ||
|
||
require('./generator') name, opts | ||
|
||
help = -> console.log program.helpInformation() | ||
|
||
program.parse process.argv | ||
|
||
help() unless program.args.length |
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,38 @@ | ||
fs = require 'fs' | ||
mote = require 'mote' | ||
wrench = require 'wrench' | ||
|
||
{basename, join} = require 'path' | ||
{encoding, exec, existsSync} = require './utils' | ||
|
||
module.exports = (name, {config, template}) -> | ||
template = template or 'default' | ||
src = join __dirname, '../templates', template | ||
dest = name | ||
|
||
ctx = | ||
name: basename dest | ||
user: process.env.USER | ||
|
||
# update context with config options. | ||
if config | ||
for key, val of require config | ||
ctx[key] = val | ||
|
||
# make sure we don't clobber an existing directory. | ||
if existsSync dest | ||
return console.log "#{dest} already exists." | ||
|
||
# copy template to dest | ||
wrench.copyDirSyncRecursive src, dest | ||
|
||
# compile templates with configuration | ||
for file in wrench.readdirSyncRecursive dest | ||
|
||
file = join dest, file | ||
|
||
if fs.statSync(file).isFile() and not (/\.png$/.test file) | ||
console.log file | ||
buffer = fs.readFileSync file | ||
template = mote.compile buffer.toString() | ||
fs.writeFileSync file, template ctx |
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,10 @@ | ||
{existsSync} = require './utils' | ||
|
||
# If `../src` exists then require the CoffeeScript source files. | ||
if existsSync __dirname + '/../src' | ||
require 'coffee-script' | ||
wrapper = require '../src/wrapper' | ||
else | ||
wrapper = require './wrapper' | ||
|
||
module.exports = wrapper |
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,46 @@ | ||
fs = require 'fs' | ||
path = require 'path' | ||
{spawn} = require 'child_process' | ||
|
||
# The location of exists/existsSync changed in node v0.8.0. | ||
if fs.existsSync | ||
exports.existsSync = existsSync = fs.existsSync | ||
exports.exists = fs.exists | ||
else | ||
exports.existsSync = existsSync = path.existsSync | ||
exports.exists = path.exists | ||
|
||
exports.exec = (args, callback) -> | ||
# Simple serial execution of commands, no error handling | ||
serial = (arr) -> | ||
complete = 0 | ||
iterate = -> | ||
exports.exec arr[complete], -> | ||
complete += 1 | ||
if complete == arr.length | ||
return | ||
else | ||
iterate() | ||
iterate() | ||
# passed callback as second argument | ||
if typeof opts is 'function' | ||
callback = opts | ||
|
||
if Array.isArray args | ||
return serial args | ||
|
||
args = args.split(/\s+/g) | ||
cmd = args.shift() | ||
proc = spawn cmd, args | ||
|
||
# echo stdout/stderr | ||
proc.stdout.on 'data', (data) -> | ||
process.stdout.write data | ||
|
||
proc.stderr.on 'data', (data) -> | ||
process.stderr.write data | ||
|
||
# callback on completion | ||
proc.on 'exit', (code) -> | ||
if typeof callback is 'function' | ||
callback null, code |
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,2 @@ | ||
exports.cli = -> require './cli' | ||
exports.version = require('../package.json').version |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,8 @@ | ||
<html> | ||
<head> | ||
<title>Hello World App</title> | ||
</head> | ||
<body> | ||
<p>Hello, world!</p> | ||
</body> | ||
</html> |
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 @@ | ||
chrome.experimental.app.onLaunched.addListener(function() { | ||
chrome.app.window.create('index.html'); | ||
}); |
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,15 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "Hello World", | ||
"version": "1", | ||
"icons": { | ||
"16": "icon_16.png", | ||
"128": "icon_128.png" | ||
}, | ||
"app": { | ||
"background": { | ||
"scripts": ["main.js"] | ||
} | ||
}, | ||
"permissions": ["experimental"] | ||
} |
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,18 @@ | ||
// Copyright (c) 2011 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
var min = 1; | ||
var max = 5; | ||
var current = min; | ||
|
||
function updateIcon() { | ||
chrome.browserAction.setIcon({path:"icon" + current + ".png"}); | ||
current++; | ||
|
||
if (current > max) | ||
current = min; | ||
} | ||
|
||
chrome.browserAction.onClicked.addListener(updateIcon); | ||
updateIcon(); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,12 @@ | ||
{ | ||
"name": "A browser action which changes its icon when clicked.", | ||
"version": "1.1", | ||
"background": { "scripts": ["background.js"] }, | ||
"permissions": [ | ||
"tabs", "http://*/*" | ||
], | ||
"browser_action": { | ||
"name": "Click to change the icon's color" | ||
}, | ||
"manifest_version": 2 | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,8 @@ | ||
<html> | ||
<head> | ||
<title>Hello World App</title> | ||
</head> | ||
<body> | ||
<p>Hello, world!</p> | ||
</body> | ||
</html> |
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 @@ | ||
chrome.experimental.app.onLaunched.addListener(function() { | ||
chrome.app.window.create('index.html'); | ||
}); |
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,15 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "Hello World", | ||
"version": "1", | ||
"icons": { | ||
"16": "icon_16.png", | ||
"128": "icon_128.png" | ||
}, | ||
"app": { | ||
"background": { | ||
"scripts": ["main.js"] | ||
} | ||
}, | ||
"permissions": ["experimental"] | ||
} |
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,18 @@ | ||
// Copyright (c) 2011 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
var min = 1; | ||
var max = 5; | ||
var current = min; | ||
|
||
function updateIcon() { | ||
chrome.browserAction.setIcon({path:"icon" + current + ".png"}); | ||
current++; | ||
|
||
if (current > max) | ||
current = min; | ||
} | ||
|
||
chrome.browserAction.onClicked.addListener(updateIcon); | ||
updateIcon(); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,12 @@ | ||
{ | ||
"name": "A browser action which changes its icon when clicked.", | ||
"version": "1.1", | ||
"background": { "scripts": ["background.js"] }, | ||
"permissions": [ | ||
"tabs", "http://*/*" | ||
], | ||
"browser_action": { | ||
"name": "Click to change the icon's color" | ||
}, | ||
"manifest_version": 2 | ||
} |