imagesize 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,7 @@
1
- History.txt
2
1
  Manifest.txt
3
2
  README.txt
4
- Rakefile
5
3
  lib/image_size.rb
6
4
  lib/image_size/version.rb
7
- scripts/txt2html
8
5
  setup.rb
9
6
  test/test_helper.rb
10
7
  test/test_image_size.rb
data/README.txt CHANGED
@@ -7,7 +7,7 @@ measure image (GIF, PNG, JPEG ,,, etc) size code by Pure Ruby
7
7
 
8
8
  The latest version of image_size can be found at
9
9
 
10
- * http://rubyforge.org/projects/imagesize
10
+ * http://rubyforge.org/frs/?group_id=3460
11
11
 
12
12
  == Installation
13
13
 
@@ -35,7 +35,8 @@ class ImageSize
35
35
  end
36
36
 
37
37
  # receive image & make size
38
- # argument is image String, StringIO or IO
38
+ # argument 1 is image String, StringIO or IO
39
+ # argument 2 is type(ImageSize::Type::GIF and so on.) or nil
39
40
  def initialize(img_data, img_type = nil)
40
41
  @img_data = img_data.dup
41
42
  @img_wedth = nil
@@ -85,12 +86,12 @@ class ImageSize
85
86
  if @img_type == Type::OTHER then nil else @img_height end
86
87
  end
87
88
 
88
- # get image height
89
+ # get image width
89
90
  def get_width
90
91
  if @img_type == Type::OTHER then nil else @img_width end
91
92
  end
92
93
 
93
- # get image wight and height(Array)
94
+ # get image width and height(Array)
94
95
  def get_size
95
96
  [self.get_width, self.get_height]
96
97
  end
@@ -1,8 +1,8 @@
1
1
  module Imagesize #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 0
5
- TINY = 2
4
+ MINOR = 1
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: imagesize
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.2
7
- date: 2007-04-23 00:00:00 +09:00
6
+ version: 0.1.0
7
+ date: 2007-04-24 00:00:00 +09:00
8
8
  summary: measure image size(GIF, PNG, JPEG ,,, etc)
9
9
  require_paths:
10
10
  - lib
@@ -29,13 +29,10 @@ post_install_message:
29
29
  authors:
30
30
  - Keisuke Minami
31
31
  files:
32
- - History.txt
33
32
  - Manifest.txt
34
33
  - README.txt
35
- - Rakefile
36
34
  - lib/image_size.rb
37
35
  - lib/image_size/version.rb
38
- - scripts/txt2html
39
36
  - setup.rb
40
37
  - test/test_helper.rb
41
38
  - test/test_image_size.rb
@@ -54,10 +51,18 @@ files:
54
51
  test_files:
55
52
  - test/test_helper.rb
56
53
  - test/test_image_size.rb
57
- rdoc_options: []
58
-
59
- extra_rdoc_files: []
60
-
54
+ rdoc_options:
55
+ - --quiet
56
+ - --title
57
+ - imagesize documentation
58
+ - --opname
59
+ - index.html
60
+ - --line-numbers
61
+ - --main
62
+ - README.txt
63
+ - --inline-source
64
+ extra_rdoc_files:
65
+ - README.txt
61
66
  executables: []
62
67
 
63
68
  extensions: []
@@ -1,4 +0,0 @@
1
- +++ 0.0.1 2007-04-19
2
-
3
- + 1 major enhancement:
4
- + Initial release
data/Rakefile DELETED
@@ -1,98 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/clean'
4
- require 'rake/testtask'
5
- require 'rake/packagetask'
6
- require 'rake/gempackagetask'
7
- require 'rake/rdoctask'
8
- require 'rake/contrib/rubyforgepublisher'
9
- require 'fileutils'
10
- require 'hoe'
11
- include FileUtils
12
- require File.join(File.dirname(__FILE__), 'lib', 'image_size', 'version')
13
-
14
- AUTHOR = 'Keisuke Minami' # can also be an array of Authors
15
- EMAIL = "keisuke@rccn.com"
16
- DESCRIPTION = "measure image size(GIF, PNG, JPEG ,,, etc)"
17
- GEM_NAME = 'imagesize' # what ppl will type to install your gem
18
- RUBYFORGE_PROJECT = 'imagesize' # The unix name for your project
19
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
20
-
21
-
22
- NAME = "imagesize"
23
- REV = nil # UNCOMMENT IF REQUIRED: File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
24
- VERS = ENV['VERSION'] || (Imagesize::VERSION::STRING + (REV ? ".#{REV}" : ""))
25
- CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
26
- RDOC_OPTS = ['--quiet', '--title', 'imagesize documentation',
27
- "--opname", "index.html",
28
- "--line-numbers",
29
- "--main", "README",
30
- "--inline-source"]
31
-
32
- class Hoe
33
- def extra_deps
34
- @extra_deps.reject { |x| Array(x).first == 'hoe' }
35
- end
36
- end
37
-
38
- # Generate all the Rake tasks
39
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
40
- hoe = Hoe.new(GEM_NAME, VERS) do |p|
41
- p.author = AUTHOR
42
- p.description = DESCRIPTION
43
- p.email = EMAIL
44
- p.summary = DESCRIPTION
45
- p.url = HOMEPATH
46
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
47
- p.test_globs = ["test/**/test_*.rb"]
48
- p.clean_globs = CLEAN #An array of file patterns to delete on clean.
49
-
50
- # == Optional
51
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
52
- #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
53
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
54
- end
55
-
56
-
57
- desc 'Generate website files'
58
- task :website_generate do
59
- Dir['website/**/*.txt'].each do |txt|
60
- sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
61
- end
62
- end
63
-
64
- desc 'Upload website files to rubyforge'
65
- task :website_upload do
66
- config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
67
- host = "#{config["username"]}@rubyforge.org"
68
- remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/"
69
- # remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
70
- local_dir = 'website'
71
- sh %{rsync -av #{local_dir}/ #{host}:#{remote_dir}}
72
- end
73
-
74
- desc 'Generate and upload website files'
75
- task :website => [:website_generate, :website_upload]
76
-
77
-
78
-
79
- ### ここから持ってきた設定
80
- ### http://d.hatena.ne.jp/secondlife/20061106/1162785661
81
- Rake::RDocTask.new do |rdoc|
82
- rdoc.rdoc_dir = 'html'
83
- rdoc.options += RDOC_OPTS
84
- rdoc.template = "#{ENV['template']}.rb" if ENV['template']
85
- if ENV['DOC_FILES']
86
- rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
87
- else
88
- # rdoc.rdoc_files.include('README', 'CHANGELOG')
89
- rdoc.rdoc_files.include('README.txt')
90
- # rdoc.rdoc_files.include('lib/*.rb')
91
- rdoc.rdoc_files.include('lib/**/*.rb')
92
- end
93
- end
94
-
95
- desc "Publish to RubyForge"
96
- task :rubyforge => [:rdoc, :package] do
97
- Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, 'gawgaw61').upload
98
- end
@@ -1,67 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'redcloth'
5
- require 'syntax/convertors/html'
6
- require 'erb'
7
- require File.dirname(__FILE__) + '/../lib/image_size/version.rb'
8
-
9
- version = Imagesize::VERSION::STRING
10
- download = 'http://rubyforge.org/projects/imagesize'
11
-
12
- class Fixnum
13
- def ordinal
14
- # teens
15
- return 'th' if (10..19).include?(self % 100)
16
- # others
17
- case self % 10
18
- when 1: return 'st'
19
- when 2: return 'nd'
20
- when 3: return 'rd'
21
- else return 'th'
22
- end
23
- end
24
- end
25
-
26
- class Time
27
- def pretty
28
- return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
29
- end
30
- end
31
-
32
- def convert_syntax(syntax, source)
33
- return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
34
- end
35
-
36
- if ARGV.length >= 1
37
- src, template = ARGV
38
- template ||= File.dirname(__FILE__) + '/../website/template.rhtml'
39
-
40
- else
41
- puts("Usage: #{File.split($0).last} source.txt [template.rhtml] > output.html")
42
- exit!
43
- end
44
-
45
- template = ERB.new(File.open(template).read)
46
-
47
- title = nil
48
- body = nil
49
- File.open(src) do |fsrc|
50
- title_text = fsrc.readline
51
- body_text = fsrc.read
52
- syntax_items = []
53
- body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</>!m){
54
- ident = syntax_items.length
55
- element, syntax, source = $1, $2, $3
56
- syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
57
- "syntax-temp-#{ident}"
58
- }
59
- title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
60
- body = RedCloth.new(body_text).to_html
61
- body.gsub!(%r!(?:<pre><code>)?syntax-temp-(d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
62
- end
63
- stat = File.stat(src)
64
- created = stat.ctime
65
- modified = stat.mtime
66
-
67
- $stdout << template.result(binding)