gruff 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,15 @@
1
1
  CHANGELOG
2
2
 
3
+ == 0.2.4
4
+
5
+ * Added option to hide line numbers
6
+ * Fixed code that was causing warnings
7
+
8
+ == 0.2.3
9
+
10
+ * Cleaned up measurements so the graph expands to fill the available space
11
+ * Added x-axis and y-axis label options
12
+
3
13
  == 0.1.2
4
14
 
5
15
  * minimum_value and maximum_value can be set after data() to manually scale the graph
data/Manifest.txt ADDED
@@ -0,0 +1,35 @@
1
+ CHANGELOG
2
+ README.txt
3
+ MIT-LICENSE
4
+ Rakefile
5
+ Manifest.txt
6
+
7
+ lib/gruff.rb
8
+ lib/gruff/area.rb
9
+ lib/gruff/bar.rb
10
+ lib/gruff/bar_conversion.rb
11
+ lib/gruff/base.rb
12
+ lib/gruff/deprecated.rb
13
+ lib/gruff/line.rb
14
+ lib/gruff/net.rb
15
+ lib/gruff/photo_bar.rb
16
+ lib/gruff/pie.rb
17
+ lib/gruff/scene.rb
18
+ lib/gruff/side_stacked_bar.rb
19
+ lib/gruff/spider.rb
20
+ lib/gruff/stacked_bar.rb
21
+
22
+ test/test_area.rb
23
+ test/test_bar.rb
24
+ test/test_base.rb
25
+ test/gruff_test_case.rb
26
+ test/test_legend.rb
27
+ test/test_line.rb
28
+ test/test_net.rb
29
+ test/output
30
+ test/test_photo.rb
31
+ test/test_pie.rb
32
+ test/test_scene.rb
33
+ test/test_sidestacked_bar.rb
34
+ test/test_spider.rb
35
+ test/test_stacked_bar.rb
File without changes
data/Rakefile CHANGED
@@ -1,209 +1,227 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/testtask'
4
- require 'rake/rdoctask'
5
- require 'rake/packagetask'
6
- require 'rake/gempackagetask'
7
- require 'rake/contrib/rubyforgepublisher'
8
1
 
2
+ require 'rubygems'
3
+ require 'hoe'
9
4
  $:.unshift(File.dirname(__FILE__) + "/lib")
10
5
  require 'gruff'
11
6
 
12
- PKG_NAME = 'gruff'
13
- PKG_VERSION = Gruff::VERSION
14
- PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
15
-
16
- RELEASE_NAME = "REL #{PKG_VERSION}"
17
-
18
- RUBY_FORGE_PROJECT = "gruff"
19
- RUBY_FORGE_USER = "topfunky"
20
-
21
- desc "Default Task"
22
- task :default => [ :clean, :test ]
23
-
24
- desc "Clean images generated by tests"
25
- task :clean do
26
- rm FileList['test/output/*.png']
27
- rm_rf 'pkg'
28
- rm_rf 'doc'
29
- end
30
-
31
- desc "Copy documentation to topfunky.com"
32
- task :rdoc_deploy => [:rdoc] do
33
- dirs = %w{doc}
34
- onserver = "topfunky@topfunky.com:/home/topfunky/topfunky.com/clients/rails/gruff"
35
- dirs.each do | dir|
36
- `rsync -avz -e ssh "#{`pwd`.chomp}/#{dir}" "#{onserver}" --exclude ".svn"`
37
- end
38
- end
39
-
40
- # Run the unit tests
41
- Rake::TestTask.new { |t|
42
- t.libs << "test"
43
- t.pattern = 'test/*_test.rb'
44
- t.verbose = true
45
- }
46
-
47
- # Genereate the RDoc documentation
48
- Rake::RDocTask.new { |rdoc|
49
- rdoc.rdoc_dir = 'doc'
50
- rdoc.title = "Gruff -- Beautiful graphs"
51
- # rdoc.options << '--line-numbers --inline-source --main README --accessor adv_attr_accessor=M'
52
- rdoc.template = "#{ENV['template']}.rb" if ENV['template']
53
- rdoc.rdoc_files.include('README', 'CHANGELOG')
54
- rdoc.rdoc_files.include('lib/gruff.rb')
55
- rdoc.rdoc_files.include('lib/gruff/*.rb')
56
- }
57
-
58
-
59
- # Create compressed packages
60
- spec = Gem::Specification.new do |s|
61
- s.platform = Gem::Platform::RUBY
62
- s.name = PKG_NAME
63
- s.summary = "Beautiful graphs for one or multiple datasets."
64
- s.description = %q{Make colorful graphs for use on websites or documents.}
65
- s.version = PKG_VERSION
66
-
67
- s.author = "Geoffrey Grosenbach"
68
- s.email = "boss@topfunky.com"
69
- s.rubyforge_project = RUBY_FORGE_PROJECT
70
- s.homepage = "http://www.topfunky.com"
71
-
72
- s.has_rdoc = true
73
- s.requirements << 'none'
74
- s.require_path = 'lib'
75
- s.autorequire = 'gruff'
76
-
77
- s.files = [ "Rakefile", "README", "CHANGELOG", "MIT-LICENSE" ]
78
- s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
79
- s.files = s.files + Dir.glob( "assets/*" ).delete_if { |item| item.include?( "\.svn" ) }
80
- s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) || item.include?("\.png") }
81
- end
82
-
83
- Rake::GemPackageTask.new(spec) do |p|
84
- p.gem_spec = spec
85
- p.need_tar = true
86
- p.need_zip = true
87
- end
88
-
89
- desc "Publish the API documentation"
90
- task :pgem => [:package] do
91
- Rake::SshFilePublisher.new("boss@topfunky.com", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
92
- end
93
-
94
- desc "Publish the release files to RubyForge."
95
- task :release => [:package] do
96
- files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
97
-
98
- if RUBY_FORGE_PROJECT then
99
- require 'net/http'
100
- require 'open-uri'
101
-
102
- project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
103
- project_data = open(project_uri) { |data| data.read }
104
- group_id = project_data[/[?&]group_id=(\d+)/, 1]
105
- raise "Couldn't get group id" unless group_id
106
-
107
- # This echos password to shell which is a bit sucky
108
- if ENV["RUBY_FORGE_PASSWORD"]
109
- password = ENV["RUBY_FORGE_PASSWORD"]
110
- else
111
- print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
112
- password = STDIN.gets.chomp
113
- end
114
-
115
- login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
116
- data = [
117
- "login=1",
118
- "form_loginname=#{RUBY_FORGE_USER}",
119
- "form_pw=#{password}"
120
- ].join("&")
121
- http.post("/account/login.php", data)
122
- end
123
-
124
- cookie = login_response["set-cookie"]
125
- raise "Login failed" unless cookie
126
- headers = { "Cookie" => cookie }
127
-
128
- release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
129
- release_data = open(release_uri, headers) { |data| data.read }
130
- package_id = release_data[/[?&]package_id=(\d+)/, 1]
131
- raise "Couldn't get package id" unless package_id
132
-
133
- first_file = true
134
- release_id = ""
135
-
136
- files.each do |filename|
137
- basename = File.basename(filename)
138
- file_ext = File.extname(filename)
139
- file_data = File.open(filename, "rb") { |file| file.read }
140
-
141
- puts "Releasing #{basename}..."
142
-
143
- release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
144
- release_date = Time.now.strftime("%Y-%m-%d %H:%M")
145
- type_map = {
146
- ".zip" => "3000",
147
- ".tgz" => "3110",
148
- ".gz" => "3110",
149
- ".gem" => "1400"
150
- }; type_map.default = "9999"
151
- type = type_map[file_ext]
152
- boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
153
-
154
- query_hash = if first_file then
155
- {
156
- "group_id" => group_id,
157
- "package_id" => package_id,
158
- "release_name" => RELEASE_NAME,
159
- "release_date" => release_date,
160
- "type_id" => type,
161
- "processor_id" => "8000", # Any
162
- "release_notes" => "",
163
- "release_changes" => "",
164
- "preformatted" => "1",
165
- "submit" => "1"
166
- }
167
- else
168
- {
169
- "group_id" => group_id,
170
- "release_id" => release_id,
171
- "package_id" => package_id,
172
- "step2" => "1",
173
- "type_id" => type,
174
- "processor_id" => "8000", # Any
175
- "submit" => "Add This File"
176
- }
177
- end
178
-
179
- query = "?" + query_hash.map do |(name, value)|
180
- [name, URI.encode(value)].join("=")
181
- end.join("&")
182
-
183
- data = [
184
- "--" + boundary,
185
- "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
186
- "Content-Type: application/octet-stream",
187
- "Content-Transfer-Encoding: binary",
188
- "", file_data, ""
189
- ].join("\x0D\x0A")
190
-
191
- release_headers = headers.merge(
192
- "Content-Type" => "multipart/form-data; boundary=#{boundary}"
193
- )
194
-
195
- target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
196
- http.post(target + query, data, release_headers)
197
- end
198
-
199
- if first_file then
200
- release_id = release_response.body[/release_id=(\d+)/, 1]
201
- raise("Couldn't get release id") unless release_id
202
- end
7
+ Hoe.new('Gruff', Gruff::VERSION) do |p|
8
+ p.name = "gruff"
9
+ p.author = "Geoffrey Grosenbach"
10
+ p.description = "Beautiful graphs for one or multiple datasets. Can be used on websites or in documents."
11
+ p.email = 'boss@topfunky.com'
12
+ p.summary = "Beautiful graphs for one or multiple datasets."
13
+ p.url = "http://nubyonrails.com/pages/gruff"
14
+ p.clean_globs = ['test/output/*.png']
203
15
 
204
- first_file = false
205
- end
206
- end
16
+ # * extra_deps - An array of rubygem dependencies.
207
17
  end
208
18
 
209
19
 
20
+ # require 'rake'
21
+ # require 'rake/testtask'
22
+ # require 'rake/rdoctask'
23
+ # require 'rake/packagetask'
24
+ # require 'rake/gempackagetask'
25
+ # require 'rake/contrib/rubyforgepublisher'
26
+ #
27
+ # $:.unshift(File.dirname(__FILE__) + "/lib")
28
+ # require 'gruff'
29
+ #
30
+ # PKG_NAME = 'gruff'
31
+ # PKG_VERSION = Gruff::VERSION
32
+ # PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
33
+ #
34
+ # RELEASE_NAME = "REL #{PKG_VERSION}"
35
+ #
36
+ # RUBY_FORGE_PROJECT = "gruff"
37
+ # RUBY_FORGE_USER = "topfunky"
38
+ #
39
+ # desc "Default Task"
40
+ # task :default => [ :clean, :test ]
41
+ #
42
+ # desc "Clean images generated by tests"
43
+ # task :clean do
44
+ # rm FileList['test/output/*.png']
45
+ # rm_rf 'pkg'
46
+ # rm_rf 'doc'
47
+ # end
48
+ #
49
+ # desc "Copy documentation to topfunky.com"
50
+ # task :rdoc_deploy => [:rdoc] do
51
+ # dirs = %w{doc}
52
+ # onserver = "topfunky@topfunky.com:/home/topfunky/topfunky.com/clients/rails/gruff"
53
+ # dirs.each do | dir|
54
+ # `rsync -avz -e ssh "#{`pwd`.chomp}/#{dir}" "#{onserver}" --exclude ".svn"`
55
+ # end
56
+ # end
57
+ #
58
+ # # Run the unit tests
59
+ # Rake::TestTask.new { |t|
60
+ # t.libs << "test"
61
+ # t.pattern = 'test/*_test.rb'
62
+ # t.verbose = true
63
+ # }
64
+ #
65
+ # # Genereate the RDoc documentation
66
+ # Rake::RDocTask.new { |rdoc|
67
+ # rdoc.rdoc_dir = 'doc'
68
+ # rdoc.title = "Gruff -- Beautiful graphs"
69
+ # # rdoc.options << '--line-numbers --inline-source --main README --accessor adv_attr_accessor=M'
70
+ # rdoc.template = "#{ENV['template']}.rb" if ENV['template']
71
+ # rdoc.rdoc_files.include('README', 'CHANGELOG')
72
+ # rdoc.rdoc_files.include('lib/gruff.rb')
73
+ # rdoc.rdoc_files.include('lib/gruff/*.rb')
74
+ # }
75
+ #
76
+ #
77
+ # # Create compressed packages
78
+ # spec = Gem::Specification.new do |s|
79
+ # s.platform = Gem::Platform::RUBY
80
+ # s.name = PKG_NAME
81
+ # s.summary = "Beautiful graphs for one or multiple datasets."
82
+ # s.description = %q{Make colorful graphs for use on websites or documents.}
83
+ # s.version = PKG_VERSION
84
+ #
85
+ # s.author = "Geoffrey Grosenbach"
86
+ # s.email = "boss@topfunky.com"
87
+ # s.rubyforge_project = RUBY_FORGE_PROJECT
88
+ # s.homepage = "http://www.topfunky.com"
89
+ #
90
+ # s.has_rdoc = true
91
+ # s.requirements << 'none'
92
+ # s.require_path = 'lib'
93
+ # s.autorequire = 'gruff'
94
+ #
95
+ # s.files = [ "Rakefile", "README", "CHANGELOG", "MIT-LICENSE" ]
96
+ # s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
97
+ # s.files = s.files + Dir.glob( "assets/*" ).delete_if { |item| item.include?( "\.svn" ) }
98
+ # s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) || item.include?("\.png") }
99
+ # end
100
+ #
101
+ # Rake::GemPackageTask.new(spec) do |p|
102
+ # p.gem_spec = spec
103
+ # p.need_tar = true
104
+ # p.need_zip = true
105
+ # end
106
+ #
107
+ # desc "Publish the API documentation"
108
+ # task :pgem => [:package] do
109
+ # Rake::SshFilePublisher.new("boss@topfunky.com", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
110
+ # end
111
+ #
112
+ # desc "Publish the release files to RubyForge."
113
+ # task :release => [:package] do
114
+ # files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
115
+ #
116
+ # if RUBY_FORGE_PROJECT then
117
+ # require 'net/http'
118
+ # require 'open-uri'
119
+ #
120
+ # project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
121
+ # project_data = open(project_uri) { |data| data.read }
122
+ # group_id = project_data[/[?&]group_id=(\d+)/, 1]
123
+ # raise "Couldn't get group id" unless group_id
124
+ #
125
+ # # This echos password to shell which is a bit sucky
126
+ # if ENV["RUBY_FORGE_PASSWORD"]
127
+ # password = ENV["RUBY_FORGE_PASSWORD"]
128
+ # else
129
+ # print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
130
+ # password = STDIN.gets.chomp
131
+ # end
132
+ #
133
+ # login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
134
+ # data = [
135
+ # "login=1",
136
+ # "form_loginname=#{RUBY_FORGE_USER}",
137
+ # "form_pw=#{password}"
138
+ # ].join("&")
139
+ # http.post("/account/login.php", data)
140
+ # end
141
+ #
142
+ # cookie = login_response["set-cookie"]
143
+ # raise "Login failed" unless cookie
144
+ # headers = { "Cookie" => cookie }
145
+ #
146
+ # release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
147
+ # release_data = open(release_uri, headers) { |data| data.read }
148
+ # package_id = release_data[/[?&]package_id=(\d+)/, 1]
149
+ # raise "Couldn't get package id" unless package_id
150
+ #
151
+ # first_file = true
152
+ # release_id = ""
153
+ #
154
+ # files.each do |filename|
155
+ # basename = File.basename(filename)
156
+ # file_ext = File.extname(filename)
157
+ # file_data = File.open(filename, "rb") { |file| file.read }
158
+ #
159
+ # puts "Releasing #{basename}..."
160
+ #
161
+ # release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
162
+ # release_date = Time.now.strftime("%Y-%m-%d %H:%M")
163
+ # type_map = {
164
+ # ".zip" => "3000",
165
+ # ".tgz" => "3110",
166
+ # ".gz" => "3110",
167
+ # ".gem" => "1400"
168
+ # }; type_map.default = "9999"
169
+ # type = type_map[file_ext]
170
+ # boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
171
+ #
172
+ # query_hash = if first_file then
173
+ # {
174
+ # "group_id" => group_id,
175
+ # "package_id" => package_id,
176
+ # "release_name" => RELEASE_NAME,
177
+ # "release_date" => release_date,
178
+ # "type_id" => type,
179
+ # "processor_id" => "8000", # Any
180
+ # "release_notes" => "",
181
+ # "release_changes" => "",
182
+ # "preformatted" => "1",
183
+ # "submit" => "1"
184
+ # }
185
+ # else
186
+ # {
187
+ # "group_id" => group_id,
188
+ # "release_id" => release_id,
189
+ # "package_id" => package_id,
190
+ # "step2" => "1",
191
+ # "type_id" => type,
192
+ # "processor_id" => "8000", # Any
193
+ # "submit" => "Add This File"
194
+ # }
195
+ # end
196
+ #
197
+ # query = "?" + query_hash.map do |(name, value)|
198
+ # [name, URI.encode(value)].join("=")
199
+ # end.join("&")
200
+ #
201
+ # data = [
202
+ # "--" + boundary,
203
+ # "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
204
+ # "Content-Type: application/octet-stream",
205
+ # "Content-Transfer-Encoding: binary",
206
+ # "", file_data, ""
207
+ # ].join("\x0D\x0A")
208
+ #
209
+ # release_headers = headers.merge(
210
+ # "Content-Type" => "multipart/form-data; boundary=#{boundary}"
211
+ # )
212
+ #
213
+ # target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
214
+ # http.post(target + query, data, release_headers)
215
+ # end
216
+ #
217
+ # if first_file then
218
+ # release_id = release_response.body[/release_id=(\d+)/, 1]
219
+ # raise("Couldn't get release id") unless release_id
220
+ # end
221
+ #
222
+ # first_file = false
223
+ # end
224
+ # end
225
+ # end
226
+ #
227
+ #