oode 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,68 @@
1
- oode: out of DICE experience
2
- ============================
1
+ oode(1) -- print from a laptop to an AT printer
2
+ ===============================================
3
3
 
4
- `oode` is a command which allows
4
+ ## SYNOPSIS
5
+
6
+ `oode` [<OPTIONS>] <FILE>...<br>
7
+
8
+ ## DESCRIPTION
9
+
10
+ `oode` makes printing to the printers in Appleton Tower much easier
11
+ from laptops by automating some of the tediousness from the sequence
12
+ of tasks required.
13
+
14
+ ## CONFIGURATION
15
+
16
+ `oode` can read SSH authentication usernames and passwords from a
17
+ configuration file so you don't have to type them in every time. A
18
+ file called `.ooderc` should be placed in your home directory with
19
+ the following contents:
20
+
21
+ :user: <username>
22
+ :password: <password>
23
+
24
+ Either of these can be missed if you would rather enter them yourself
25
+ each time.
26
+
27
+ ## OPTIONS
28
+ The following options and flags can be used with `oode`:
29
+
30
+ ### Authentication
31
+
32
+ * `-u`, `--user`=<USERNAME>:
33
+ Your DICE username so that `oode` can authenticate.
34
+
35
+ * `-a`, `--password`=<PASSWORD>:
36
+ Your DICE password so that `oode` can authenticate.
37
+
38
+ ### Miscellaneous
39
+
40
+ * `-p`, `--printer`=<PRINTER>:
41
+ Use the printer, <PRINTER>, to print the <FILES>.
42
+
43
+ * `-f`, `--force`:
44
+ Force `oode` to use a certain printer even if it is not desired.
45
+
46
+ ### Printing
47
+
48
+ * `-n`, `--number`=<NUMBER>:
49
+ Print <NUMBER> copies of the <FILES>.
50
+
51
+ * `-2`, `--two-up`:
52
+ Print the files in the 2-up style.
53
+
54
+ * `-4`, `--four-up`:
55
+ Print the files in the 4-up style.
56
+
57
+ ## BUGS
58
+
59
+ <http://github.com/xoebus/oode/issues>
60
+
61
+ ## AUTHOR
62
+
63
+ Chris Brown :: cb@tardis.ed.ac.uk :: @xoebus
64
+
65
+ ## SEE ALSO
66
+
67
+ <http://github.com>,
68
+ <http://github.com/xoebus/oode>
data/lib/oode/file.rb CHANGED
@@ -16,6 +16,13 @@ module Oode
16
16
  #puts command.blue
17
17
  end
18
18
 
19
+ def check_size
20
+ limit = 5242880 # 5MB
21
+ file_size = File.size(@filename)
22
+
23
+ warning "Your file is pretty big (#{file_size.to_human}). It may take a while to print..."
24
+ end
25
+
19
26
  def remote_path
20
27
  File.join File.expand_path("/home/.oode/"), @filename
21
28
  end
data/lib/oode/helper.rb CHANGED
@@ -4,4 +4,17 @@ end
4
4
 
5
5
  def notify message
6
6
  puts "INFO: #{message}".yellow
7
- end
7
+ end
8
+
9
+ def warning message
10
+ puts "WARN: #{message}".purple
11
+ end
12
+
13
+ class Numeric
14
+ def to_human
15
+ units = %w{B KB MB GB TB}
16
+ e = (Math.log(self)/Math.log(1024)).floor
17
+ s = "%.3f" % (to_f / 1024**e)
18
+ s.sub(/\.?0*$/, units[e])
19
+ end
20
+ end
data/lib/oode/queue.rb CHANGED
@@ -29,6 +29,7 @@ module Oode
29
29
 
30
30
  notify "Printing files on #{@printer.red}..."
31
31
  @queue.each do |file|
32
+ file.check_size
32
33
  file.print @ssh, remote_oode_path, @printer, @args
33
34
  end
34
35
 
data/lib/oode/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Oode
2
- Version = VERSION = '0.1.4'
2
+ Version = VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Chris Brown