rotn 1.0.0 → 1.0.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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/bin/rotn +56 -0
  5. metadata +4 -2
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d41d0eab13053e5dac4d849c1fa6df9ac2dd2763
4
- data.tar.gz: ec184df48a7a7f7dc38fe805d76f0e30c7c57b0a
3
+ metadata.gz: 90e66b6e33202754cfc1dac6f7f3bd2b4db93b40
4
+ data.tar.gz: e75d7cceaa3b28ca1aa11f1dbccf5e0518f96952
5
5
  SHA512:
6
- metadata.gz: e3e055ef996f666a4577ef9392b7b9f4f11b1ae1fd2cb04056f0366a3717d0732838472713c8f36c34ce754f5089ed6f63c938ddf3086b9e5aa28a3c2e75a777
7
- data.tar.gz: 06c04d2f0d5159d892a965029ce4d4ec2067c01fc080d7a38bb3a834addc4faa7333643c5573a716f817afaa5db03361a2b81f9ec713784b94b6fc48b8dbb2bf
6
+ metadata.gz: a98363898f2bf1148f3b68ed9e213496ffc07398430731f96cd2ed31c00ae14a8b43f1287a1ac0de49dec8064aed72e4ba54001e5066cd62287065de9221a219
7
+ data.tar.gz: 2be480554b6f183a1265ea94e6561ae2149988b452faa203d7a998fc3a9f2ee782b4dd228ac14fcbbf2f62913c2704a85dd94a75c2e910e609e1122f81f4b8bb
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rotn'
3
+ require 'optparse'
4
+
5
+ options = {}
6
+ OptionParser.new do |o|
7
+ o.banner = "Missing operands.\nTry --help for more options."
8
+
9
+ o.on("-h", "--help", "Print help.") do |h|
10
+ options[:help] = h
11
+ end
12
+
13
+ o.on("-aDECIMALINTEGER", "--alphabetic=DECIMALINTEGER", "Set the number to shift alphabetic symbols (a-zA-Z).") do |a|
14
+ options[:alphabetic] = a
15
+ end
16
+
17
+ o.on("-nDECIMALINTEGER", "--numeric=DECIMALINTEGER", "Set the number to shift numeric symbols (0-9).") do |n|
18
+ options[:numeric] = n
19
+ end
20
+
21
+ o.on("-e", "--encode", "Set the mode to encode.") do |e|
22
+ options[:encode] = e
23
+ end
24
+
25
+ o.on("-d", "--decode", "Set the mode to decode.") do |d|
26
+ options[:decode] = d
27
+ end
28
+ end.parse!
29
+
30
+ if options.has_key? :help
31
+ puts "Usage: rotn -aNUMBER [-nNUMBER] STRING"
32
+ puts " -a, --alphabetic=NUMBER\tSet the number to shift alphabetic symbols (a-zA-Z)."
33
+ puts " -d, --decode\t\tSet the mode to decode."
34
+ puts " -e, --encode\t\tSet the mode to encode (default)."
35
+ puts " -h, --help\t\tPrint this message."
36
+ puts " -n, --numeric=NUMBER\tSet the number to shift numeric symbols (0-9)."
37
+ exit
38
+ end
39
+
40
+ str = ""
41
+ (ARGV.length).times do |i|
42
+ str += ARGV[i]
43
+ end
44
+
45
+ a = options[:alphabetic].to_i
46
+ n = options[:numeric].to_i
47
+
48
+ if options.has_key? :decode
49
+ str.unshift!({:a => a]}) if options.has_key? :alphabetic
50
+ str.unshift!({:a => n]}) if options.has_key? :numeric
51
+ else
52
+ str.shift!({:a => options[:alphabetic]}) if options.has_key? :alphabetic
53
+ str.shift!({:n => options[:numeric]}) if options.has_key? :numeric
54
+ end
55
+
56
+ puts str
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rotn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Black
@@ -34,12 +34,14 @@ date: 2016-08-29 00:00:00.000000000 Z
34
34
  dependencies: []
35
35
  description: A library to perform a Caesar cypher by N symbols
36
36
  email: annoying-dog@outlook.com
37
- executables: []
37
+ executables:
38
+ - rotn
38
39
  extensions: []
39
40
  extra_rdoc_files: []
40
41
  files:
41
42
  - lib/rotn.rb
42
43
  - lib/rotn/local.rb
44
+ - bin/rotn
43
45
  homepage: https://github.com/annoying-dog/rotn
44
46
  licenses:
45
47
  - MIT
metadata.gz.sig CHANGED
Binary file