a_la_chart 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +8 -4
- data/Rakefile +64 -19
- data/configs/amc/config.yml +13 -0
- data/configs/amc/v1_6/inline.html.erb +27 -0
- data/configs/amc/v1_6/pie.xml.builder +15 -0
- data/configs/amc/v1_6/remote.html.erb +27 -0
- data/configs/fusion/v3_1/bar.xml.builder +5 -1
- data/configs/fusion/v3_1/column.xml.builder +5 -1
- data/configs/fusion/v3_1/funnel.xml.builder +4 -1
- data/configs/fusion/v3_1/pie.xml.builder +5 -1
- data/configs/fusion/v3_1/pyramid.xml.builder +5 -1
- data/configs/fusion/v3_1/spark_win_loss.xml.builder +4 -1
- data/configs/fusion/v3_1/stacked_column.xml.builder +3 -2
- data/configs/google/config.yml +1 -0
- data/configs/google/v1_0/interactive.html.erb +0 -0
- data/configs/{raphael → graphael}/config.yml +0 -0
- data/configs/{raphael → graphael}/v1_2/dot.html.erb +0 -0
- data/configs/{raphael → graphael}/v1_2/impact.js.erb +0 -0
- data/configs/{raphael → graphael}/v1_2/inline.html.erb +0 -0
- data/lib/a_la_chart/a_la_chart.rb +58 -51
- data/lib/a_la_chart/version.rb +3 -0
- data/lib/a_la_chart.rb +5 -2
- data/test/a_la_chart_test.rb +50 -3
- data/test/test_helper.rb +63 -2
- metadata +35 -27
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
data/Manifest.txt
CHANGED
@@ -20,10 +20,14 @@ configs/fusion/v3_1/stacked_column.xml.builder
|
|
20
20
|
configs/fusion/config.yml
|
21
21
|
configs/google/v1_0/pie.html.erb
|
22
22
|
configs/google/config.yml
|
23
|
-
configs/
|
24
|
-
configs/
|
25
|
-
configs/
|
26
|
-
configs/
|
23
|
+
configs/graphael/v1_2/dot.html.erb
|
24
|
+
configs/graphael/v1_2/impact.js.erb
|
25
|
+
configs/graphael/v1_2/inline.html.erb
|
26
|
+
configs/graphael/config.yml
|
27
|
+
configs/am/v1_6/inline.html.erb
|
28
|
+
configs/am/v1_6/remote.html.erb
|
29
|
+
configs/am/v1_6/pie.xml.builder
|
30
|
+
configs/am/config.yml
|
27
31
|
init.rb
|
28
32
|
lib/a_la_chart.rb
|
29
33
|
lib/a_la_chart/a_la_chart_helper.rb
|
data/Rakefile
CHANGED
@@ -1,25 +1,70 @@
|
|
1
|
-
|
2
|
-
gem 'hoe', '>= 2.1.0'
|
3
|
-
require 'hoe'
|
4
|
-
require 'fileutils'
|
5
|
-
# require './lib/a_la_chart'
|
1
|
+
# encoding: UTF-8
|
6
2
|
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
require 'rake'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rake/rdoctask'
|
6
|
+
require File.join(File.dirname(__FILE__), 'lib', 'a_la_chart', 'version')
|
10
7
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
begin
|
9
|
+
require 'jeweler'
|
10
|
+
Jeweler::Tasks.new do |s|
|
11
|
+
s.name = "a_la_chart"
|
12
|
+
s.version = ALaChart::VERSION.dup
|
13
|
+
s.rubyforge_project = "a_la_chart"
|
14
|
+
s.summary = "a La Chart manages various types of charting implementations - from grabbing the data, to declaring how those values are mapped to the desired type of chart (pie, line, bar, etc)."
|
15
|
+
s.email = "eric.redmond@gmail.com"
|
16
|
+
s.homepage = "http://github.com/coderoshi/a_la_chart"
|
17
|
+
s.description = "A framework for managing various types of charting implementations."
|
18
|
+
s.authors = ['Eric Redmond']
|
19
|
+
s.files = FileList["[A-Z]*", "init.rb", "{lib}/**/*", "configs/**/*"]
|
20
|
+
s.add_dependency("responders", "~> 0.6.0")
|
21
|
+
s.add_dependency("has_scope", "~> 0.5.0")
|
22
|
+
end
|
17
23
|
|
24
|
+
Jeweler::GemcutterTasks.new
|
25
|
+
rescue LoadError
|
26
|
+
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install jeweler"
|
27
|
+
end
|
28
|
+
|
29
|
+
desc 'Run tests for ALaChart.'
|
30
|
+
Rake::TestTask.new(:test) do |t|
|
31
|
+
t.pattern = 'test/**/*_test.rb'
|
32
|
+
t.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Generate documentation for ALaChart.'
|
36
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
37
|
+
rdoc.rdoc_dir = 'rdoc'
|
38
|
+
rdoc.title = 'ALaChart'
|
39
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
40
|
+
rdoc.rdoc_files.include('README.rdoc')
|
41
|
+
rdoc.rdoc_files.include('MIT-LICENSE')
|
42
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
18
43
|
end
|
19
44
|
|
20
|
-
require 'newgem/tasks'
|
21
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
22
45
|
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
46
|
+
# require 'rubygems'
|
47
|
+
# gem 'hoe', '>= 2.1.0'
|
48
|
+
# require 'hoe'
|
49
|
+
# require 'fileutils'
|
50
|
+
# # require './lib/a_la_chart'
|
51
|
+
#
|
52
|
+
# Hoe.plugin :newgem
|
53
|
+
# # Hoe.plugin :website
|
54
|
+
# # Hoe.plugin :cucumberfeatures
|
55
|
+
#
|
56
|
+
# # Generate all the Rake tasks
|
57
|
+
# # Run 'rake -T' to see list of generated tasks (from gem root directory)
|
58
|
+
# $hoe = Hoe.spec 'a_la_chart' do
|
59
|
+
# self.developer 'Eric Redmond', 'eric.redmond@gmail.com'
|
60
|
+
# self.rubyforge_name = self.name # TODO this is default value
|
61
|
+
# # self.extra_deps = [['activesupport','>= 2.0.2']]
|
62
|
+
#
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# # require 'newgem/tasks'
|
66
|
+
# # Dir['tasks/**/*.rake'].each { |t| load t }
|
67
|
+
#
|
68
|
+
# # TODO - want other tests/tasks run by default? Add them to the list
|
69
|
+
# # remove_task :default
|
70
|
+
# # task :default => [:spec, :features]
|
@@ -0,0 +1,13 @@
|
|
1
|
+
default: v1_6
|
2
|
+
theme: :none
|
3
|
+
themes:
|
4
|
+
none: {}
|
5
|
+
v1_6:
|
6
|
+
format: xml
|
7
|
+
pie:
|
8
|
+
data: 'pie.xml.builder'
|
9
|
+
chart_file: 'ampie/ampie.swf'
|
10
|
+
chart_type: 'ampie'
|
11
|
+
chart_settings: 'ampie/ampie_settings.xml'
|
12
|
+
remote: 'remote.html.erb'
|
13
|
+
inline: 'inline.html.erb'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%
|
2
|
+
require 'builder'
|
3
|
+
chart_type = chart_type_config[:chart_type]
|
4
|
+
chart_type = chart_style.to_s if chart_type.blank?
|
5
|
+
|
6
|
+
chart_type = args[:vertical] ? chart_type_config[:vertical] || chart_type : chart_type
|
7
|
+
chart_type = args[:dimensions] == 3 ? chart_type_config[:d3] || chart_type : chart_type
|
8
|
+
|
9
|
+
set_chart(chart_style)
|
10
|
+
|
11
|
+
# TODO: create a seperate 'params' override
|
12
|
+
params[:case] = args[:case]
|
13
|
+
params[:title] = args[:title]
|
14
|
+
%>
|
15
|
+
<div>
|
16
|
+
<fusioncharts chartId="<%= div_id %>"
|
17
|
+
chartType="<%= chart_type %>"
|
18
|
+
swfPath="/FusionCharts/"
|
19
|
+
width="<%= width %>"
|
20
|
+
height="<%= height %>"
|
21
|
+
registerWithJS="1"
|
22
|
+
debugMode="0">
|
23
|
+
<data><!--[CDATA[
|
24
|
+
<%= render :file => data_template %>
|
25
|
+
]]--></data>
|
26
|
+
</fusioncharts>
|
27
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
opts = chart_options(:amc, :pie)
|
2
|
+
xml.pie do
|
3
|
+
the_case = params[:case]
|
4
|
+
data(the_case).each do |record|
|
5
|
+
xml.slice(value(record, :value, the_case), :title => value(record, :label, the_case),
|
6
|
+
:url => value(record, :link, the_case),
|
7
|
+
:description => value(record, :description, the_case),
|
8
|
+
:color => color_palette_next(:amc, :pie),
|
9
|
+
:pattern => opts[:pattern],
|
10
|
+
:pattern_color => opts[:pattern_color],
|
11
|
+
:alpha => opts[:alpha],
|
12
|
+
:pull_out => value(record, :pull_out, the_case),
|
13
|
+
:label_radius => value(record, :label_radius, the_case))
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%
|
2
|
+
chart_type = chart_type_config[:chart_type]
|
3
|
+
chart_type = chart_style.to_s if chart_type.blank?
|
4
|
+
chart_file = chart_type_config[:chart_file]
|
5
|
+
chart_settings = chart_type_config[:chart_settings]
|
6
|
+
|
7
|
+
# chart_type = args[:vertical] ? chart_type_config[:vertical] || chart_type : chart_type
|
8
|
+
# chart_type = args[:dimensions] == 3 ? chart_type_config[:d3] || chart_type : chart_type
|
9
|
+
%>
|
10
|
+
<div id="<%= div_id %>">
|
11
|
+
<strong>You need to upgrade your Flash Player</strong>
|
12
|
+
</div>
|
13
|
+
<script type="text/javascript">
|
14
|
+
// <![CDATA[
|
15
|
+
var so = new SWFObject("/<%= chart_file %>", "<%= chart_type %>", "<%= width %>", "<%= height %>", "8", "#FFFFFF");
|
16
|
+
so.addVariable("path", "/<%= chart_type %>/");
|
17
|
+
so.addVariable("settings_file", escape("/<%= chart_settings %>")); // you can set two or more different settings files here (separated by commas)
|
18
|
+
so.addVariable("data_file", escape("<%= url %>"));
|
19
|
+
// so.addVariable("chart_data", ""); // you can pass chart data as a string directly from this file
|
20
|
+
// so.addVariable("chart_settings", ""); // you can pass chart settings as a string directly from this file
|
21
|
+
// so.addVariable("additional_chart_settings", ""); // you can append some chart settings to the loaded ones
|
22
|
+
// so.addVariable("loading_settings", "LOADING SETTINGS"); // you can set custom "loading settings" text here
|
23
|
+
// so.addVariable("loading_data", "LOADING DATA"); // you can set custom "loading data" text here
|
24
|
+
so.addVariable("preloader_color", "#999999");
|
25
|
+
so.write("<%= div_id %>");
|
26
|
+
// ]]>
|
27
|
+
</script>
|
@@ -1,6 +1,10 @@
|
|
1
1
|
xml.chart(chart_options(:fusion, :bar).merge(:caption => params[:title])) do
|
2
2
|
the_case = params[:case]
|
3
3
|
data(the_case).each do |record|
|
4
|
-
xml.set
|
4
|
+
xml.set(:value => value(record, :value, the_case),
|
5
|
+
:label => value(record, :label, the_case),
|
6
|
+
:link => value(record, :link, the_case),
|
7
|
+
:toolText => value(record, :tooltip, the_case),
|
8
|
+
:color => color_palette_next(:fusion, :bar))
|
5
9
|
end
|
6
10
|
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
xml.chart(chart_options(:fusion, :bar).merge(:caption => params[:title])) do
|
2
2
|
the_case = params[:case]
|
3
3
|
data(the_case).each do |record|
|
4
|
-
xml.set
|
4
|
+
xml.set(:value => value(record, :value, the_case),
|
5
|
+
:label => value(record, :label, the_case),
|
6
|
+
:link => value(record, :link, the_case),
|
7
|
+
:toolText => value(record, :tooltip, the_case),
|
8
|
+
:color => color_palette_next(:fusion, :column))
|
5
9
|
end
|
6
10
|
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
xml.chart(chart_options(:fusion, :funnel).merge(:caption => params[:title])) do
|
2
2
|
the_case = params[:case]
|
3
3
|
data(the_case).each do |record|
|
4
|
-
xml.set
|
4
|
+
xml.set(:value => value(record, :value, the_case),
|
5
|
+
:label => value(record, :label, the_case),
|
6
|
+
:link => value(record, :link, the_case),
|
7
|
+
:color => color_palette_next(:fusion, :funnel))
|
5
8
|
end
|
6
9
|
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
xml.chart(chart_options(:fusion, :pie).merge(:caption => params[:title])) do
|
2
2
|
the_case = params[:case]
|
3
3
|
data(the_case).each do |record|
|
4
|
-
xml.set
|
4
|
+
xml.set(:value => value(record, :value, the_case),
|
5
|
+
:label => value(record, :label, the_case),
|
6
|
+
:link => value(record, :link, the_case),
|
7
|
+
:toolText => value(record, :tooltip, the_case),
|
8
|
+
:color => color_palette_next(:fusion, :pie))
|
5
9
|
end
|
6
10
|
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
xml.chart(chart_options(:fusion, :pyramid).merge(:caption => params[:title])) do
|
2
2
|
the_case = params[:case]
|
3
3
|
data(the_case).each do |record|
|
4
|
-
xml.set
|
4
|
+
xml.set(:value => value(record, :value, the_case),
|
5
|
+
:label => value(record, :label, the_case),
|
6
|
+
:link => value(record, :link, the_case),
|
7
|
+
:toolText => value(record, :tooltip, the_case),
|
8
|
+
:color => color_palette_next(:fusion, :pyramid))
|
5
9
|
end
|
6
10
|
end
|
@@ -2,7 +2,10 @@ xml.chart(chart_options(:fusion, :spark_win_loss).merge(:caption => params[:titl
|
|
2
2
|
the_case = params[:case]
|
3
3
|
xml.dataset do
|
4
4
|
data(the_case).each do |record|
|
5
|
-
xml.set
|
5
|
+
xml.set(:value => value(record, :value, the_case),
|
6
|
+
:label => value(record, :label, the_case),
|
7
|
+
:scoreless => value(record, :scoreless, the_case),
|
8
|
+
:color => color_palette_next(:fusion, :spark_win_loss))
|
6
9
|
end
|
7
10
|
end
|
8
11
|
end
|
@@ -9,10 +9,11 @@ xml.chart(chart_options(:fusion, :stacked_column).merge(:caption => params[:titl
|
|
9
9
|
data(the_case).each do |record|
|
10
10
|
(data_by_category[value(record, :category, the_case)] ||= []) << record
|
11
11
|
end
|
12
|
-
data_by_category.each do |category
|
12
|
+
data_by_category.keys.sort.each do |category|
|
13
|
+
records = data_by_category[category]
|
13
14
|
xml.dataset(:seriesName => category, :color => value(records.first, :color, the_case) || color_palette_next(:fusion, :stacked_column)) do
|
14
15
|
records.each do |record|
|
15
|
-
xml.set :value => value(record, :value, the_case)
|
16
|
+
xml.set :value => value(record, :value, the_case), :toolText => "#{value(record, :category, the_case)}: #{'%0.2f' % value(record, :value, the_case)}"
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
data/configs/google/config.yml
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -28,6 +28,7 @@ module ALaChart
|
|
28
28
|
return '' if key_field.blank?
|
29
29
|
|
30
30
|
if key_field.class == Proc
|
31
|
+
# TODO: How to do this in the context of the controller?
|
31
32
|
val = key_field.call(object)
|
32
33
|
elsif key_field.class == Fixnum
|
33
34
|
val = object[key_field] if object.respond_to?('[]')
|
@@ -101,10 +102,13 @@ module ALaChart
|
|
101
102
|
self.before_filter(:provide_chart_data, :only => [:index, :show])
|
102
103
|
|
103
104
|
# TODO: Namespace this stuff??
|
104
|
-
|
105
|
+
# :meta,
|
106
|
+
[:before, :data, :value, :set_chart].each do |method|
|
107
|
+
# TODO: swap this in Rails 3 and find a way to attach to helper
|
108
|
+
# module_eval <<-end_eval
|
105
109
|
master_helper_module.module_eval <<-end_eval
|
106
|
-
def #{method}(*args, &block) # def
|
107
|
-
controller.send(%(#{method}), *args, &block) # controller.send(%(
|
110
|
+
def #{method}(*args, &block) # def data(*args, &block)
|
111
|
+
controller.send(%(#{method}), *args, &block) # controller.send(%(data), *args, &block)
|
108
112
|
end # end
|
109
113
|
end_eval
|
110
114
|
end
|
@@ -119,24 +123,27 @@ module ALaChart
|
|
119
123
|
end
|
120
124
|
|
121
125
|
def data(*attrs, &block)
|
122
|
-
|
123
|
-
|
124
|
-
if attrs.class == Hash
|
125
|
-
options = attrs
|
126
|
-
elsif attrs.class == Symbol || attrs.class == String
|
127
|
-
cases = [attrs]
|
128
|
-
end
|
129
|
-
elsif attrs.size > 1
|
130
|
-
if attrs[-1].class == Hash
|
131
|
-
cases = attrs[0...-1]
|
132
|
-
options = attrs[-1]
|
133
|
-
else
|
134
|
-
cases = attrs[0..-1]
|
135
|
-
end
|
136
|
-
end
|
126
|
+
options = Hash === attrs.last ? attrs.pop : {}
|
127
|
+
cases = attrs
|
137
128
|
|
138
|
-
|
139
|
-
|
129
|
+
# if attrs.size == 1
|
130
|
+
# attrs = attrs[0]
|
131
|
+
# if attrs.class == Hash
|
132
|
+
# options = attrs
|
133
|
+
# elsif attrs.class == Symbol || attrs.class == String
|
134
|
+
# cases = [attrs]
|
135
|
+
# end
|
136
|
+
# elsif attrs.size > 1
|
137
|
+
# if attrs[-1].class == Hash
|
138
|
+
# cases = attrs[0...-1]
|
139
|
+
# options = attrs[-1]
|
140
|
+
# else
|
141
|
+
# cases = attrs[0..-1]
|
142
|
+
# end
|
143
|
+
# end
|
144
|
+
#
|
145
|
+
# cases ||= []
|
146
|
+
# options ||= {}
|
140
147
|
|
141
148
|
if cases.blank?
|
142
149
|
define_method("get_data") do
|
@@ -187,36 +194,36 @@ module ALaChart
|
|
187
194
|
end
|
188
195
|
end
|
189
196
|
|
190
|
-
def meta(*attrs)
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
end
|
197
|
+
# def meta(*attrs)
|
198
|
+
# if attrs.size == 1
|
199
|
+
# attrs = attrs[0]
|
200
|
+
# if attrs.class == Array
|
201
|
+
# descriptions = attrs
|
202
|
+
# elsif attrs.class == Hash
|
203
|
+
# options = attrs
|
204
|
+
# elsif attrs.class == Symbol || attrs.class == String
|
205
|
+
# descriptions = [attrs]
|
206
|
+
# end
|
207
|
+
# elsif attrs.size == 2
|
208
|
+
# descriptions = attrs[0]
|
209
|
+
# if descriptions.class == Symbol || descriptions.class == String
|
210
|
+
# descriptions = [descriptions]
|
211
|
+
# end
|
212
|
+
# options = attrs[1]
|
213
|
+
# elsif attrs.size > 2
|
214
|
+
# descriptions = attrs[0...-1]
|
215
|
+
# options = attrs[-1]
|
216
|
+
# end
|
217
|
+
#
|
218
|
+
# descriptions ||= []
|
219
|
+
# options ||= {}
|
220
|
+
#
|
221
|
+
# # descriptions = descriptions.map{|d| d.to_sym }
|
222
|
+
#
|
223
|
+
# define_method("get_meta") do
|
224
|
+
# # descriptions
|
225
|
+
# options
|
226
|
+
# end
|
227
|
+
# end
|
221
228
|
end
|
222
229
|
end
|
data/lib/a_la_chart.rb
CHANGED
data/test/a_la_chart_test.rb
CHANGED
@@ -1,8 +1,55 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
4
|
-
|
3
|
+
class Person
|
4
|
+
extend ActiveModel::Naming
|
5
|
+
end
|
6
|
+
|
7
|
+
class PeopleController < ActionController::Base
|
8
|
+
a_la_chart
|
9
|
+
|
10
|
+
chart :pie do
|
11
|
+
data(:label => :city, :value => :total) do
|
12
|
+
# Person.all(:select => 'city, COUNT(people.*) as total', :group => 'city')
|
13
|
+
[
|
14
|
+
Person.new(:city => 'Vegas', :total => 5),
|
15
|
+
Person.new(:city => 'Baltimore', :total => 8),
|
16
|
+
Person.new(:city => 'Indianapolis', :total => 6)
|
17
|
+
]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def index
|
22
|
+
|
23
|
+
end
|
24
|
+
# respond_to :html, :xml
|
25
|
+
# respond_to :js, :only => [:create, :update, :destroy]
|
26
|
+
# attr_reader :scopes_applied
|
27
|
+
#
|
28
|
+
# protected
|
29
|
+
#
|
30
|
+
# def apply_scopes(object)
|
31
|
+
# @scopes_applied = true
|
32
|
+
# object
|
33
|
+
# end
|
34
|
+
end
|
35
|
+
|
36
|
+
class BasicTest < ActionController::TestCase
|
37
|
+
def setup
|
38
|
+
@controller = PeopleController.new
|
39
|
+
@controller.request = @request = ActionController::TestRequest.new
|
40
|
+
# def @request.to_query; {}; end
|
41
|
+
@controller.response = @response = ActionController::TestResponse.new
|
42
|
+
@controller.stubs(:people_url).returns("/")
|
43
|
+
end
|
44
|
+
|
5
45
|
test "the truth" do
|
6
|
-
|
46
|
+
get :index
|
47
|
+
# assert true
|
7
48
|
end
|
8
49
|
end
|
50
|
+
# class ALaChartTest < ActiveSupport::TestCase
|
51
|
+
# # Replace this with your real tests.
|
52
|
+
# test "the truth" do
|
53
|
+
# assert true
|
54
|
+
# end
|
55
|
+
# end
|
data/test/test_helper.rb
CHANGED
@@ -1,3 +1,64 @@
|
|
1
|
-
require 'stringio'
|
1
|
+
# require 'stringio'
|
2
|
+
# require 'test/unit'
|
3
|
+
# require File.dirname(__FILE__) + '/../lib/a_la_chart'
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
|
7
|
+
gem 'responders', '0.6.0'
|
8
|
+
gem 'activesupport', '3.0.0.beta2'
|
9
|
+
gem 'activemodel', '3.0.0.beta2'
|
10
|
+
gem 'actionpack', '3.0.0.beta2'
|
11
|
+
gem 'railties', '3.0.0.beta2'
|
12
|
+
|
13
|
+
begin
|
14
|
+
gem "test-unit"
|
15
|
+
rescue LoadError
|
16
|
+
end
|
17
|
+
|
18
|
+
begin
|
19
|
+
gem "ruby-debug"
|
20
|
+
require 'ruby-debug'
|
21
|
+
rescue LoadError
|
22
|
+
end
|
23
|
+
|
2
24
|
require 'test/unit'
|
3
|
-
require
|
25
|
+
require 'mocha'
|
26
|
+
|
27
|
+
ENV["RAILS_ENV"] = "test"
|
28
|
+
RAILS_ROOT = "anywhere"
|
29
|
+
|
30
|
+
require "active_support"
|
31
|
+
require "active_model"
|
32
|
+
|
33
|
+
require "action_controller"
|
34
|
+
require "action_dispatch/middleware/flash"
|
35
|
+
|
36
|
+
require "rails/railtie"
|
37
|
+
|
38
|
+
I18n.load_path << File.join(File.dirname(__FILE__), 'locales', 'en.yml')
|
39
|
+
I18n.reload!
|
40
|
+
|
41
|
+
class ApplicationController < ActionController::Base; end
|
42
|
+
|
43
|
+
# Add IR to load path and load the main file
|
44
|
+
ActiveSupport::Dependencies.load_paths << File.expand_path(File.dirname(__FILE__) + '/../lib')
|
45
|
+
# require_dependency 'inherited_resources'
|
46
|
+
require_dependency 'a_la_chart'
|
47
|
+
# require File.dirname(__FILE__) + '/../lib/a_la_chart'
|
48
|
+
|
49
|
+
|
50
|
+
ActionController::Base.view_paths = File.join(File.dirname(__FILE__), 'views')
|
51
|
+
|
52
|
+
ALaChart::Routes = ActionDispatch::Routing::RouteSet.new
|
53
|
+
ALaChart::Routes.draw do |map|
|
54
|
+
map.connect ':controller/:action/:id'
|
55
|
+
map.connect ':controller/:action'
|
56
|
+
end
|
57
|
+
|
58
|
+
ActionController::Base.send :include, ALaChart::Routes.url_helpers
|
59
|
+
|
60
|
+
class ActiveSupport::TestCase
|
61
|
+
setup do
|
62
|
+
@routes = ALaChart::Routes
|
63
|
+
end
|
64
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: a_la_chart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Redmond
|
@@ -9,35 +9,48 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-06-28 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
type: :
|
16
|
+
name: responders
|
17
|
+
type: :runtime
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- -
|
21
|
+
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 0.6.0
|
24
24
|
version:
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: has_scope
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.5.0
|
34
|
+
version:
|
35
|
+
description: A framework for managing various types of charting implementations.
|
36
|
+
email: eric.redmond@gmail.com
|
28
37
|
executables: []
|
29
38
|
|
30
39
|
extensions: []
|
31
40
|
|
32
41
|
extra_rdoc_files:
|
33
|
-
-
|
34
|
-
- Manifest.txt
|
42
|
+
- README.rdoc
|
35
43
|
files:
|
36
44
|
- History.txt
|
37
45
|
- MIT-LICENSE
|
38
46
|
- Manifest.txt
|
39
47
|
- README.rdoc
|
40
48
|
- Rakefile
|
49
|
+
- configs/amc/config.yml
|
50
|
+
- configs/amc/v1_6/inline.html.erb
|
51
|
+
- configs/amc/v1_6/pie.xml.builder
|
52
|
+
- configs/amc/v1_6/remote.html.erb
|
53
|
+
- configs/fusion/config.yml
|
41
54
|
- configs/fusion/v3_1/angular.xml.builder
|
42
55
|
- configs/fusion/v3_1/bar.xml.builder
|
43
56
|
- configs/fusion/v3_1/bullet.xml.builder
|
@@ -52,32 +65,26 @@ files:
|
|
52
65
|
- configs/fusion/v3_1/spark_line.xml.builder
|
53
66
|
- configs/fusion/v3_1/spark_win_loss.xml.builder
|
54
67
|
- configs/fusion/v3_1/stacked_column.xml.builder
|
55
|
-
- configs/fusion/config.yml
|
56
|
-
- configs/google/v1_0/pie.html.erb
|
57
68
|
- configs/google/config.yml
|
58
|
-
- configs/
|
59
|
-
- configs/
|
60
|
-
- configs/
|
61
|
-
- configs/
|
69
|
+
- configs/google/v1_0/interactive.html.erb
|
70
|
+
- configs/google/v1_0/pie.html.erb
|
71
|
+
- configs/graphael/config.yml
|
72
|
+
- configs/graphael/v1_2/dot.html.erb
|
73
|
+
- configs/graphael/v1_2/impact.js.erb
|
74
|
+
- configs/graphael/v1_2/inline.html.erb
|
62
75
|
- init.rb
|
63
76
|
- lib/a_la_chart.rb
|
64
|
-
- lib/a_la_chart/a_la_chart_helper.rb
|
65
77
|
- lib/a_la_chart/a_la_chart.rb
|
78
|
+
- lib/a_la_chart/a_la_chart_helper.rb
|
66
79
|
- lib/a_la_chart/config.rb
|
67
|
-
-
|
68
|
-
- script/destroy
|
69
|
-
- script/generate
|
70
|
-
- test/a_la_chart_test.rb
|
71
|
-
- test/test_a_la_chart.rb
|
72
|
-
- test/test_helper.rb
|
80
|
+
- lib/a_la_chart/version.rb
|
73
81
|
has_rdoc: true
|
74
82
|
homepage: http://github.com/coderoshi/a_la_chart
|
75
83
|
licenses: []
|
76
84
|
|
77
85
|
post_install_message:
|
78
86
|
rdoc_options:
|
79
|
-
- --
|
80
|
-
- README.rdoc
|
87
|
+
- --charset=UTF-8
|
81
88
|
require_paths:
|
82
89
|
- lib
|
83
90
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -98,7 +105,8 @@ rubyforge_project: a_la_chart
|
|
98
105
|
rubygems_version: 1.3.5
|
99
106
|
signing_key:
|
100
107
|
specification_version: 3
|
101
|
-
summary:
|
108
|
+
summary: a La Chart manages various types of charting implementations - from grabbing the data, to declaring how those values are mapped to the desired type of chart (pie, line, bar, etc).
|
102
109
|
test_files:
|
110
|
+
- test/a_la_chart_test.rb
|
103
111
|
- test/test_a_la_chart.rb
|
104
112
|
- test/test_helper.rb
|
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# File: script/console
|
3
|
-
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
-
|
5
|
-
libs = " -r irb/completion"
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/a_la_chart.rb'}"
|
9
|
-
puts "Loading a_la_chart gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|