Skip to content

Commit

Permalink
Refactor style
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Apr 1, 2016
1 parent d51a035 commit f8e7a45
Show file tree
Hide file tree
Showing 44 changed files with 1,638 additions and 680 deletions.
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
wdb Copyright (C) 2012 Florian Mounier, Kozea
wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
Expand Down
2 changes: 1 addition & 1 deletion README
Expand Up @@ -417,7 +417,7 @@ This library is licensed under GPLv3
wdb - An improbable web debugger through WebSockets


wdb Copyright (C) 2015 Florian Mounier, Kozea
wdb Copyright (c) 2012-2016 Florian Mounier, Kozea

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -443,7 +443,7 @@ This library is licensed under GPLv3
wdb - An improbable web debugger through WebSockets


wdb Copyright (C) 2015 Florian Mounier, Kozea
wdb Copyright (c) 2012-2016 Florian Mounier, Kozea

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion client/wdb/__init__.py
@@ -1,7 +1,7 @@
# *-* coding: utf-8 *-*
# This file is part of wdb
#
# wdb Copyright (C) 2012-2015 Florian Mounier, Kozea
# wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
Expand Down
2 changes: 1 addition & 1 deletion client/wdb/ext.py
@@ -1,7 +1,7 @@
# *-* coding: utf-8 *-*
# This file is part of wdb
#
# wdb Copyright (C) 2012-2015 Florian Mounier, Kozea
# wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
Expand Down
6 changes: 3 additions & 3 deletions server/Gruntfile.coffee
Expand Up @@ -66,7 +66,7 @@ module.exports = (grunt) ->
'wdb_server/static/javascripts/wdb.js': [
'coffees/_base.coffee'
'coffees/_websocket.coffee'
'coffees/_codemirror.coffee'
'coffees/_source.coffee'
'coffees/_history.coffee'
'coffees/_traceback.coffee'
'coffees/_interpreter.coffee'
Expand All @@ -78,9 +78,9 @@ module.exports = (grunt) ->

status:
files:
'wdb_server/static/javascripts/status.js': [
'wdb_server/static/javascripts/home.js': [
'coffees/_base.coffee'
'coffees/status.coffee'
'coffees/home.coffee'
]


Expand Down
2 changes: 1 addition & 1 deletion server/coffees/_base.coffee
@@ -1,6 +1,6 @@
# This file is part of wdb
#
# wdb Copyright (C) 2012 Florian Mounier, Kozea
# wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
Expand Down
16 changes: 16 additions & 0 deletions server/coffees/_history.coffee
@@ -1,3 +1,19 @@
# This file is part of wdb
#
# wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class History extends Log
constructor: (@prompt) ->
super
Expand Down
16 changes: 16 additions & 0 deletions server/coffees/_interpreter.coffee
@@ -1,3 +1,19 @@
# This file is part of wdb
#
# wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class Interpreter extends Log
constructor: (@wdb) ->
super
Expand Down
16 changes: 16 additions & 0 deletions server/coffees/_prompt.coffee
@@ -1,3 +1,19 @@
# This file is part of wdb
#
# wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class Prompt extends Log
constructor: (@wdb) ->
super
Expand Down
@@ -1,6 +1,6 @@
# This file is part of wdb
#
# wdb Copyright (C) 2012 Florian Mounier, Kozea
# wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
Expand All @@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class Codemirror extends Log
class Source extends Log
constructor: (@wdb) ->
super
@$container = $('.source')
Expand Down
24 changes: 20 additions & 4 deletions server/coffees/_switch.coffee
@@ -1,3 +1,19 @@
# This file is part of wdb
#
# wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class Switch extends Log
constructor: (@wdb) ->
super
Expand Down Expand Up @@ -33,22 +49,22 @@ class Switch extends Log
@$switches.filter('.code').removeClass('off').addClass('on')
.removeClass('mdl-button--accent')
@$source.removeClass('hidden')
@wdb.cm.size()
@wdb.source.size()

close_code: ->
@$switches.filter('.code').removeClass('on').addClass('off')
.addClass('mdl-button--accent')
@$source.addClass('hidden')
@wdb.cm.size()
@wdb.source.size()

open_term: ->
@$switches.filter('.term').removeClass('off').addClass('on')
.removeClass('mdl-button--accent')
@$interpreter.removeClass('hidden')
@wdb.cm.size()
@wdb.source.size()

close_term: ->
@$switches.filter('.term').removeClass('on').addClass('off')
.addClass('mdl-button--accent')
@$interpreter.addClass('hidden')
@wdb.cm.size()
@wdb.source.size()
18 changes: 17 additions & 1 deletion server/coffees/_traceback.coffee
@@ -1,3 +1,19 @@
# This file is part of wdb
#
# wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class Traceback extends Log
constructor: (@wdb) ->
super
Expand All @@ -21,7 +37,7 @@ class Traceback extends Log
"File \"#{frame.file}\", line #{frame.lno}, in #{frame.function}\n" +
"    #{frame.code}")

for brk in @wdb.cm.breakpoints[frame.file] or []
for brk in @wdb.source.breakpoints[frame.file] or []
unless brk.cond or brk.fun or brk.lno
$traceline.addClass('breakpoint')
break
Expand Down
16 changes: 16 additions & 0 deletions server/coffees/_watchers.coffee
@@ -1,3 +1,19 @@
# This file is part of wdb
#
# wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class Watchers extends Log
constructor: (@wdb) ->
super
Expand Down
2 changes: 1 addition & 1 deletion server/coffees/_websocket.coffee
@@ -1,6 +1,6 @@
# This file is part of wdb
#
# wdb Copyright (C) 2012 Florian Mounier, Kozea
# wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
Expand Down
16 changes: 16 additions & 0 deletions server/coffees/status.coffee → server/coffees/home.coffee
@@ -1,3 +1,19 @@
# This file is part of wdb
#
# wdb Copyright (c) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

ws = null
wait = 25

Expand Down
30 changes: 15 additions & 15 deletions server/coffees/wdb.coffee
@@ -1,6 +1,6 @@
# This file is part of wdb
#
# wdb Copyright (C) 2012-2015 Florian Mounier, Kozea
# wdb Copyright (C) 2012-2016 Florian Mounier, Kozea
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
Expand Down Expand Up @@ -28,7 +28,7 @@ class Wdb extends Log

@ws = new Websocket(@, $('[data-uuid]').attr('data-uuid'))
@traceback = new Traceback @
@cm = new Codemirror @
@source = new Source @
@interpreter = new Interpreter @
@prompt = new Prompt @
@switch = new Switch @
Expand Down Expand Up @@ -63,8 +63,8 @@ class Wdb extends Log
@cwd = data.cwd
brks = data.breaks
for brk in brks
@cm.breakpoints[brk.fn] ?= []
@cm.breakpoints[brk.fn].push brk
@source.breakpoints[brk.fn] ?= []
@source.breakpoints[brk.fn].push brk

title: (data) ->
$('.title')
Expand Down Expand Up @@ -95,7 +95,7 @@ class Wdb extends Log
$('.trace-line').removeClass('selected')
$('.trace-' + current_frame.level).addClass('selected')
@file_cache[data.name] = data.file
@cm.open(data, current_frame)
@source.open(data, current_frame)
@done()

ellipsize: ($code) ->
Expand Down Expand Up @@ -156,11 +156,11 @@ class Wdb extends Log
key = snippet.substr(1)
data = ''
switch key
# when 'a' then @print_hist @session_cmd_hist[@cm.state.fn]
# when 'a' then @print_hist @session_cmd_hist[@source.state.fn]
when 'b' then @toggle_break data
when 'c' then cmd 'Continue'
when 'd' then cmd 'Dump', data if data
when 'e' then @cm.toggle_edition()
when 'e' then @source.toggle_edition()
when 'f' then cmd 'Find', data if data
when 'g' then @cls()
when 'h' then @print_help()
Expand Down Expand Up @@ -407,15 +407,15 @@ specify a module like `logging.config`.
@done()

breakset: (data) ->
@cm.set_breakpoint data
@source.set_breakpoint data

if @prompt.get()[0] is '.' and @prompt.get()[1] in ['b', 't']
@done()
else
@chilling()

breakunset: (data) ->
@cm.clear_breakpoint data
@source.clear_breakpoint data

if @prompt.get()[0] is '.' and @prompt.get()[1] in ['b', 't', 'z']
@done()
Expand Down Expand Up @@ -443,11 +443,11 @@ specify a module like `logging.config`.
[remaining, brk.cond] = @split remaining, ','
[remaining, brk.fun] = @split remaining, '#'
[remaining, brk.lno] = @split remaining, ':'
brk.fn = remaining or @cm.state.fn
brk.fn = remaining or @source.state.fn
brk.lno = parseInt(brk.lno) or null

exist = false
for ebrk in @cm.breakpoints[brk.fn] or []
for ebrk in @source.breakpoints[brk.fn] or []
if (ebrk.fn is brk.fn and
ebrk.lno is brk.lno and
ebrk.cond is brk.cond and
Expand All @@ -459,7 +459,7 @@ specify a module like `logging.config`.
break

if exist or remove_only
@cm.clear_breakpoint(brk)
@source.clear_breakpoint(brk)
cmd = 'Unbreak'
unless brk.temporary
cmd = 'Broadcast|' + cmd
Expand All @@ -468,7 +468,7 @@ specify a module like `logging.config`.
return

if brk.lno
@cm.ask_breakpoint(brk.lno)
@source.ask_breakpoint(brk.lno)
cmd = 'Break'
unless temporary
cmd = 'Broadcast|' + cmd
Expand Down Expand Up @@ -509,7 +509,7 @@ specify a module like `logging.config`.
setTimeout (-> window.close()), 10

global_key: (e) ->
return true if @cm.rw
return true if @source.rw

if e.altKey and (
65 <= e.keyCode <= 90 or 37 <= e.keyCode <= 40 or e.keyCode is 13
Expand All @@ -525,7 +525,7 @@ specify a module like `logging.config`.
extra = ''
# Break on current line
if char in ['b', 't', 'z']
extra += ' :' + @cm.state.lno
extra += ' :' + @source.state.lno
if char is 'i'
extra = getSelection().toString()

Expand Down

0 comments on commit f8e7a45

Please sign in to comment.