Skip to content

Commit 7542282

Browse files
initial commit
ripped out webpack to try the electron-prebuilt-compile package
0 parents  commit 7542282

File tree

19 files changed

+613
-0
lines changed

19 files changed

+613
-0
lines changed

.babelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"presets": [
3+
"stage-2",
4+
"es2016-node5"
5+
]
6+
}

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
dist/
3+
tests/
4+
sh.exe.stackdump

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# copybot
2+
3+
> GUI based app to watch source file / folder changes and copy those files to the target location
4+
5+
# This app is still in development.
6+
7+
#### Dev note: Was using webpack, switched to electron-prebuilt-compile.
8+
#### https://github.com/electron/electron/tree/master/docs
9+
10+
## Build Setup
11+
12+
``` bash
13+
# install dependencies
14+
npm install
15+
16+
# start the electron app
17+
npm start
18+
```

index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>CopyBot</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<link rel="stylesheet" href="./node_modules/vue-material/dist/vue-material.css">
8+
<!-- <link rel="stylesheet" href="src/scss/app.scss" type="text/scss"> -->
9+
<!-- todo: remove this and self host fonts -->
10+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
11+
</head>
12+
<body>
13+
<div id="app"></div>
14+
<script src="src/main.js"></script>
15+
</body>
16+
</html>

package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "copybot",
3+
"version": "1.0.0",
4+
"description": "GUI based app to watch source file / folder changes and copy those files to the target location",
5+
"main": "main.js",
6+
"private": true,
7+
"scripts": {
8+
"start": "electron window.js",
9+
"test": "echo \"Error: no test specified\" && exit 1"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/makeshift-array/copybot.git"
14+
},
15+
"keywords": [],
16+
"author": "Makeshift Array",
17+
"license": "MIT",
18+
"bugs": {
19+
"url": "https://github.com/makeshift-array/copybot/issues"
20+
},
21+
"homepage": "https://github.com/makeshift-array/copybot#readme",
22+
"dependencies": {
23+
"electron-compile": "^6.1.3",
24+
"vue": "^2.2.6",
25+
"vue-material": "^0.7.1",
26+
"vueify": "^9.4.1",
27+
"vuex": "^2.2.1"
28+
},
29+
"devDependencies": {
30+
"babel-preset-es2016-node5": "^1.1.2",
31+
"babel-preset-stage-2": "^6.22.0",
32+
"electron-compilers": "^5.6.0",
33+
"electron-devtools-installer": "^2.1.0",
34+
"electron-prebuilt-compile": "^1.6.2"
35+
}
36+
}

src/App.vue

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<template>
2+
<div id="app">
3+
<app-header></app-header>
4+
<md-tabs class="md-transparent">
5+
<md-tab md-icon="layers">
6+
<groups></groups>
7+
</md-tab>
8+
9+
<md-tab md-icon="create_new_folder">
10+
<watchers></watchers>
11+
</md-tab>
12+
</md-tabs>
13+
14+
<new-group-dialog></new-group-dialog>
15+
<new-watcher-dialog></new-watcher-dialog>
16+
</div>
17+
</template>
18+
19+
<script>
20+
import Header from './components/Header'
21+
import Groups from './components/groups/Groups'
22+
import Watchers from './components/watchers/Watchers'
23+
import NewGroupDialog from './components/dialogs/NewGroupDialog'
24+
import NewWatcherDialog from './components/dialogs/NewWatcherDialog'
25+
26+
import fs from 'fs'
27+
28+
export default {
29+
name: 'app',
30+
components: {
31+
'app-header': Header,
32+
Groups,
33+
Watchers,
34+
NewGroupDialog,
35+
NewWatcherDialog
36+
},
37+
data () {
38+
return {
39+
modalOpen: false
40+
}
41+
}
42+
}
43+
</script>
44+
45+
<style scoped>
46+
</style>

src/components/Header.vue

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<template>
2+
<div>
3+
<md-toolbar class="md-dense">
4+
<h2 class="md-title">CopyBot</h2>
5+
6+
<md-button class="md-icon-button">
7+
<md-icon>sync</md-icon>
8+
<md-tooltip md-direction="bottom">Sync All</md-tooltip>
9+
</md-button>
10+
11+
<md-button class="md-icon-button" @click.native="openDialog('new-group-dialog')">
12+
<md-icon>layers</md-icon>
13+
<md-tooltip md-direction="bottom">New Group</md-tooltip>
14+
</md-button>
15+
16+
<md-button class="md-icon-button" @click.native="openDialog('new-watcher-dialog')">
17+
<md-icon>create_new_folder</md-icon>
18+
<md-tooltip md-direction="bottom">New Watcher</md-tooltip>
19+
</md-button>
20+
</md-toolbar>
21+
</div>
22+
</template>
23+
24+
<script>
25+
import events from '../events'
26+
27+
export default {
28+
name: 'header',
29+
methods: {
30+
openDialog (name) {
31+
events.$emit(`open:dialog:${name}`)
32+
},
33+
closeDialog (name) {
34+
events.$emit(`open:dialog:${name}`)
35+
}
36+
}
37+
}
38+
</script>
39+
40+
<style scoped>
41+
.header {
42+
display: flex;
43+
align-items: center;
44+
justify-content: flex-end;
45+
}
46+
47+
.md-title {
48+
flex: 1;
49+
}
50+
</style>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<template>
2+
<md-dialog @open="reset" ref="new-group-dialog">
3+
<md-dialog-title>Add New Group</md-dialog-title>
4+
5+
<md-dialog-content>
6+
<!-- Groups help maintain endless amounts of projects -->
7+
8+
<md-input-container :class="{ 'md-input-invalid': hasError }">
9+
<label>Group Name</label>
10+
<md-input @keyup.native="hasError = false" @keyup.native.enter="onSubmit" v-model="name" required></md-input>
11+
<span class="md-error">{{ errorMessage }}</span>
12+
</md-input-container>
13+
</md-dialog-content>
14+
15+
<md-dialog-actions>
16+
<md-spinner :md-size="20" md-indeterminate class="md-accent" v-if="isSubmitting"></md-spinner>
17+
<md-button class="md-primary" @click.native="closeDialog">Cancel</md-button>
18+
<md-button class="md-primary" @click.native="onSubmit">Ok</md-button>
19+
</md-dialog-actions>
20+
</md-dialog>
21+
</template>
22+
23+
<script>
24+
import { mapGetters, mapMutations } from 'vuex'
25+
import events from '../../events'
26+
27+
export default {
28+
name: 'new-group-dialog',
29+
data () {
30+
return {
31+
name: '',
32+
hasError: false,
33+
isSubmitting: false,
34+
errorMessage: ''
35+
}
36+
},
37+
computed: mapGetters(['groupExists']),
38+
methods: {
39+
...mapMutations(['addGroup']),
40+
onSubmit () {
41+
if (!this.name.length) {
42+
this.hasError = true
43+
this.errorMessage = 'A group name is required.'
44+
return
45+
}
46+
47+
this.isSubmitting = true
48+
49+
if (this.groupExists(this.name)) {
50+
this.hasError = true
51+
this.isSubmitting = false
52+
this.errorMessage = 'That group already exists.'
53+
return
54+
}
55+
56+
this.addGroup({ name: this.name })
57+
this.closeDialog()
58+
},
59+
60+
reset () {
61+
this.name = ''
62+
this.hasError = false
63+
this.isSubmitting = false
64+
this.errorMessage = ''
65+
},
66+
67+
closeDialog () {
68+
this.$refs['new-group-dialog'].close()
69+
this.reset()
70+
}
71+
},
72+
mounted () {
73+
events.$on('open:dialog:new-group-dialog', () => this.$refs['new-group-dialog'].open())
74+
}
75+
}
76+
</script>
77+
78+
<style scoped>
79+
.md-spinner {
80+
margin-right: auto;
81+
}
82+
</style>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<template>
2+
<md-dialog @open="reset" ref="new-watcher-dialog">
3+
<md-dialog-title>Add New Watcher</md-dialog-title>
4+
5+
<md-dialog-content>
6+
<p>TODO: Build validation</p>
7+
8+
<md-input-container>
9+
<label>Project Name</label>
10+
<md-input v-model="name" required></md-input>
11+
</md-input-container>
12+
13+
<md-input-container>
14+
<label>Project Source</label>
15+
<md-input v-model="source" required></md-input>
16+
</md-input-container>
17+
18+
<md-input-container>
19+
<label>Project Destination</label>
20+
<md-textarea v-model="destination" required></md-textarea>
21+
</md-input-container>
22+
23+
<md-input-container>
24+
<label>Project Group</label>
25+
<md-select v-model="group_id">
26+
<md-option v-for="group in $store.state.groups" :value="group.name">{{ group.name }}</md-option>
27+
</md-select>
28+
</md-input-container>
29+
</md-dialog-content>
30+
31+
<md-dialog-actions>
32+
<md-spinner :md-size="20" md-indeterminate class="md-accent" v-if="isSubmitting"></md-spinner>
33+
<md-button class="md-primary" @click.native="closeDialog">Cancel</md-button>
34+
<md-button class="md-primary" @click.native="onSubmit">Ok</md-button>
35+
</md-dialog-actions>
36+
</md-dialog>
37+
</template>
38+
39+
<script>
40+
import { mapGetters, mapMutations } from 'vuex'
41+
import events from '../../events'
42+
43+
export default {
44+
name: 'new-watcher-dialog',
45+
data () {
46+
return {
47+
name: '',
48+
group_id: '',
49+
source: '',
50+
destination: '',
51+
isSubmitting: false,
52+
errorMessages: {
53+
name: '',
54+
group_id: '',
55+
source: '',
56+
destination: ''
57+
}
58+
}
59+
},
60+
computed: mapGetters(['watcherExists']),
61+
methods: {
62+
...mapMutations(['addWatcher']),
63+
onSubmit () {
64+
if (!this.name.length || !this.source.length || !this.destination.length) {
65+
return
66+
}
67+
68+
this.isSubmitting = true
69+
70+
this.addWatcher({
71+
name: this.name,
72+
group_id: this.group_id,
73+
source: this.source,
74+
destination: this.destination
75+
})
76+
77+
this.closeDialog()
78+
},
79+
80+
reset () {
81+
this.name = ''
82+
this.group = ''
83+
this.source = ''
84+
this.destination = ''
85+
this.isSubmitting = false
86+
},
87+
88+
closeDialog () {
89+
this.$refs['new-watcher-dialog'].close()
90+
this.reset()
91+
}
92+
},
93+
mounted () {
94+
events.$on('open:dialog:new-watcher-dialog', () => this.$refs['new-watcher-dialog'].open())
95+
}
96+
}
97+
</script>

0 commit comments

Comments
 (0)