jota 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/jota.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # $Id: jota.rb 37 2009-02-09 10:06:02Z dz $
3
+ # $Id: jota.rb 53 2009-09-24 14:22:04Z dz $
4
4
 
5
5
  # if you use vim and don't like folds type zR
6
6
 
@@ -27,6 +27,10 @@ def usage
27
27
  puts("usage: #{$0} -dhv 'file' [ 'regular-expression' ]")
28
28
  puts("\t-v\t\tset verbose mode")
29
29
  puts("\t-d\t\tset debug mode")
30
+
31
+ puts("\t-D 'file'\twrite debug and verbose output to 'file'")
32
+ puts("\t-t\t\tforce text mode")
33
+ puts("\t-g\t\tforce graphical mode")
30
34
  puts("\t-h\t\tthis help")
31
35
  end #}}}1
32
36
 
@@ -36,9 +40,16 @@ def parse_args
36
40
  opts = GetoptLong.new(
37
41
  [ '--verbose', '-v', GetoptLong::NO_ARGUMENT ],
38
42
  [ '--debug', '-d', GetoptLong::NO_ARGUMENT ],
43
+ [ '--debug-file', '-D', GetoptLong::REQUIRED_ARGUMENT ],
44
+ [ '--text', '-t', GetoptLong::NO_ARGUMENT ],
45
+ [ '--gui', '-g', GetoptLong::NO_ARGUMENT ],
39
46
  [ '--help', '-h', GetoptLong::NO_ARGUMENT ]
40
47
  )
41
48
 
49
+ @force = nil
50
+ $debug_filename = nil
51
+ $debug_file = nil
52
+
42
53
  begin
43
54
  opts.each do |opt, arg|
44
55
  case opt
@@ -47,6 +58,12 @@ def parse_args
47
58
  when '--debug'
48
59
  $VERBOSE = true
49
60
  $DEBUG = true
61
+ when '--debug-file'
62
+ $debug_filename = arg
63
+ when '--text'
64
+ @force = :text
65
+ when '--gui'
66
+ @force = :gui
50
67
  when '--help'
51
68
  usage
52
69
  exit(EX_OK)
@@ -75,6 +92,7 @@ def parse_args
75
92
  end
76
93
 
77
94
  if $VERBOSE then
95
+ print_verbose "started at #{Time.now}"
78
96
  print_verbose "running version #{Version::STRING}, build #{Version::build}"
79
97
  print_verbose "verbose set to #{$VERBOSE}"
80
98
  print_verbose "debug set to #{$DEBUG}"
@@ -83,21 +101,50 @@ def parse_args
83
101
  end
84
102
  end #}}}1
85
103
 
86
-
87
- def run_gui
104
+ def run
88
105
  #{{{1
89
106
  parse_args
90
107
 
91
- # this 'require' must be after the command line is parsed, because
92
- # 'require libglade2' parses the commandline too.
93
- require 'gui'
108
+ begin
109
+ # this 'require' must be after the command line is parsed,
110
+ # because 'require libglade2' parses the commandline too.
111
+ require 'gui'
112
+ gui_ok = true
113
+ rescue Exception
114
+ gui_ok = false
115
+ end
94
116
 
95
- glade = Gui.new
117
+ if @force == :text or gui_ok == false then
118
+ require 'jota_curses'
119
+ start_curses
120
+ else
121
+ start_gui
122
+ end
123
+
124
+ end #}}}1
125
+
126
+ def start_curses
127
+ #{{{1
128
+ curses = JotaCurses.new
129
+ if @filename then
130
+ curses.open(@filename)
131
+ if @regexp then
132
+ curses.goto_regexp(@regexp)
133
+ end
134
+ end
135
+
136
+ print_verbose "entering curses main loop"
96
137
 
138
+ curses.run
139
+ end # start_curses }}}1
140
+
141
+ def start_gui
142
+ #{{{1
143
+ glade = Gui.new
97
144
  if @filename then
98
145
  glade.open(@filename)
99
146
  if @regexp
100
- glade.set_current(@regexp)
147
+ glade.goto_regexp(@regexp)
101
148
  end
102
149
  end
103
150
 
@@ -140,9 +187,7 @@ def run_gui
140
187
  end
141
188
  end
142
189
  end
143
-
144
- end # run_gui }}}1
145
-
190
+ end # start_gui }}}1
146
191
 
147
192
  def run_cli
148
193
  #{{{1
@@ -173,4 +218,4 @@ end # run_cli }}}1
173
218
 
174
219
  end # class Jota
175
220
 
176
- # vim600: set foldmethod=marker:
221
+ # vim: set foldmethod=marker:
data/lib/preferences.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # $Id: preferences.rb 37 2009-02-09 10:06:02Z dz $
2
+ # $Id: preferences.rb 46 2009-05-08 09:27:55Z dz $
3
3
 
4
4
  # if you use vim and don't like folds type zR
5
5
 
@@ -25,7 +25,7 @@ def Preferences.read(str)
25
25
  p[key] = value
26
26
  end
27
27
  rescue SystemCallError
28
- print_debug "# failed, setting default preferences'"
28
+ print_debug " failed, setting default preferences"
29
29
  end
30
30
 
31
31
  return p
@@ -80,4 +80,4 @@ end #}}}1
80
80
 
81
81
  end # class
82
82
 
83
- # vim600: set foldmethod=marker:
83
+ # vim: set foldmethod=marker:
data/lib/svn_info.rb CHANGED
@@ -1,4 +1,4 @@
1
- # This file is creataed by './make_svn_info.rb'
1
+ # This file is created by './make_svn_info.rb'
2
2
 
3
3
  module SVN_Info
4
4
 
@@ -6,11 +6,11 @@ SVN_PATH="."
6
6
  SVN_URL="svn+ssh://solaria.426.ch/svn/jota/trunk"
7
7
  SVN_REPOSITORY_ROOT="svn+ssh://solaria.426.ch/svn"
8
8
  SVN_REPOSITORY_UUID="ff64bd42-7924-4c15-ba74-d98c4559417c"
9
- SVN_REVISION="35"
9
+ SVN_REVISION="55"
10
10
  SVN_NODE_KIND="directory"
11
11
  SVN_SCHEDULE="normal"
12
12
  SVN_LAST_CHANGED_AUTHOR="dz"
13
- SVN_LAST_CHANGED_REV="35"
14
- SVN_LAST_CHANGED_DATE="2009-01-26 10:30:05 +0100 (Mon, 26 Jan 2009)"
13
+ SVN_LAST_CHANGED_REV="55"
14
+ SVN_LAST_CHANGED_DATE="2009-10-11 15:02:40 +0200 (Sun, 11 Oct 2009)"
15
15
 
16
16
  end
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # $Id: version.rb 35 2009-01-26 09:30:05Z dz $
2
+ # $Id: version.rb 40 2009-03-14 10:19:43Z dz $
3
3
 
4
4
  require "svn_info"
5
5
 
@@ -9,7 +9,7 @@ include SVN_Info
9
9
 
10
10
  MAJOR = 0
11
11
  MINOR = 8
12
- REVISION = 0
12
+ REVISION = 1
13
13
 
14
14
  STRING = "%d.%d.%d" % [MAJOR, MINOR,REVISION]
15
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jota
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derik van Zuetphen
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-09 11:11:02 +01:00
12
+ date: 2009-10-11 16:38:01 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -33,20 +33,20 @@ extra_rdoc_files:
33
33
  - INSTALL
34
34
  files:
35
35
  - lib/app_error.rb
36
- - lib/cli.rb
37
- - lib/version.rb
38
- - lib/preferences.rb
39
- - lib/jota.rb
40
- - lib/helper.rb
41
- - lib/gui.rb
42
- - lib/clip.rb
43
36
  - lib/clip_array.rb
37
+ - lib/clip.rb
38
+ - lib/gui.rb
39
+ - lib/helper.rb
40
+ - lib/jota.rb
41
+ - lib/preferences.rb
42
+ - lib/version.rb
43
+ - lib/cli.rb
44
44
  - lib/svn_info.rb
45
45
  - lib/jota.glade
46
- - tests/test_preferences.rb
47
- - tests/test_clip_array.rb
48
- - tests/test_clip.rb
49
46
  - tests/test_all.rb
47
+ - tests/test_clip.rb
48
+ - tests/test_clip_array.rb
49
+ - tests/test_preferences.rb
50
50
  - INSTALL
51
51
  has_rdoc: true
52
52
  homepage: http://426.ch/jota
@@ -70,12 +70,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  requirements: []
71
71
 
72
72
  rubyforge_project: jota
73
- rubygems_version: 1.2.0
73
+ rubygems_version: 1.3.1
74
74
  signing_key:
75
75
  specification_version: 2
76
76
  summary: A simple but powerful jotter in the style of xclipboard
77
77
  test_files:
78
- - tests/test_preferences.rb
79
- - tests/test_clip_array.rb
80
- - tests/test_clip.rb
81
78
  - tests/test_all.rb
79
+ - tests/test_clip.rb
80
+ - tests/test_clip_array.rb
81
+ - tests/test_preferences.rb