This commit is contained in:
Cheng Zhao 2013-11-06 18:34:29 +08:00
Родитель 8979943ab0
Коммит 43dbaee5f6
5 изменённых файлов: 100 добавлений и 1 удалений

40
Gruntfile.coffee Normal file
Просмотреть файл

@ -0,0 +1,40 @@
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
glob_to_multiple:
expand: true
cwd: 'src'
src: ['*.coffee']
dest: 'lib'
ext: '.js'
coffeelint:
options:
no_empty_param_list:
level: 'error'
max_line_length:
level: 'ignore'
src: ['src/*.coffee']
gruntfile: ['Gruntfile.coffee']
grunt.loadNpmTasks('grunt-contrib-coffee')
grunt.loadNpmTasks('grunt-shell')
grunt.loadNpmTasks('grunt-coffeelint')
grunt.registerTask 'clean', ->
rm = (pathToDelete) ->
grunt.file.delete(pathToDelete) if grunt.file.exists(pathToDelete)
rm('lib')
grunt.registerTask('lint', ['coffeelint'])
grunt.registerTask('default', ['coffee', 'lint'])
grunt.registerTask('prepublish', ['clean', 'coffee', 'lint'])

Просмотреть файл

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2013 Atom
Copyright (c) 2013 GitHub, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

Двоичные данные
bin/rcedit.exe Executable file

Двоичный файл не отображается.

28
package.json Normal file
Просмотреть файл

@ -0,0 +1,28 @@
{
"name": "node-rcedit",
"version": "0.1.0",
"description": "Node module to edit resources of exe",
"main": "lib/rcedit.js",
"scripts": {},
"repository": {
"type": "git",
"url": "https://github.com/atom/node-rcedit.git"
},
"bugs": {
"url": "https://github.com/atom/node-rcedit/issues"
},
"licenses": [
{
"type": "MIT",
"url": "http://github.com/atom/node-nslog/raw/master/LICENSE.md"
}
],
"devDependencies": {
"grunt-contrib-coffee": "~0.7.0",
"grunt-cli": "~0.1.8",
"grunt": "~0.4.1",
"grunt-shell": "~0.2.2",
"grunt-coffeelint": "0.0.6"
}
}

31
src/rcedit.coffee Normal file
Просмотреть файл

@ -0,0 +1,31 @@
path = require 'path'
{spawn} = require 'child_process'
pairSettings = ['version-string']
singleSettings = ['file-version', 'product-version', 'icon']
module.exports = (exe, options, callback) ->
rcedit = path.resolve __dirname, '..', 'bin', 'rcedit.exe'
args = [exe]
for name in pairSettings
if options[name]?
for key, value of options[name]
args.push "--set-#{name}"
args.push key
args.push value
for name in singleSettings
if options[name]?
args.push "--set-#{name}"
args.push options[name]
child = spawn rcedit, args
stderr = ''
child.stderr.on 'data', (data) -> stderr += data
child.on 'close', (code) ->
if code is 0
callback null
else
callback stderr