diff --git a/.document b/.document new file mode 100644 index 0000000..1208560 --- /dev/null +++ b/.document @@ -0,0 +1,5 @@ +README.rdoc +lib/**/*.rb +bin/* +features/**/*.feature +LICENSE \ No newline at end of file diff --git a/.gitignore b/.gitignore index 98d9521..2213c2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,24 @@ +## MAC OS +.DS_Store + +## TEXTMATE +*.tmproj +tmtags + +## EMACS +*~ +\#* +.\#* + +## VIM +*.swp + +## PROJECT::GENERAL +coverage +rdoc +pkg + +## PROJECT::SPECIFIC bin doc ex_ics_api.out diff --git a/README b/README.rdoc similarity index 100% rename from README rename to README.rdoc diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..05024bc --- /dev/null +++ b/Rakefile @@ -0,0 +1,53 @@ +require 'rubygems' +require 'rake' + +begin + require 'jeweler' + Jeweler::Tasks.new do |gem| + gem.name = "vpim" + gem.summary = %Q{vCard and iCalendar support} + gem.description = %Q{vCard and iCalendar support, the standard for exchange and storage of contact information and calendars} + gem.email = "sam@github" + gem.homepage = "http://github.com/sam-github/vpim" + gem.authors = ["Sam Roberts"] + #gem.add_development_dependency "shoulda", ">= 0" + # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings + end + Jeweler::GemcutterTasks.new +rescue LoadError + puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" +end + +require 'rake/testtask' +Rake::TestTask.new(:test) do |test| + test.libs << 'lib' << 'test' + test.pattern = 'test/**/test_*.rb' + test.verbose = true +end + +begin + require 'rcov/rcovtask' + Rcov::RcovTask.new do |test| + test.libs << 'test' + test.pattern = 'test/**/test_*.rb' + test.verbose = true + end +rescue LoadError + task :rcov do + abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov" + end +end + +task :test => :check_dependencies + +task :default => :test + +require 'rake/rdoctask' +Rake::RDocTask.new do |rdoc| + version = File.exist?('VERSION') ? File.read('VERSION') : "" + + rdoc.rdoc_dir = 'rdoc' + rdoc.title = "vpim #{version}" + rdoc.rdoc_files.include('README*') + rdoc.rdoc_files.include('lib/**/*.rb') +end \ No newline at end of file diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..bcaffe1 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.7.0 \ No newline at end of file diff --git a/lib/vpim/icalendar.rb b/lib/vpim/icalendar.rb index 8f4d16b..59588e5 100644 --- a/lib/vpim/icalendar.rb +++ b/lib/vpim/icalendar.rb @@ -358,7 +358,7 @@ def components(klass=Object) #:yields:component # such as timezone definitions. def each(klass=nil, &block) # :yield: component unless block - return Enumerable::Enumerator.new(self, :each, klass) + return self.enum_for(:each) end components(klass, &block) end diff --git a/lib/vpim/vcard.rb b/lib/vpim/vcard.rb index 0298ef0..c8f8dda 100644 --- a/lib/vpim/vcard.rb +++ b/lib/vpim/vcard.rb @@ -669,22 +669,7 @@ def Vcard.decode(card) raise ArgumentError, "Vcard.decode cannot be called with a #{card.type}" end - case string - when /^\xEF\xBB\xBF/ - string = string.sub("\xEF\xBB\xBF", '') - when /^\xFE\xFF/ - arr = string.unpack('n*') - arr.shift - string = arr.pack('U*') - when /^\xFF\xFE/ - arr = string.unpack('v*') - arr.shift - string = arr.pack('U*') - when /^\x00B/i - string = string.unpack('n*').pack('U*') - when /^B\x00/i - string = string.unpack('v*').pack('U*') - end + string.force_encoding(Encoding::UTF_8) entities = Vpim.expand(Vpim.decode(string)) diff --git a/vpim.gemspec b/vpim.gemspec index f66b0d5..2681231 100644 --- a/vpim.gemspec +++ b/vpim.gemspec @@ -1,74 +1,146 @@ -require 'ubygems' -require 'pp' -require 'rake' +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command +# -*- encoding: utf-8 -*- -def info(s) - { - :author => "Sam Roberts", - :email => "vieuxtech@gmail.com", - :homepage => "http://vpim.rubyforge.org", - :rubyforge_project => "vpim", - }.each do |k,v| - s.send(k.to_s+"=", v) - end -end - -spec_vpim = Gem::Specification.new do |s| - info(s) - s.name = "vpim" - s.version = `ruby stamp.rb` - s.summary = "iCalendar and vCard support for ruby" - s.description = <<'---' -This is a pure-ruby library for decoding and encoding vCard and iCalendar data -("personal information") called vPim. ---- - s.has_rdoc = true - s.extra_rdoc_files = ["README", "CHANGES", "COPYING", "samples/README.mutt" ] +Gem::Specification.new do |s| + s.name = %q{vpim} + s.version = "0.7.0" - candidates = FileList[ - 'lib/vpim/**/*.rb', - 'lib/vpim.rb', - 'bin/*', - 'samples/*', - 'test/test_*.rb', - 'COPYING', - 'README', - 'CHANGES', - ].to_a - - s.files = candidates - s.test_files = Dir.glob("test/test_*.rb") - s.executables = FileList["bin/*"].map{|path| File.basename(path)} - - s.require_path = "lib" -# s.add_dependency("plist") -# s.autorequire = "vpim" -end + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Sam Roberts"] + s.date = %q{2010-05-29} + s.description = %q{vCard and iCalendar support, the standard for exchange and storage of contact information and calendars} + s.email = %q{sam@github} + s.extra_rdoc_files = [ + "README.rdoc" + ] + s.files = [ + ".document", + ".gitignore", + "CHANGES", + "COPYING", + "Makefile", + "README.rdoc", + "Rakefile", + "THANKS", + "VERSION", + "ex_fmt_convert.rb", + "ex_ics_api.rb", + "lib/vpim.rb", + "lib/vpim/address.rb", + "lib/vpim/agent/atomize.rb", + "lib/vpim/agent/base.rb", + "lib/vpim/agent/calendars.rb", + "lib/vpim/agent/handler.rb", + "lib/vpim/agent/ics.rb", + "lib/vpim/attachment.rb", + "lib/vpim/date.rb", + "lib/vpim/dirinfo.rb", + "lib/vpim/duration.rb", + "lib/vpim/enumerator.rb", + "lib/vpim/field.rb", + "lib/vpim/icalendar.rb", + "lib/vpim/maker/vcard.rb", + "lib/vpim/property/base.rb", + "lib/vpim/property/common.rb", + "lib/vpim/property/location.rb", + "lib/vpim/property/priority.rb", + "lib/vpim/property/recurrence.rb", + "lib/vpim/property/resources.rb", + "lib/vpim/repo.rb", + "lib/vpim/rfc2425.rb", + "lib/vpim/rrule.rb", + "lib/vpim/time.rb", + "lib/vpim/vcard.rb", + "lib/vpim/version.rb", + "lib/vpim/vevent.rb", + "lib/vpim/view.rb", + "lib/vpim/vjournal.rb", + "lib/vpim/vpim.rb", + "lib/vpim/vtodo.rb", + "mbox2vcard.rb", + "outline.sh", + "profile.rb", + "profile.txt", + "samples/README.mutt", + "samples/ab-query.rb", + "samples/agent.ru", + "samples/cmd-itip.rb", + "samples/ex_cpvcard.rb", + "samples/ex_get_vcard_photo.rb", + "samples/ex_mkv21vcard.rb", + "samples/ex_mkvcard.rb", + "samples/ex_mkyourown.rb", + "samples/ics-dump.rb", + "samples/ics-to-rss.rb", + "samples/mutt-aliases-to-vcf.rb", + "samples/osx-wrappers.rb", + "samples/reminder.rb", + "samples/rrule.rb", + "samples/tabbed-file-to-vcf.rb", + "samples/vcf-dump.rb", + "samples/vcf-lines.rb", + "samples/vcf-to-ics.rb", + "samples/vcf-to-mutt.rb", + "setup.rb", + "stamp.rb", + "test/calendars/weather.calendar/Events/1205042405-0-0.ics", + "test/calendars/weather.calendar/Events/1205128857-1-1205128857.ics", + "test/calendars/weather.calendar/Events/1205215257-2--1884536782.ics", + "test/calendars/weather.calendar/Events/1205301657-3--679062325.ics", + "test/calendars/weather.calendar/Events/1205388057-4-526584932.ics", + "test/calendars/weather.calendar/Events/1205474457-5-1732404989.ics", + "test/calendars/weather.calendar/Events/1205560857-6--1356569450.ics", + "test/calendars/weather.calendar/Events/1205647257-7--150403793.ics", + "test/calendars/weather.calendar/Events/1205712057-8-1055761864.ics", + "test/calendars/weather.calendar/Info.plist", + "test/common.rb", + "test/test_agent_atomize.rb", + "test/test_agent_calendars.rb", + "test/test_agent_ics.rb", + "test/test_all.rb", + "test/test_date.rb", + "test/test_dur.rb", + "test/test_field.rb", + "test/test_ical.rb", + "test/test_misc.rb", + "test/test_repo.rb", + "test/test_rrule.rb", + "test/test_vcard.rb", + "test/test_view.rb", + "test/weekly.ics", + "vpim.gemspec" + ] + s.homepage = %q{http://github.com/sam-github/vpim} + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.6} + s.summary = %q{vCard and iCalendar support} + s.test_files = [ + "test/test_repo.rb", + "test/test_vcard.rb", + "test/test_rrule.rb", + "test/test_agent_calendars.rb", + "test/common.rb", + "test/test_field.rb", + "test/test_agent_ics.rb", + "test/test_misc.rb", + "test/test_all.rb", + "test/test_dur.rb", + "test/test_view.rb", + "test/test_ical.rb", + "test/test_agent_atomize.rb", + "test/test_date.rb" + ] -#pp [spec_vpim, spec_vpim.instance_variables] + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 -spec_vpim_icalendar = Gem::Specification.new do |s| - info(s) - s.name = "vpim_icalendar" - s.version = "1.1" - s.summary = "Virtual gem depending on vPim's iCalendar support for ruby" - s.description = <<'---' -This is a virtual gem, it exists to depend on vPim, which provides iCalendar -support for ruby. You can install vPim directly. ---- - s.add_dependency("vpim") -end - -#require 'hoe' -# -#Hoe.new(spec_vpim.name, spec_vpim.version) do |p| -# p.rubyforge_name = "vpim" -# p.remote_rdoc_dir = '' # Release to root -#end -# - -if $0==__FILE__ - Gem::Builder.new(spec_vpim).build - Gem::Builder.new(spec_vpim_icalendar).build + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + else + end + else + end end -