Skip to content

Commit 018792f

Browse files
committed
many change.
1 parent de13bb2 commit 018792f

File tree

11 files changed

+356
-142
lines changed

11 files changed

+356
-142
lines changed

Gruntfile.coffee

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ module.exports = (grunt)->
88
path = require 'path'
99

1010
# Project configuration.
11-
grunt.initConfig { # <-- Per smart-convention, require braces around long blocks
11+
grunt.initConfig { # <-- Per helpful-convention, require braces around long blocks
1212

1313
pkg: grunt.file.readJSON('package.json')
1414

1515
coffeelint:
1616
gruntfile: ['<%= watch.gruntfile.files %>']
1717
lib: ['<%= watch.lib.files %>']
18+
example: ['<%= watch.example.files %>']
1819
options:
1920
configFile: "coffeelint.json"
2021

@@ -25,6 +26,12 @@ module.exports = (grunt)->
2526
src: ['**/*.coffee']
2627
dest: 'out/lib/'
2728
ext: '.js'
29+
example:
30+
expand: true
31+
cwd: 'src/example/'
32+
src: ['**/*.coffee']
33+
dest: 'out/example/'
34+
ext: '.js'
2835

2936
watch:
3037
options:
@@ -35,10 +42,17 @@ module.exports = (grunt)->
3542
lib:
3643
files: ['src/lib/**/*.coffee']
3744
tasks: ['coffeelint:lib', 'coffee:lib']
45+
example:
46+
files: ['src/example/**/*.coffee']
47+
tasks: ['coffeelint:example', 'coffee:example']
3848

3949
clean: ['out/']
50+
51+
nodemon:
52+
example:
53+
script: 'example.js'
4054

41-
} # <-- Per smart-convention, require braces around long blocks
55+
} # <-- Per helpful-convention, require braces around long blocks
4256

4357
grunt.event.on 'watch', (action, files, target)->
4458
grunt.log.writeln "#{target}: #{files} has #{action}"

coffeelint.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
"no_trailing_whitespace": {
1414
"name": "no_trailing_whitespace",
1515
"level": "error",
16-
"allowed_in_comments": false,
16+
"allowed_in_comments": true,
1717
"allowed_in_empty_lines": true
1818
},
1919
"max_line_length": {
2020
"name": "max_line_length",
2121
"value": 95,
22-
"level": "error",
22+
"level": "ignore",
2323
"limitComments": false
2424
},
2525
"line_endings": {
@@ -101,7 +101,7 @@
101101
},
102102
"no_unnecessary_fat_arrows": {
103103
"name": "no_unnecessary_fat_arrows",
104-
"level": "warn"
104+
"level": "ignore"
105105
},
106106
"missing_fat_arrows": {
107107
"name": "missing_fat_arrows",

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"native-dns": "~0.4.1",
2323
"event-stream": "~3.1.0",
2424
"lodash-contrib": "~241.3.1",
25-
"emit-stream": "~0.1.2"
25+
"stream-array": "~0.1.3",
26+
"inquirer": "~0.4.0",
27+
"cli-color": "~0.2.3"
2628
},
2729
"devDependencies": {
2830
"grunt": "~0.4.2",
@@ -33,7 +35,8 @@
3335
"grunt-coffeelint": "~0.0.7",
3436
"matchdep": "~0.1.2",
3537
"grunt-shell": "~0.6.1",
36-
"optimist": "~0.6.0"
38+
"optimist": "~0.6.0",
39+
"grunt-nodemon": "~0.2.0"
3740
},
3841
"scripts": {
3942
"test": "echo \"Error: no test specified\" && exit 1"

src/example/example.coffee

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
renameDeps =
2+
_ : 'lodash-contrib'
3+
S : 'string'
4+
cli : 'cli-color'
5+
6+
for d,dep of renameDeps
7+
eval "var #{d} = require('#{dep}');"
8+
9+
for d in ['net', 'dns', 'http', 'url', 'util', 'os', 'inquirer']
10+
eval "var #{d} = require('#{d}');"
11+
12+
13+
DNSNMC = require '../lib/dnsnmc'
14+
15+
console.log "DEMO (external IP: %s)", DNSNMC.externalIP()
16+
console.log "\nPlease enter RPC info for namecoind:\n"
17+
18+
questions = [
19+
name: 'user'
20+
message: 'rpc user: '
21+
,
22+
name: 'pass'
23+
type: 'password'
24+
message: 'rpc pass: '
25+
,
26+
name: 'host'
27+
message: 'rpc host: '
28+
default: '127.0.0.1'
29+
,
30+
name: 'port'
31+
message: 'rpc port: '
32+
default: '8336'
33+
]
34+
35+
# prevent inquirer from showing password length
36+
# https://github.com/SBoudrias/Inquirer.js/issues/91
37+
do ->
38+
inquirer.prompts.password::onKeypress = ->
39+
write = inquirer.prompts.password::write
40+
inquirer.prompts.password::write = (x) ->
41+
poop = cli.cyan('**')+'\n'
42+
x = '\n' if S(x).endsWith poop.slice poop.indexOf('**')
43+
write.bind(this)(x)
44+
this
45+
46+
inquirer.prompt questions, (rpcOpts) ->
47+
server = new DNSNMC rpcOpts

src/lib/config.coffee

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
###
2+
3+
dnsnmc
4+
http://dnsnmc.net
5+
6+
Copyright (c) 2013 Greg Slepak
7+
Licensed under the BSD 3-Clause license.
8+
9+
###
10+
11+
# TODO: go through 'TODO's!
12+
13+
'use strict'
14+
15+
module.exports = (dnsnmc) ->
16+
# expose these into our namespace
17+
for k of dnsnmc.globals
18+
eval "var #{k} = dnsnmc.globals.#{k};"

0 commit comments

Comments
 (0)