Skip to content

Commit

Permalink
better it
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Jan 19, 2016
1 parent 0e94d7f commit 3657a54
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 139 deletions.
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
node_modules

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

version.json
compile/
.cache/
release/
43 changes: 21 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
# electron-quick-start
# innobox
This is an example [electron](http://electron.atom.io/) app to show how to update self using [innoSetup](http://www.jrsoftware.org/isinfo.php).

**Clone and run for a quick way to see an Electron in action.**
The name `innobox` is the demo name.

This is a minimal Electron application based on the [Quick Start Guide](http://electron.atom.io/docs/latest/tutorial/quick-start) within the Electron documentation.

A basic Electron application needs just these files:

- `index.html` - A web page to render.
- `main.js` - Starts the app and creates a browser window to render HTML.
- `package.json` - Points to the app's main file and lists its details and dependencies.
## Usage
```
# install dependencies
npm install
You can learn more about each of these components within the [Quick Start Guide](http://electron.atom.io/docs/latest/tutorial/quick-start).
# run app
npm start
```

## To Use
## Package
```
npm i -g gulp
gulp inno
```

To clone and run this repository you'll need [Git](https://git-scm.com) and [Node.js](https://nodejs.org/en/download/) (which comes with [npm](http://npmjs.com)) installed on your computer. From your command line:
This command will package innobox to file `release/innobox-setup.exe`

```bash
# Clone this repository
git clone https://github.com/atom/electron-quick-start
# Go into the repository
cd electron-quick-start
# Install dependencies and run the app
npm install && npm start
```
## More
File `inno-update.js` implement API which defines in <http://electron.atom.io/docs/v0.36.4/api/auto-updater/>

Learn more about Electron and its API in the [documentation](http://electron.atom.io/docs/latest).
## PS
是不是很简单,坑爹的我花了好长时间才想起来可以这么做。

#### License [CC0 (Public Domain)](LICENSE.md)
## License [CC0 (Public Domain)](LICENSE.md)
32 changes: 19 additions & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
var gulp = require('gulp')
var inno = require('gulp-inno');
var electron = require('gulp-electron');
var fs = require('fs');

var gnf = require('./npm-files')
var pkg = require('./package.json')
var compileDir = './compile';

gulp.task('copy', ['copy:modules'], function(){
return gulp.src(['main.js', 'package.json', 'index.html', 'icons/**/*'], {base: './'})
gulp.task('version', function(){
// FIXME(ssx): https://github.com/gulpjs/gulp/blob/master/docs/writing-a-plugin/README.md
var pkg = require('./package.json');
fs.writeFileSync('version.json', JSON.stringify({
version: pkg.version,
}))
})

gulp.task('copy', ['version', 'copy:modules'], function(){
return gulp.src(['*.js', 'package.json', 'index.html', 'icons/**/*'],
{base: './'})
.pipe(gulp.dest(compileDir))
})

gulp.task('copy:modules', function(){
return gulp.src(gnf(), {base: './'}).pipe(gulp.dest(compileDir))
})

gulp.task('electron', function() {
gulp.task('electron', ['copy'], function() {
return gulp.src("")
.pipe(electron({
src: './compile',
Expand All @@ -35,22 +45,18 @@ gulp.task('electron', function() {
icon: 'icons/app.ico',
},
darwin: {
CFBundleDisplayName: pkg.name,
CFBundleIdentifier: pkg.name,
CFBundleName: pkg.name,
CFBundleVersion: pkg.version,
icon: 'icons/app.icns',
CFBundleDisplayName: pkg.name,
CFBundleIdentifier: pkg.name,
CFBundleName: pkg.name,
CFBundleVersion: pkg.version,
icon: 'icons/app.icns',
},
}
}))
.pipe(gulp.dest(""));
})

gulp.task('copy-update', function(){
return gulp.src('./scripts/update.exe').pipe(gulp.dest('./release/v0.35.1/win32-x64/'))
})

gulp.task('inno-setup', ['electron', 'copy-update'], function(){
gulp.task('inno', ['electron'], function(){
return gulp.src('./inno.iss').pipe(inno());
})

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ window.onload = function(){
alert(window.releaseNotes);
}

innoUpdater.setFeedURL('')
innoUpdater.setFeedURL('https://raw.githubusercontent.com/codeskyblue/electron-quick-start/master/example-feed.json')
innoUpdater.on('checking-for-update', function(){
console.log("INFO: Checking update")
})
Expand Down
14 changes: 7 additions & 7 deletions inno.iss
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
; Script generated by the Inno Setup Script Wizard.
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define AppName "innobox"
#define AppVersion "0.0.x"
#define AppPublisher "Netease, Inc"
#define AppURL "https://github.com/codeskyblue"
#define AppExeName "innobox.exe"
#define AppURL "https://github.com/codeskyblue"
#define AppSrcDir "release/v0.35.1/win32-x64/"
#define AppVersion GetFileVersion(AppSrcDir + "innobox.exe")
#define AppPublisher "Netease, Inc"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
Expand All @@ -14,7 +15,7 @@
AppId={{68ADC057-7A63-4DB2-8AFF-2D924BA87E7E}
AppName={#AppName}
AppVersion={#AppVersion}
;AppVerName={#AppName} {#AppVersion}
AppVerName={#AppName} {#AppVersion}
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}
Expand All @@ -34,8 +35,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";

[Files]
Source: "scripts\update.exe"; DestDir: "{userappdata}\{#AppName}"; Flags: onlyifdoesntexist createallsubdirs recursesubdirs
Source: "release/v0.35.1/win32-x64/*"; DestDir: "{app}"; Flags: recursesubdirs; Excludes: "update.exe"
Source: "{#AppSrcDir}/*"; DestDir: "{app}"; Flags: recursesubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Expand Down
10 changes: 0 additions & 10 deletions scripts/build.sh

This file was deleted.

86 changes: 0 additions & 86 deletions scripts/update.go

This file was deleted.

0 comments on commit 3657a54

Please sign in to comment.