crypt-rot13 1.0.1 → 1.0.2

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 (7) hide show
  1. data/CHANGES +13 -7
  2. data/MANIFEST +7 -9
  3. data/README +48 -48
  4. data/Rakefile +22 -0
  5. data/lib/crypt/rot13.rb +10 -6
  6. data/test/tc_rot13.rb +9 -14
  7. metadata +28 -19
data/CHANGES CHANGED
@@ -1,7 +1,13 @@
1
- == 1.0.1 - 6-Jun-2005
2
- * Moved project to RubyForge.
3
- * Minor test and doc changes.
4
- * Added a .gemspec file. Gem available online.
5
-
6
- == 1.0.0 - 18-May-2004
7
- * Initial release
1
+ == 1.0.2 - 25-Jul-2007
2
+ * Changed Rot13Error to Rot13::Error
3
+ * Added a Rakefile with tasks for installation and testing
4
+ * Removed the install.rb file. Installation is now handled via a Rake task.
5
+ * The MANIFEST file was updated and is now rdoc formatted.
6
+
7
+ == 1.0.1 - 6-Jun-2005
8
+ * Moved project to RubyForge.
9
+ * Minor test and doc changes.
10
+ * Added a .gemspec file. Gem available online.
11
+
12
+ == 1.0.0 - 18-May-2004
13
+ * Initial release
data/MANIFEST CHANGED
@@ -1,9 +1,7 @@
1
- CHANGES
2
- MANIFEST
3
- README
4
- install.rb
5
- crypt-rot13.gemspec
6
-
7
- lib/crypt/rot13.rb
8
-
9
- test/tc_rot13.rb
1
+ * CHANGES
2
+ * MANIFEST
3
+ * README
4
+ * Rakefile
5
+ * crypt-rot13.gemspec
6
+ * lib/crypt/rot13.rb
7
+ * test/tc_rot13.rb
data/README CHANGED
@@ -1,48 +1,48 @@
1
- == Description
2
- A package for performing simple character rotation (i.e. Caesar Cipher)
3
- encryption. There are many like it, but this one is mine.
4
-
5
- == Installation
6
-
7
- === Manual Installation
8
- ruby test/tc_rot13.rb (optional)
9
- ruby install.rb
10
-
11
- === Gem Installation
12
- ruby crypt-rot13.gem
13
- gem install crypt-rot13-<version>.gem
14
-
15
- == Synopsis
16
- require "crypt/rot13"
17
- include Crypt
18
-
19
- str = Rot13.new("Hello World", 3) # Caesar cipher
20
- puts str # "Khoor Zruog"
21
-
22
- == Notes
23
- * Not unicode friendly. Only works on ASCII values 65-90 and 97-122.
24
-
25
- == Acknowledgements
26
- Thanks go to Gaius Julius Caesar (d. 44 BC) for creating one of the first,
27
- and most simple, encryption schemes. Hail Caesar!
28
-
29
- == Known Bugs
30
- None that I'm aware of.
31
-
32
- Please log any bugs you find on the SourceForge project page at
33
- http://www.rubyforge.org/projects/shards.
34
-
35
- == License
36
- Ruby's
37
-
38
- == Warranty
39
- This package is provided "as is" and without any express or
40
- implied warranties, including, without limitation, the implied
41
- warranties of merchantability and fitness for a particular purpose.
42
-
43
- == Author
44
- Daniel J. Berger
45
- djberg96 at gmail dot com
46
- imperator on IRC (irc.freenode.net)
47
-
48
-
1
+ == Description
2
+ A package for performing simple character rotation (i.e. Caesar Cipher)
3
+ encryption. There are many like it, but this one is mine.
4
+
5
+ == Installation
6
+ === Manual Installation
7
+ rake test (optional)
8
+ rake install
9
+
10
+ === Gem Installation
11
+ rake test (optional)
12
+ rake install_gem
13
+
14
+ == Synopsis
15
+ require 'crypt/rot13'
16
+ include Crypt
17
+
18
+ str = Rot13.new("Hello World", 3) # Caesar cipher
19
+ puts str # "Khoor Zruog"
20
+
21
+ == Notes
22
+ Not unicode friendly. Only works on ASCII values 65-90 and 97-122.
23
+
24
+ == Acknowledgements
25
+ Thanks go to Gaius Julius Caesar (d. 44 BC) for creating one of the first,
26
+ and most simple, encryption schemes. Hail Caesar!
27
+
28
+ == Known Bugs
29
+ None that I'm aware of.
30
+
31
+ Please log any bugs you find on the SourceForge project page at
32
+ http://www.rubyforge.org/projects/shards.
33
+
34
+ == License
35
+ Ruby's
36
+
37
+ == Copyright
38
+ (C) 2005-2007, Daniel J. Berger, All Rights Reserved
39
+
40
+ == Warranty
41
+ This package is provided "as is" and without any express or
42
+ implied warranties, including, without limitation, the implied
43
+ warranties of merchantability and fitness for a particular purpose.
44
+
45
+ == Author
46
+ Daniel J. Berger
47
+ djberg96 at nospam at gmail dot com
48
+ imperator on IRC (irc.freenode.net)
@@ -0,0 +1,22 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+
4
+ desc "Install the crypt-rot13 package (non-gem)"
5
+ task :install do
6
+ dest = File.join(Config::CONFIG['sitelibdir'], 'crypt')
7
+ Dir.mkdir(dest) unless File.exists? dest
8
+ cp 'lib/crypt/rot13.rb', dest, :verbose => true
9
+ end
10
+
11
+ desc "Install the crypt-rot13 package as a gem"
12
+ task :install_gem do
13
+ ruby 'crypt-rot13.gemspec'
14
+ file = Dir["*.gem"].first
15
+ sh "gem install #{file}"
16
+ end
17
+
18
+ Rake::TestTask.new do |t|
19
+ t.libs << 'lib'
20
+ t.warning = true
21
+ t.test_files = FileList['test/tc*']
22
+ end
@@ -1,14 +1,16 @@
1
1
  module Crypt
2
- class Rot13Error < ArgumentError; end
3
2
  class Rot13 < String
4
- VERSION = "1.0.1"
3
+ class Error < ArgumentError; end
4
+
5
+ VERSION = '1.0.2'
5
6
 
6
7
  # Returns a new Rot13 object. The object is a string with the letters
7
8
  # each rotated by +degree+.
8
9
  #
9
- # You cannot use a multiple of 26 as the degree or a Rot13Error will
10
+ # You cannot use a multiple of 26 as the degree or a Rot13::Error will
10
11
  # be raised. So, your days of double rot13 encryption are over.
11
- def initialize(str="", degree=13)
12
+ #
13
+ def initialize(str='', degree=13)
12
14
  unless str.empty?
13
15
  str = rotate_string(str, degree)
14
16
  end
@@ -16,15 +18,17 @@ module Crypt
16
18
  end
17
19
 
18
20
  # Rotates the object by +degree+.
21
+ #
19
22
  def rotate(degree)
20
- rotate_string(self,degree)
23
+ rotate_string(self, degree)
21
24
  end
22
25
 
23
26
  private
27
+
24
28
  def rotate_string(str,degree)
25
29
  case degree.modulo(26)
26
30
  when 0
27
- raise Rot13Error, "degree must not be a multiple of 26"
31
+ raise Error, "degree must not be a multiple of 26"
28
32
  when 13
29
33
  str.tr!("a-zA-Z","n-za-mN-ZA-M")
30
34
  else
@@ -1,16 +1,11 @@
1
- ##########################################################
1
+ ###############################################################
2
2
  # tc_rot13.rb
3
3
  #
4
- # Test suite for the crypt-rot13 package.
5
- ##########################################################
6
- base = File.basename(Dir.pwd)
7
- if base == "test" || base =~ /crypt-rot13/
8
- Dir.chdir("..") if base == "test"
9
- $LOAD_PATH.unshift(Dir.pwd + "/lib")
10
- end
11
-
12
- require "crypt/rot13"
13
- require "test/unit"
4
+ # Test suite for the crypt-rot13 package. You should run this
5
+ # test case via the 'rake test' task.
6
+ ###############################################################
7
+ require 'crypt/rot13'
8
+ require 'test/unit'
14
9
  include Crypt
15
10
 
16
11
  class TC_Rot13 < Test::Unit::TestCase
@@ -27,7 +22,7 @@ class TC_Rot13 < Test::Unit::TestCase
27
22
  end
28
23
 
29
24
  def test_version
30
- assert_equal("1.0.1", Rot13::VERSION)
25
+ assert_equal('1.0.2', Rot13::VERSION)
31
26
  end
32
27
 
33
28
  def test_constructor
@@ -42,8 +37,8 @@ class TC_Rot13 < Test::Unit::TestCase
42
37
  end
43
38
 
44
39
  def test_degree
45
- assert_raises(Rot13Error){ Rot13.new("foo",26) }
46
- assert_raises(Rot13Error){ Rot13.new("foo",52) }
40
+ assert_raises(Rot13::Error){ Rot13.new("foo",26) }
41
+ assert_raises(Rot13::Error){ Rot13.new("foo",52) }
47
42
  assert_nothing_raised{ Rot13.new("foo",25) }
48
43
  end
49
44
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.10
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: crypt-rot13
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.1
7
- date: 2005-06-06
8
- summary: "Character rotation encryption, i.e. Caesar Cipher"
6
+ version: 1.0.2
7
+ date: 2007-07-25 00:00:00 -06:00
8
+ summary: Character rotation encryption, i.e. Caesar Cipher
9
9
  require_paths:
10
- - lib
10
+ - lib
11
11
  email: djberg96@gmail.com
12
12
  homepage: http://www.rubyforge.org/projects/shards
13
13
  rubyforge_project:
@@ -18,27 +18,36 @@ bindir: bin
18
18
  has_rdoc: true
19
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
- -
22
- - ">"
23
- - !ruby/object:Gem::Version
24
- version: 0.0.0
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
25
24
  version:
26
25
  platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
27
29
  authors:
28
- - Daniel J. Berger
30
+ - Daniel J. Berger
29
31
  files:
30
- - lib/crypt/rot13.rb
31
- - README
32
- - CHANGES
33
- - MANIFEST
34
- - test/tc_rot13.rb
32
+ - lib/crypt/rot13.rb
33
+ - CHANGES
34
+ - MANIFEST
35
+ - README
36
+ - Rakefile
37
+ - test/tc_rot13.rb
35
38
  test_files:
36
- - test/tc_rot13.rb
39
+ - test/tc_rot13.rb
37
40
  rdoc_options: []
41
+
38
42
  extra_rdoc_files:
39
- - README
40
- - CHANGES
43
+ - README
44
+ - CHANGES
45
+ - MANIFEST
41
46
  executables: []
47
+
42
48
  extensions: []
49
+
43
50
  requirements: []
44
- dependencies: []
51
+
52
+ dependencies: []
53
+