htauth 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +15 -0
  2. data/CONTRIBUTING.md +46 -0
  3. data/HISTORY.md +36 -0
  4. data/Manifest.txt +45 -0
  5. data/{README → README.md} +21 -22
  6. data/Rakefile +17 -0
  7. data/bin/htpasswd-ruby +5 -5
  8. data/lib/htauth/algorithm.rb +1 -8
  9. data/lib/htauth/crypt.rb +1 -1
  10. data/lib/htauth/digest.rb +5 -2
  11. data/lib/htauth/digest_entry.rb +5 -4
  12. data/lib/htauth/digest_file.rb +1 -1
  13. data/lib/htauth/errors.rb +10 -0
  14. data/lib/htauth/file.rb +1 -1
  15. data/lib/htauth/md5.rb +2 -0
  16. data/lib/htauth/passwd.rb +10 -4
  17. data/lib/htauth/passwd_entry.rb +2 -1
  18. data/lib/htauth/passwd_file.rb +64 -63
  19. data/lib/htauth/plaintext.rb +12 -11
  20. data/lib/htauth/version.rb +8 -9
  21. data/lib/htauth.rb +14 -4
  22. data/spec/crypt_spec.rb +10 -12
  23. data/spec/digest_entry_spec.rb +20 -21
  24. data/spec/digest_file_spec.rb +11 -12
  25. data/spec/digest_spec.rb +23 -23
  26. data/spec/md5_spec.rb +2 -2
  27. data/spec/passwd_entry_spec.rb +47 -48
  28. data/spec/passwd_file_spec.rb +12 -13
  29. data/spec/passwd_spec.rb +37 -38
  30. data/spec/plaintext_spec.rb +4 -7
  31. data/spec/sha1_spec.rb +3 -5
  32. data/spec/spec_helper.rb +8 -4
  33. data/spec/test.add.digest +3 -0
  34. data/spec/test.add.passwd +3 -0
  35. data/spec/test.delete.digest +1 -0
  36. data/spec/test.delete.passwd +1 -0
  37. data/spec/test.original.digest +2 -0
  38. data/spec/test.original.passwd +2 -0
  39. data/spec/test.update.digest +2 -0
  40. data/spec/test.update.passwd +2 -0
  41. data/tasks/default.rake +276 -0
  42. data/tasks/this.rb +214 -0
  43. metadata +131 -75
  44. data/HISTORY +0 -26
  45. data/gemspec.rb +0 -43
  46. data/tasks/announce.rake +0 -38
  47. data/tasks/config.rb +0 -98
  48. data/tasks/distribution.rake +0 -46
  49. data/tasks/documentation.rake +0 -31
  50. data/tasks/rspec.rake +0 -29
  51. data/tasks/rubyforge.rake +0 -59
  52. data/tasks/utils.rb +0 -80
@@ -1,46 +0,0 @@
1
- require 'tasks/config'
2
-
3
- #-------------------------------------------------------------------------------
4
- # Distribution and Packaging
5
- #-------------------------------------------------------------------------------
6
- if pkg_config = Configuration.for_if_exist?("packaging") then
7
-
8
- require 'gemspec'
9
- require 'rake/gempackagetask'
10
- require 'rake/contrib/sshpublisher'
11
-
12
- namespace :dist do
13
-
14
- Rake::GemPackageTask.new(HTAuth::GEM_SPEC) do |pkg|
15
- pkg.need_tar = pkg_config.formats.tgz
16
- pkg.need_zip = pkg_config.formats.zip
17
- end
18
-
19
- desc "Install as a gem"
20
- task :install => [:clobber, :package] do
21
- sh "sudo gem install pkg/#{HTAuth::GEM_SPEC.full_name}.gem"
22
- end
23
-
24
- desc "Uninstall gem"
25
- task :uninstall do
26
- sh "sudo gem uninstall -x #{HTAuth::GEM_SPEC.name}"
27
- end
28
-
29
- desc "dump gemspec"
30
- task :gemspec do
31
- puts HTAuth::GEM_SPEC.to_ruby
32
- end
33
-
34
- desc "distribute copiously"
35
- task :copious => [ :package ] do
36
- Rake::SshFilePublisher.new('jeremy@copiousfreetime.org',
37
- '/var/www/vhosts/www.copiousfreetime.org/htdocs/gems/gems',
38
- 'pkg' ,"#{HTAuth::GEM_SPEC.full_name}.gem").upload
39
- sh "ssh jeremy@copiousfreetime.org rake -f /var/www/vhosts/www.copiousfreetime.org/htdocs/gems/Rakefile"
40
- end
41
-
42
- desc "reinstall gem"
43
- task :reinstall => [:uninstall, :repackage, :install]
44
-
45
- end
46
- end
@@ -1,31 +0,0 @@
1
- require 'tasks/config'
2
-
3
- #-----------------------------------------------------------------------
4
- # Documentation
5
- #-----------------------------------------------------------------------
6
-
7
- if rdoc_config = Configuration.for_if_exist?('rdoc') then
8
-
9
- namespace :doc do
10
-
11
- require 'rake/rdoctask'
12
-
13
- # generating documentation locally
14
- Rake::RDocTask.new do |rdoc|
15
- rdoc.rdoc_dir = rdoc_config.output_dir
16
- rdoc.options = rdoc_config.options
17
- rdoc.rdoc_files = rdoc_config.files
18
- rdoc.title = rdoc_config.title
19
- rdoc.main = rdoc_config.main_page
20
- end
21
-
22
- if rubyforge_config = Configuration.for_if_exist?('rubyforge') then
23
- desc "Deploy the RDoc documentation to #{rubyforge_config.rdoc_location}"
24
- task :deploy => :rerdoc do
25
- sh "rsync -zav --delete #{rdoc_config.output_dir}/ #{rubyforge_config.rdoc_location}"
26
- end
27
- end
28
-
29
- end
30
- end
31
-
data/tasks/rspec.rake DELETED
@@ -1,29 +0,0 @@
1
-
2
- require 'tasks/config'
3
-
4
- #--------------------------------------------------------------------------------
5
- # configuration for running rspec. This shows up as the test:default task
6
- #--------------------------------------------------------------------------------
7
- if spec_config = Configuration.for_if_exist?("test") then
8
- if spec_config.mode == "spec" then
9
- namespace :test do
10
-
11
- task :default => :spec
12
-
13
- require 'spec/rake/spectask'
14
- Spec::Rake::SpecTask.new do |r|
15
- r.ruby_opts = spec_config.ruby_opts
16
- r.libs = [ HTAuth.lib_path,
17
- HTAuth.root_dir ]
18
- r.spec_files = spec_config.files
19
- r.spec_opts = spec_config.options
20
-
21
- if rcov_config = Configuration.for_if_exist?('rcov') then
22
- r.rcov = true
23
- r.rcov_dir = rcov_config.output_dir
24
- r.rcov_opts = rcov_config.rcov_opts
25
- end
26
- end
27
- end
28
- end
29
- end
data/tasks/rubyforge.rake DELETED
@@ -1,59 +0,0 @@
1
- require 'tasks/config'
2
-
3
- #-----------------------------------------------------------------------
4
- # Rubyforge additions to the task library
5
- #-----------------------------------------------------------------------
6
- if rf_conf = Configuration.for_if_exist?("rubyforge") then
7
-
8
- abort("rubyforge gem not installed 'gem install rubyforge'") unless Utils.try_require('rubyforge')
9
-
10
- proj_conf = Configuration.for('project')
11
-
12
- namespace :dist do
13
- desc "Release files to rubyforge"
14
- task :rubyforge => [:clean, :package ] do
15
-
16
- rubyforge = RubyForge.new
17
-
18
- config = {}
19
- config["release_notes"] = proj_conf.description
20
- config["release_changes"] = Utils.release_notes_from(proj_conf.history)[HTAuth::VERSION]
21
- config["Prefomatted"] = true
22
-
23
- rubyforge.configure config
24
-
25
- # make sure this release doesn't already exist
26
- releases = rubyforge.autoconfig['release_ids']
27
- if releases.has_key?(HTAuth::GEM_SPEC.name) and releases[HTAuth::GEM_SPEC.name][HTAuth::VERSION] then
28
- abort("Release #{HTAuth::VERSION} already exists! Unable to release.")
29
- end
30
-
31
- puts "Uploading to rubyforge..."
32
- files = FileList[File.join("pkg","#{HTAuth::GEM_SPEC.name}-#{HTAuth::VERSION}*.*")].to_a
33
- files.each do |f|
34
- puts " * #{f}"
35
- end
36
- rubyforge.login
37
- rubyforge.add_release(HTAuth::GEM_SPEC.rubyforge_project, HTAuth::GEM_SPEC.name, HTAuth::VERSION, *files)
38
- puts "done."
39
- end
40
- end
41
-
42
- namespace :announce do
43
- desc "Post news of #{proj_conf.name} to #{rf_conf.project} on rubyforge"
44
- task :rubyforge do
45
- info = Utils.announcement
46
-
47
- puts "Subject : #{info[:subject]}"
48
- msg = "#{info[:title]}\n\n#{info[:urls]}\n\n#{info[:release_notes]}"
49
- puts msg
50
-
51
- rubyforge = RubyForge.new
52
- rubyforge.configure
53
- rubyforge.login
54
- rubyforge.post_news(rf_conf.project, info[:subject], msg )
55
- puts "Posted to rubyforge"
56
- end
57
-
58
- end
59
- end
data/tasks/utils.rb DELETED
@@ -1,80 +0,0 @@
1
- require 'crate/version'
2
-
3
- #-------------------------------------------------------------------------------
4
- # Additions to the Configuration class that are useful
5
- #-------------------------------------------------------------------------------
6
- class Configuration
7
- class << self
8
- def exist?( name )
9
- Configuration::Table.has_key?( name )
10
- end
11
-
12
- def for_if_exist?( name )
13
- if self.exist?( name ) then
14
- self.for( name )
15
- end
16
- end
17
- end
18
- end
19
-
20
- #-------------------------------------------------------------------------------
21
- # some useful utilitiy methods for the tasks
22
- #-------------------------------------------------------------------------------
23
- module Utils
24
- class << self
25
-
26
- # Try to load the given _library_ using the built-in require, but do not
27
- # raise a LoadError if unsuccessful. Returns +true+ if the _library_ was
28
- # successfully loaded; returns +false+ otherwise.
29
- #
30
- def try_require( lib )
31
- require lib
32
- true
33
- rescue LoadError
34
- false
35
- end
36
-
37
- # partition an rdoc file into sections, and return the text of the section
38
- # given.
39
- def section_of(file, section_name)
40
- File.read(file).split(/^(?==)/).each do |section|
41
- lines = section.split("\n")
42
- return lines[1..-1].join("\n").strip if lines.first =~ /#{section_name}/i
43
- end
44
- nil
45
- end
46
-
47
- # Get an array of all the changes in the application for a particular
48
- # release. This is done by looking in the history file and grabbing the
49
- # information for the most recent release. The history file is assumed to
50
- # be in RDoc format and version release are 2nd tier sections separated by
51
- # '=== Version X.Y.Z'
52
- #
53
- # returns:: A hash of notes keyed by version number
54
- #
55
- def release_notes_from(history_file)
56
- releases = {}
57
- File.read(history_file).split(/^(?=== Version)/).each do |section|
58
- lines = section.split("\n")
59
- md = %r{Version ((\w+\.)+\w+)}.match(lines.first)
60
- next unless md
61
- releases[md[1]] = lines[1..-1].join("\n").strip
62
- end
63
- return releases
64
- end
65
-
66
- # return a hash of useful information for the latest release
67
- # urls, subject, title, description and latest release notes
68
- #
69
- def announcement
70
- cfg = Configuration.for("project")
71
- {
72
- :subject => "#{cfg.name} #{HTAuth::VERSION} Released",
73
- :title => "#{cfg.name} version #{HTAuth::VERSION} has been released.",
74
- :urls => "#{cfg.homepage}",
75
- :description => "#{cfg.description.rstrip}",
76
- :release_notes => Utils.release_notes_from(cfg.history)[HTAuth::VERSION].rstrip
77
- }
78
- end
79
- end
80
- end # << self