Permalink
Browse files

Built gem for 0.0.2

  • Loading branch information...
1 parent 6f210cf commit c09291c0aea7151baa216090ae22a3e3c4e3f6ee @jlindley committed May 21, 2008
Showing with 2,849 additions and 0 deletions.
  1. +61 −0 README.txt
  2. BIN pkg/title_case-0.0.2.gem
  3. BIN pkg/title_case-0.0.2.tgz
  4. +4 −0 pkg/title_case-0.0.2/History.txt
  5. +20 −0 pkg/title_case-0.0.2/License.txt
  6. +28 −0 pkg/title_case-0.0.2/Manifest.txt
  7. +3 −0 pkg/title_case-0.0.2/PostInstall.txt
  8. +61 −0 pkg/title_case-0.0.2/README.markdown
  9. +4 −0 pkg/title_case-0.0.2/Rakefile
  10. +75 −0 pkg/title_case-0.0.2/config/hoe.rb
  11. +15 −0 pkg/title_case-0.0.2/config/requirements.rb
  12. +101 −0 pkg/title_case-0.0.2/lib/title_case.rb
  13. +9 −0 pkg/title_case-0.0.2/lib/title_case/version.rb
  14. +10 −0 pkg/title_case-0.0.2/script/console
  15. +14 −0 pkg/title_case-0.0.2/script/destroy
  16. +14 −0 pkg/title_case-0.0.2/script/generate
  17. +82 −0 pkg/title_case-0.0.2/script/txt2html
  18. +1,585 −0 pkg/title_case-0.0.2/setup.rb
  19. +1 −0 pkg/title_case-0.0.2/spec/spec.opts
  20. +10 −0 pkg/title_case-0.0.2/spec/spec_helper.rb
  21. +81 −0 pkg/title_case-0.0.2/spec/title_case_spec.rb
  22. +34 −0 pkg/title_case-0.0.2/tasks/deployment.rake
  23. +7 −0 pkg/title_case-0.0.2/tasks/environment.rake
  24. +21 −0 pkg/title_case-0.0.2/tasks/rspec.rake
  25. +17 −0 pkg/title_case-0.0.2/tasks/website.rake
  26. +27 −0 pkg/title_case-0.0.2/title_case.gemspec
  27. +11 −0 pkg/title_case-0.0.2/website/index.html
  28. +83 −0 pkg/title_case-0.0.2/website/index.txt
  29. +285 −0 pkg/title_case-0.0.2/website/javascripts/rounded_corners_lite.inc.js
  30. +138 −0 pkg/title_case-0.0.2/website/stylesheets/screen.css
  31. +48 −0 pkg/title_case-0.0.2/website/template.html.erb
  32. BIN titlecase-0.0.1.gem
View
@@ -0,0 +1,61 @@
+TITLE CASE
+===
+
+A port of John Gruber's title casing script to Ruby.
+2008-05-21 Jim Lindley http://jimlindley.com
+
+http://github.com/jlindley/title_case
+
+Original Perl Source: http://daringfireball.net/projects/titlecase/TitleCase.pl
+
+This filter changes all words to Title Caps, and attempts to be clever
+about *un*capitalizing small words like a/an/the in the input.
+
+The list of "small words" which are not capped comes from
+the New York Times Manual of Style, plus 'vs' and 'v'.
+
+John Gruber
+http://daringfireball.net/
+10 May 2008
+
+INSTALL:
+---
+
+Download the tarball for now, will be mirrored to ruby forge shortly.
+
+
+USAGE
+---
+
+Either create a new instance of TitleClass with the string as an argument, or use the monkeypatched #titlecase method on string objects.
+
+ require 'rubygems'
+ require 'title_case'
+ TitleCase.new("my little string").to_s #=> "My Little String"
+ "a boat, a duck: a bit too much".titlecase #=> "A Boat, a Duck: A Bit Too Much"
+
+LICENSE:
+---
+
+(The MIT License)
+
+Copyright (c) 2008 John Gruber, Jim Lindley
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
Binary file not shown.
View
Binary file not shown.
@@ -0,0 +1,4 @@
+== 0.0.1 2008-05-21
+
+* 1 major enhancement:
+ * Initial release
@@ -0,0 +1,20 @@
+Copyright (c) 2008 John Gruber (original Perl), Jim Lindley (ruby port)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,28 @@
+History.txt
+License.txt
+Manifest.txt
+PostInstall.txt
+README.markdown
+Rakefile
+config/hoe.rb
+config/requirements.rb
+lib/title_case.rb
+lib/title_case/version.rb
+script/console
+script/destroy
+script/generate
+script/txt2html
+setup.rb
+spec/spec.opts
+spec/spec_helper.rb
+spec/title_case_spec.rb
+tasks/deployment.rake
+tasks/environment.rake
+tasks/rspec.rake
+tasks/website.rake
+title_case.gemspec
+website/index.html
+website/index.txt
+website/javascripts/rounded_corners_lite.inc.js
+website/stylesheets/screen.css
+website/template.html.erb
@@ -0,0 +1,3 @@
+
+For more information on title_case, see http://github.com/jlindley/title_case
+
@@ -0,0 +1,61 @@
+TITLE CASE
+===
+
+A port of John Gruber's title casing script to Ruby.
+2008-05-21 Jim Lindley http://jimlindley.com
+
+http://github.com/jlindley/title_case
+
+Original Perl Source: http://daringfireball.net/projects/titlecase/TitleCase.pl
+
+This filter changes all words to Title Caps, and attempts to be clever
+about *un*capitalizing small words like a/an/the in the input.
+
+The list of "small words" which are not capped comes from
+the New York Times Manual of Style, plus 'vs' and 'v'.
+
+John Gruber
+http://daringfireball.net/
+10 May 2008
+
+INSTALL:
+---
+
+Download the tarball for now, will be mirrored to ruby forge shortly.
+
+
+USAGE
+---
+
+Either create a new instance of TitleClass with the string as an argument, or use the monkeypatched #titlecase method on string objects.
+
+ require 'rubygems'
+ require 'title_case'
+ TitleCase.new("my little string").to_s #=> "My Little String"
+ "a boat, a duck: a bit too much".titlecase #=> "A Boat, a Duck: A Bit Too Much"
+
+LICENSE:
+---
+
+(The MIT License)
+
+Copyright (c) 2008 John Gruber, Jim Lindley
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,4 @@
+require 'config/requirements'
+require 'config/hoe' # setup Hoe + all gem configuration
+
+Dir['tasks/**/*.rake'].each { |rake| load rake }
@@ -0,0 +1,75 @@
+require 'title_case/version'
+
+AUTHOR = 'Jim Lindley' # can also be an array of Authors
+EMAIL = "jim@jimlindley.com"
+DESCRIPTION = "Title Case for Strings"
+GEM_NAME = 'title_case' # what ppl will type to install your gem
+
+RUBYFORGE_PROJECT = 'title_case'
+HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
+DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
+
+EXTRA_DEPENDENCIES = [
+# ['activesupport', '>= 1.3.1']
+] # An array of rubygem dependencies [name, version]
+
+@config_file = "~/.rubyforge/user-config.yml"
+@config = nil
+RUBYFORGE_USERNAME = "unknown"
+def rubyforge_username
+ unless @config
+ begin
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
+ rescue
+ puts <<-EOS
+ERROR: No rubyforge config file found: #{@config_file}
+Run 'rubyforge setup' to prepare your env for access to Rubyforge
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
+ EOS
+ exit
+ end
+ end
+ RUBYFORGE_USERNAME.replace @config["username"]
+end
+
+
+REV = nil
+# UNCOMMENT IF REQUIRED:
+# REV = YAML.load(`svn info`)['Revision']
+VERS = TitleCase::VERSION::STRING + (REV ? ".#{REV}" : "")
+RDOC_OPTS = ['--quiet', '--title', 'TitleCase documentation',
+ "--opname", "index.html",
+ "--line-numbers",
+ "--main", "README",
+ "--inline-source"]
+
+class Hoe
+ def extra_deps
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
+ @extra_deps
+ end
+end
+
+# Generate all the Rake tasks
+# Run 'rake -T' to see list of generated tasks (from gem root directory)
+$hoe = Hoe.new(GEM_NAME, VERS) do |p|
+ p.developer(AUTHOR, EMAIL)
+ p.description = DESCRIPTION
+ p.summary = DESCRIPTION
+ p.url = HOMEPATH
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
+ p.test_globs = ["test/**/test_*.rb"]
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
+
+ # == Optional
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
+ #p.extra_deps = EXTRA_DEPENDENCIES
+
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
+ end
+
+CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
+PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
+$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
+$hoe.rsync_args = '-av --delete --ignore-errors'
+$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -0,0 +1,15 @@
+require 'fileutils'
+include FileUtils
+
+require 'rubygems'
+%w[rake hoe newgem rubigen].each do |req_gem|
+ begin
+ require req_gem
+ rescue LoadError
+ puts "This Rakefile requires the '#{req_gem}' RubyGem."
+ puts "Installation: gem install #{req_gem} -y"
+ exit
+ end
+end
+
+$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
@@ -0,0 +1,101 @@
+$:.unshift(File.dirname(__FILE__)) unless
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
+
+# A port of John Gruber's title casing script to Ruby.
+# 2008-05-21 Jim Lindley http://jimlindley.com
+#
+# --- Original Copyright Notice ---
+#
+# This filter changes all words to Title Caps, and attempts to be clever
+# about *un*capitalizing small words like a/an/the in the input.
+#
+# The list of "small words" which are not capped comes from
+# the New York Times Manual of Style, plus 'vs' and 'v'.
+#
+# John Gruber
+# http://daringfireball.net/
+# 10 May 2008
+#
+# License: http://www.opensource.org/licenses/mit-license.php
+#
+class TitleCase
+
+ def initialize(string)
+ @raw_string = string
+ convert
+ end
+
+ def to_s
+ @title_case_string
+ end
+
+ def original
+ @raw_string
+ end
+
+ def self.small_words
+ @small_words = %w(a an and as at but by en for if in of on or the to v[.]? via vs[.]?)
+ end
+
+ def self.small_words=(words)
+ @small_words = words
+ end
+
+ def self.small_words_re
+ small_words.join('|')
+ end
+
+ private
+
+ def convert
+ @title_case_string = ""
+ @raw_string.each_line do |line|
+ line.split(/( [:.;?!][ ] | (?:[ ]|^)["“] )/ux).each do |sub_phrase|
+
+ # upper case phrase words
+ sub_phrase = uppercase_phrase(sub_phrase)
+
+ # lower case small words
+ sub_phrase.gsub!(/\b(#{TitleCase.small_words_re})\b/ui){|small| small.downcase }
+
+ # upper case small words at start of phrase
+ sub_phrase.gsub!(/\A[[:punct:]]*(#{TitleCase.small_words_re})\b/u){|small| small.capitalize }
+
+ # upper case small words at end of phrase
+ sub_phrase.gsub!(/\b(#{TitleCase.small_words_re})[[:punct:]]*\Z/u){|small| small.capitalize }
+
+ sub_phrase = special_cases(sub_phrase)
+ @title_case_string << sub_phrase
+ end
+ end
+ end
+
+ def uppercase_phrase(phrase)
+ phrase.gsub!(/\b([[:alpha:]][[:lower:].'’]*)\b/u) do |word|
+ if /[[:alpha:]][.][[:alpha:]]/u.match(word)
+ word
+ else
+ word.downcase.capitalize
+ end
+ end
+ phrase
+ end
+
+ def special_cases(phrase)
+ phrase.gsub!(/\b(vs?\.?)\b/ui){ |vs| vs.downcase }
+ phrase.gsub!(/(['’]S)\b/u) { |aps| aps.downcase }
+ phrase.gsub!(/\b(AT&T|Q&A)\b/ui){|special| special.upcase }
+ phrase
+ end
+
+end
+
+class String
+
+ def titlecase
+ TitleCase.new(self).to_s
+ end
+
+end
+
+
@@ -0,0 +1,9 @@
+class TitleCase #:nodoc:
+ module VERSION #:nodoc:
+ MAJOR = 0
+ MINOR = 0
+ TINY = 2
+
+ STRING = [MAJOR, MINOR, TINY].join('.')
+ end
+end
Oops, something went wrong.

0 comments on commit c09291c

Please sign in to comment.