active_olap 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +5 -5
- data/{README.textile → README.rdoc} +26 -18
- data/active_olap.gemspec +9 -6
- data/spec/integration/active_olap_spec.rb +4 -1
- data/spec/spec_helper.rb +1 -2
- data/spec/unit/cube_spec.rb +1 -8
- data/tasks/github-gem.rake +87 -76
- data/test/helper.rb +3 -2
- metadata +5 -5
data/MIT-LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
Copyright (c) 2008 Willem van Bergen
|
2
|
-
|
1
|
+
Copyright (c) 2008 - 2009 Willem van Bergen
|
2
|
+
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
5
5
|
"Software"), to deal in the Software without restriction, including
|
@@ -7,14 +7,14 @@ without limitation the rights to use, copy, modify, merge, publish,
|
|
7
7
|
distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
the following conditions:
|
10
|
-
|
10
|
+
|
11
11
|
The above copyright notice and this permission notice shall be
|
12
12
|
included in all copies or substantial portions of the Software.
|
13
|
-
|
13
|
+
|
14
14
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
17
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,28 +1,27 @@
|
|
1
|
-
|
1
|
+
= Active OLAP
|
2
2
|
|
3
|
-
This Rails plugin makes it easy to add
|
3
|
+
This Rails plugin makes it easy to add a basic OLAP interface to your application, which is
|
4
4
|
great for administration interfaces. Its main uses are collection information about the
|
5
5
|
usage of your application and detecting inconsistencies and problems in your data.
|
6
6
|
|
7
7
|
This plugin provides:
|
8
|
-
* The main functions for OLAP querying: olap_query and olap_drilldown
|
9
|
-
|
8
|
+
* The main functions for OLAP querying: <tt>olap_query</tt> and <tt>olap_drilldown</tt>. These functions
|
9
|
+
must be enabled for your model by calling <tt>enable_active_olap</tt> on your model class.
|
10
10
|
* Functions to easily define dimension, categories and aggregates to use in your
|
11
|
-
|
11
|
+
OLAP queries.
|
12
12
|
|
13
13
|
In the future, the following functionality is planned to be included:
|
14
14
|
* A helper module to generate tables and charts for the query results. The gchartrb gem
|
15
|
-
|
15
|
+
is needed for charts, as they are generated using the Google charts API.
|
16
16
|
* A controller that can be included in your Rails projects to get started quickly.
|
17
17
|
|
18
18
|
More information about the concepts and usage of this plugin, see the Active OLAP Wiki on
|
19
|
-
GitHub: http://github.com/wvanbergen/active_olap
|
19
|
+
GitHub: http://wiki.github.com/wvanbergen/active_olap. I have blogged about this plugin
|
20
20
|
on the Floorplanner tech blog: http://techblog.floorplanner.com/tag/active_olap/. Finally,
|
21
21
|
if you want to get involved or tinker with the code, you can access the repository at
|
22
22
|
http://github.com/wvanbergen/active_olap/tree.
|
23
23
|
|
24
|
-
|
25
|
-
h2. Why use this plugin?
|
24
|
+
== Why use this plugin?
|
26
25
|
|
27
26
|
This plugin simply runs SQL queries using the find-method of ActiveRecord. You might be
|
28
27
|
wondering why you would need a plugin for that.
|
@@ -31,29 +30,38 @@ First of all, it makes your life as a developer easier:
|
|
31
30
|
* This plugin generates the nasty SQL expressions for you using standard compliant SQL,
|
32
31
|
handles issues with SQL NULL values and makes sure the results have a consistent format.
|
33
32
|
* You can define dimensions and aggregates that are "safe to use" or known to yield useful
|
34
|
-
|
35
|
-
|
33
|
+
results. Once dimensions and aggregates are defined, they can be combined at will safely
|
34
|
+
and without any coding effort, so it is suitable for management. :-)
|
35
|
+
|
36
|
+
== Installation
|
37
|
+
|
38
|
+
To install the gem on your system, run:
|
36
39
|
|
40
|
+
gem install active_olap -s http://gemcutter.org
|
37
41
|
|
38
|
-
|
42
|
+
Alternatively, you can include them gem into your Rails project by adding it to
|
43
|
+
the configuration in your <tt>environment.rb</tt> file:
|
39
44
|
|
40
|
-
|
45
|
+
gem.config 'active_olap', :source => 'http://gemcutter.org'
|
46
|
+
|
47
|
+
== Requirements
|
48
|
+
|
49
|
+
This plugin is usable for any ActiveRecord-based model. Because <tt>named_scope</tt> is used for the
|
41
50
|
implementation, Rails 2.1 is required for it to work. It is tested to work with MySQL 5 and
|
42
51
|
SQLite 3 but should work with other databases as well, as it only generates standard
|
43
52
|
compliant SQL queries.
|
44
53
|
|
45
|
-
Warning
|
54
|
+
*Warning:* OLAP queries can be heavy on the database. They can impact the performance of your
|
46
55
|
application if you perform them on the same server or database. Setting good indices is
|
47
56
|
helpful, but it may be a good idea to use a copy of the production database on another
|
48
57
|
server for these heavy queries.
|
49
58
|
|
50
|
-
Another warning
|
59
|
+
*Another warning:* while this plugin makes it easy to perform OLAP queries and play around
|
51
60
|
with it, interpreting the results is hard and mistakes are easily made. At least, make sure
|
52
61
|
to validate the results before they are used for decision making.
|
53
62
|
|
54
|
-
|
55
|
-
h2. About this plugin
|
63
|
+
== About this plugin
|
56
64
|
|
57
65
|
The plugin is written by Willem van Bergen for Floorplanner.com. It is MIT-licensed (see
|
58
66
|
MIT-LICENSE). If you have any questions or want to help out with the development of this plugin,
|
59
|
-
please contact me on
|
67
|
+
please contact me on my github account.
|
data/active_olap.gemspec
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'active_olap'
|
3
|
-
s.version = '0.0.2'
|
4
|
-
s.date = '2008-12-23'
|
5
3
|
|
6
|
-
|
4
|
+
# Do not update version and date by hand: this will be done automatically.
|
5
|
+
s.version = "0.0.3"
|
6
|
+
s.date = "2009-10-10"
|
7
|
+
|
8
|
+
s.summary = "Extend ActiveRecord with OLAP query functionality."
|
7
9
|
s.description = "Extends ActiveRecord with functionality to perform OLAP queries on your data. Includes helper method to ease displaying the results."
|
8
10
|
|
9
11
|
s.authors = ['Willem van Bergen']
|
10
12
|
s.email = ['willem@vanbergen.org']
|
11
|
-
s.homepage = 'http://github.com/wvanbergen/active_olap
|
13
|
+
s.homepage = 'http://wiki.github.com/wvanbergen/active_olap'
|
12
14
|
|
13
|
-
|
15
|
+
# Do not update files and test_files by hand: this will be done automatically.
|
16
|
+
s.files = %w(test/helper_modules_test.rb spec/spec_helper.rb .gitignore lib/active_olap/helpers/table_helper.rb lib/active_olap/dimension.rb test/active_olap_test.rb lib/active_olap/helpers/display_helper.rb init.rb spec/integration/active_olap_spec.rb lib/active_olap/test/assertions.rb lib/active_olap/category.rb active_olap.gemspec Rakefile MIT-LICENSE tasks/github-gem.rake README.rdoc lib/active_olap.rb test/helper.rb lib/active_olap/helpers/form_helper.rb lib/active_olap/aggregate.rb spec/unit/cube_spec.rb lib/active_olap/helpers/chart_helper.rb lib/active_olap/cube.rb lib/active_olap/configurator.rb)
|
14
17
|
s.test_files = %w(test/helper_modules_test.rb test/active_olap_test.rb spec/integration/active_olap_spec.rb spec/unit/cube_spec.rb)
|
15
|
-
end
|
18
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/unit/cube_spec.rb
CHANGED
data/tasks/github-gem.rake
CHANGED
@@ -5,12 +5,12 @@ require 'date'
|
|
5
5
|
require 'git'
|
6
6
|
|
7
7
|
module GithubGem
|
8
|
-
|
8
|
+
|
9
9
|
# Detects the gemspc file of this project using heuristics.
|
10
10
|
def self.detect_gemspec_file
|
11
11
|
FileList['*.gemspec'].first
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
# Detects the main include file of this project using heuristics
|
15
15
|
def self.detect_main_include
|
16
16
|
if detect_gemspec_file =~ /^(\.*)\.gemspec$/ && File.exist?("lib/#{$1}.rb")
|
@@ -18,16 +18,16 @@ module GithubGem
|
|
18
18
|
elsif FileList['lib/*.rb'].length == 1
|
19
19
|
FileList['lib/*.rb'].first
|
20
20
|
else
|
21
|
-
|
21
|
+
nil
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
class RakeTasks
|
26
|
-
|
26
|
+
|
27
27
|
attr_reader :gemspec, :modified_files, :git
|
28
28
|
attr_accessor :gemspec_file, :task_namespace, :main_include, :root_dir, :spec_pattern, :test_pattern, :remote, :remote_branch, :local_branch
|
29
|
-
|
30
|
-
# Initializes the settings, yields itself for configuration
|
29
|
+
|
30
|
+
# Initializes the settings, yields itself for configuration
|
31
31
|
# and defines the rake tasks based on the gemspec file.
|
32
32
|
def initialize(task_namespace = :gem)
|
33
33
|
@gemspec_file = GithubGem.detect_gemspec_file
|
@@ -40,16 +40,16 @@ module GithubGem
|
|
40
40
|
@local_branch = 'master'
|
41
41
|
@remote = 'origin'
|
42
42
|
@remote_branch = 'master'
|
43
|
-
|
43
|
+
|
44
44
|
yield(self) if block_given?
|
45
45
|
|
46
46
|
@git = Git.open(@root_dir)
|
47
47
|
load_gemspec!
|
48
48
|
define_tasks!
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
protected
|
52
|
-
|
52
|
+
|
53
53
|
# Define Unit test tasks
|
54
54
|
def define_test_tasks!
|
55
55
|
require 'rake/testtask'
|
@@ -61,11 +61,11 @@ module GithubGem
|
|
61
61
|
t.libs << 'test'
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
desc "Run all unit tests for #{gemspec.name}"
|
66
66
|
task(:test => ['test:basic'])
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
# Defines RSpec tasks
|
70
70
|
def define_rspec_tasks!
|
71
71
|
require 'spec/rake/spectask'
|
@@ -75,128 +75,128 @@ module GithubGem
|
|
75
75
|
Spec::Rake::SpecTask.new(:basic) do |t|
|
76
76
|
t.spec_files = FileList[spec_pattern]
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
desc "Verify all RSpec examples for #{gemspec.name} and output specdoc"
|
80
80
|
Spec::Rake::SpecTask.new(:specdoc) do |t|
|
81
81
|
t.spec_files = FileList[spec_pattern]
|
82
82
|
t.spec_opts << '--format' << 'specdoc' << '--color'
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
desc "Run RCov on specs for #{gemspec.name}"
|
86
86
|
Spec::Rake::SpecTask.new(:rcov) do |t|
|
87
87
|
t.spec_files = FileList[spec_pattern]
|
88
88
|
t.rcov = true
|
89
|
-
t.rcov_opts = ['--exclude', '"spec/*,gems/*"', '--rails']
|
90
|
-
end
|
89
|
+
t.rcov_opts = ['--exclude', '"spec/*,gems/*"', '--rails']
|
90
|
+
end
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
desc "Verify all RSpec examples for #{gemspec.name} and output specdoc"
|
94
|
-
task(:spec => ['spec:specdoc'])
|
94
|
+
task(:spec => ['spec:specdoc'])
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
# Defines the rake tasks
|
98
98
|
def define_tasks!
|
99
|
-
|
99
|
+
|
100
100
|
define_test_tasks! if has_tests?
|
101
101
|
define_rspec_tasks! if has_specs?
|
102
|
-
|
102
|
+
|
103
103
|
namespace(@task_namespace) do
|
104
104
|
desc "Updates the filelist in the gemspec file"
|
105
|
-
task(:manifest) { manifest_task }
|
106
|
-
|
105
|
+
task(:manifest) { manifest_task }
|
106
|
+
|
107
107
|
desc "Builds the .gem package"
|
108
108
|
task(:build => :manifest) { build_task }
|
109
109
|
|
110
110
|
desc "Sets the version of the gem in the gemspec"
|
111
111
|
task(:set_version => [:check_version, :check_current_branch]) { version_task }
|
112
|
-
task(:check_version => :fetch_origin) { check_version_task }
|
113
|
-
|
112
|
+
task(:check_version => :fetch_origin) { check_version_task }
|
113
|
+
|
114
114
|
task(:fetch_origin) { fetch_origin_task }
|
115
|
-
task(:check_current_branch) { check_current_branch_task }
|
115
|
+
task(:check_current_branch) { check_current_branch_task }
|
116
116
|
task(:check_clean_status) { check_clean_status_task }
|
117
117
|
task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }
|
118
|
-
|
118
|
+
|
119
119
|
checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]
|
120
120
|
checks.unshift('spec:basic') if has_specs?
|
121
121
|
checks.unshift('test:basic') if has_tests?
|
122
122
|
checks.push << [:check_rubyforge] if gemspec.rubyforge_project
|
123
|
-
|
123
|
+
|
124
124
|
desc "Perform all checks that would occur before a release"
|
125
|
-
task(:release_checks => checks)
|
125
|
+
task(:release_checks => checks)
|
126
126
|
|
127
127
|
release_tasks = [:release_checks, :set_version, :build, :github_release]
|
128
128
|
release_tasks << [:rubyforge_release] if gemspec.rubyforge_project
|
129
|
-
|
129
|
+
|
130
130
|
desc "Release a new verison of the gem"
|
131
131
|
task(:release => release_tasks) { release_task }
|
132
|
-
|
132
|
+
|
133
133
|
task(:check_rubyforge) { check_rubyforge_task }
|
134
134
|
task(:rubyforge_release) { rubyforge_release_task }
|
135
135
|
task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }
|
136
136
|
task(:tag_version) { tag_version_task }
|
137
137
|
task(:commit_modified_files) { commit_modified_files_task }
|
138
|
-
|
138
|
+
|
139
139
|
desc "Updates the gem release tasks with the latest version on Github"
|
140
140
|
task(:update_tasks) { update_tasks_task }
|
141
141
|
end
|
142
142
|
end
|
143
|
-
|
143
|
+
|
144
144
|
# Updates the files list and test_files list in the gemspec file using the list of files
|
145
145
|
# in the repository and the spec/test file pattern.
|
146
146
|
def manifest_task
|
147
147
|
# Load all the gem's files using "git ls-files"
|
148
148
|
repository_files = git.ls_files.keys
|
149
149
|
test_files = Dir[test_pattern] + Dir[spec_pattern]
|
150
|
-
|
150
|
+
|
151
151
|
update_gemspec(:files, repository_files)
|
152
152
|
update_gemspec(:test_files, repository_files & test_files)
|
153
153
|
end
|
154
|
-
|
154
|
+
|
155
155
|
# Builds the gem
|
156
156
|
def build_task
|
157
157
|
sh "gem build -q #{gemspec_file}"
|
158
158
|
Dir.mkdir('pkg') unless File.exist?('pkg')
|
159
|
-
sh "mv #{gemspec.name}-#{gemspec.version}.gem pkg/#{gemspec.name}-#{gemspec.version}.gem"
|
159
|
+
sh "mv #{gemspec.name}-#{gemspec.version}.gem pkg/#{gemspec.name}-#{gemspec.version}.gem"
|
160
160
|
end
|
161
|
-
|
161
|
+
|
162
162
|
# Updates the version number in the gemspec file, the VERSION constant in the main
|
163
163
|
# include file and the contents of the VERSION file.
|
164
164
|
def version_task
|
165
165
|
update_gemspec(:version, ENV['VERSION']) if ENV['VERSION']
|
166
166
|
update_gemspec(:date, Date.today)
|
167
|
-
|
167
|
+
|
168
168
|
update_version_file(gemspec.version)
|
169
169
|
update_version_constant(gemspec.version)
|
170
170
|
end
|
171
|
-
|
171
|
+
|
172
172
|
def check_version_task
|
173
173
|
raise "#{ENV['VERSION']} is not a valid version number!" if ENV['VERSION'] && !Gem::Version.correct?(ENV['VERSION'])
|
174
174
|
proposed_version = Gem::Version.new(ENV['VERSION'] || gemspec.version)
|
175
175
|
# Loads the latest version number using the created tags
|
176
|
-
newest_version = git.tags.map { |tag| tag.name.split('-').last }.compact.map { |v| Gem::Version.new(v) }.max
|
176
|
+
newest_version = git.tags.map { |tag| tag.name.split('-').last }.compact.map { |v| Gem::Version.new(v) }.max
|
177
177
|
raise "This version (#{proposed_version}) is not higher than the highest tagged version (#{newest_version})" if newest_version && newest_version >= proposed_version
|
178
178
|
end
|
179
|
-
|
179
|
+
|
180
180
|
# Checks whether the current branch is not diverged from the remote branch
|
181
181
|
def check_not_diverged_task
|
182
|
-
raise "The current branch is diverged from the remote branch!" if git.log.between('HEAD', git.
|
182
|
+
raise "The current branch is diverged from the remote branch!" if git.log.between('HEAD', git.remote(remote).branch(remote_branch).gcommit).any?
|
183
183
|
end
|
184
|
-
|
184
|
+
|
185
185
|
# Checks whether the repository status ic clean
|
186
186
|
def check_clean_status_task
|
187
187
|
raise "The current working copy contains modifications" if git.status.changed.any?
|
188
188
|
end
|
189
|
-
|
189
|
+
|
190
190
|
# Checks whether the current branch is correct
|
191
191
|
def check_current_branch_task
|
192
192
|
raise "Currently not on #{local_branch} branch!" unless git.branch.name == local_branch.to_s
|
193
193
|
end
|
194
|
-
|
194
|
+
|
195
195
|
# Fetches the latest updates from Github
|
196
196
|
def fetch_origin_task
|
197
197
|
git.fetch('origin')
|
198
198
|
end
|
199
|
-
|
199
|
+
|
200
200
|
# Commits every file that has been changed by the release task.
|
201
201
|
def commit_modified_files_task
|
202
202
|
if modified_files.any?
|
@@ -204,30 +204,31 @@ module GithubGem
|
|
204
204
|
git.commit("Released #{gemspec.name} gem version #{gemspec.version}")
|
205
205
|
end
|
206
206
|
end
|
207
|
-
|
207
|
+
|
208
208
|
# Adds a tag for the released version
|
209
209
|
def tag_version_task
|
210
210
|
git.add_tag("#{gemspec.name}-#{gemspec.version}")
|
211
211
|
end
|
212
|
-
|
212
|
+
|
213
213
|
# Pushes the changes and tag to github
|
214
214
|
def github_release_task
|
215
215
|
git.push(remote, remote_branch, true)
|
216
216
|
end
|
217
|
-
|
217
|
+
|
218
218
|
# Checks whether Rubyforge is configured properly
|
219
219
|
def check_rubyforge_task
|
220
|
-
|
220
|
+
# Login no longer necessary when using rubyforge 2.0.0 gem
|
221
|
+
# raise "Could not login on rubyforge!" unless `rubyforge login 2>&1`.strip.empty?
|
221
222
|
output = `rubyforge names`.split("\n")
|
222
223
|
raise "Rubyforge group not found!" unless output.any? { |line| %r[^groups\s*\:.*\b#{Regexp.quote(gemspec.rubyforge_project)}\b.*] =~ line }
|
223
|
-
raise "Rubyforge package not found!" unless output.any? { |line| %r[^packages\s*\:.*\b#{Regexp.quote(gemspec.name)}\b.*] =~ line }
|
224
|
+
raise "Rubyforge package not found!" unless output.any? { |line| %r[^packages\s*\:.*\b#{Regexp.quote(gemspec.name)}\b.*] =~ line }
|
224
225
|
end
|
225
|
-
|
226
|
+
|
226
227
|
# Task to release the .gem file toRubyforge.
|
227
228
|
def rubyforge_release_task
|
228
229
|
sh 'rubyforge', 'add_release', gemspec.rubyforge_project, gemspec.name, gemspec.version.to_s, "pkg/#{gemspec.name}-#{gemspec.version}.gem"
|
229
230
|
end
|
230
|
-
|
231
|
+
|
231
232
|
# Gem release task.
|
232
233
|
# All work is done by the task's dependencies, so just display a release completed message.
|
233
234
|
def release_task
|
@@ -235,78 +236,88 @@ module GithubGem
|
|
235
236
|
puts '------------------------------------------------------------'
|
236
237
|
puts "Released #{gemspec.name} version #{gemspec.version}"
|
237
238
|
end
|
238
|
-
|
239
|
+
|
239
240
|
private
|
240
|
-
|
241
|
+
|
241
242
|
# Checks whether this project has any RSpec files
|
242
243
|
def has_specs?
|
243
244
|
FileList[spec_pattern].any?
|
244
245
|
end
|
245
|
-
|
246
|
+
|
246
247
|
# Checks whether this project has any unit test files
|
247
248
|
def has_tests?
|
248
249
|
FileList[test_pattern].any?
|
249
250
|
end
|
250
|
-
|
251
|
+
|
251
252
|
# Loads the gemspec file
|
252
253
|
def load_gemspec!
|
253
254
|
@gemspec = eval(File.read(@gemspec_file))
|
254
255
|
end
|
255
|
-
|
256
|
+
|
256
257
|
# Updates the VERSION file with the new version
|
257
258
|
def update_version_file(version)
|
258
259
|
if File.exists?('VERSION')
|
259
|
-
File.open('VERSION', 'w') { |f| f << version.to_s }
|
260
|
+
File.open('VERSION', 'w') { |f| f << version.to_s }
|
260
261
|
modified_files << 'VERSION'
|
261
262
|
end
|
262
263
|
end
|
263
|
-
|
264
|
+
|
264
265
|
# Updates the VERSION constant in the main include file if it exists
|
265
266
|
def update_version_constant(version)
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
267
|
+
if main_include && File.exist?(main_include)
|
268
|
+
file_contents = File.read(main_include)
|
269
|
+
if file_contents.sub!(/^(\s+VERSION\s*=\s*)[^\s].*$/) { $1 + version.to_s.inspect }
|
270
|
+
File.open(main_include, 'w') { |f| f << file_contents }
|
271
|
+
modified_files << main_include
|
272
|
+
end
|
273
|
+
end
|
271
274
|
end
|
272
|
-
|
275
|
+
|
273
276
|
# Updates an attribute of the gemspec file.
|
274
277
|
# This function will open the file, and search/replace the attribute using a regular expression.
|
275
278
|
def update_gemspec(attribute, new_value, literal = false)
|
276
|
-
|
279
|
+
|
277
280
|
unless literal
|
278
281
|
new_value = case new_value
|
279
282
|
when Array then "%w(#{new_value.join(' ')})"
|
280
283
|
when Hash, String then new_value.inspect
|
281
|
-
when Date then new_value.strftime('%Y-%m-%d').inspect
|
284
|
+
when Date then new_value.strftime('%Y-%m-%d').inspect
|
282
285
|
else raise "Cannot write value #{new_value.inspect} to gemspec file!"
|
283
286
|
end
|
284
287
|
end
|
285
|
-
|
288
|
+
|
286
289
|
spec = File.read(gemspec_file)
|
287
290
|
regexp = Regexp.new('^(\s+\w+\.' + Regexp.quote(attribute.to_s) + '\s*=\s*)[^\s].*$')
|
288
291
|
if spec.sub!(regexp) { $1 + new_value }
|
289
|
-
File.open(gemspec_file, 'w') { |f| f << spec }
|
292
|
+
File.open(gemspec_file, 'w') { |f| f << spec }
|
290
293
|
modified_files << gemspec_file
|
291
|
-
|
294
|
+
|
292
295
|
# Reload the gemspec so the changes are incorporated
|
293
296
|
load_gemspec!
|
294
297
|
end
|
295
298
|
end
|
296
|
-
|
299
|
+
|
297
300
|
# Updates the tasks file using the latest file found on Github
|
298
301
|
def update_tasks_task
|
299
302
|
require 'net/http'
|
300
|
-
|
303
|
+
|
301
304
|
server = 'github.com'
|
302
305
|
path = '/wvanbergen/github-gem/raw/master/tasks/github-gem.rake'
|
303
|
-
|
306
|
+
|
304
307
|
Net::HTTP.start(server) do |http|
|
305
308
|
response = http.get(path)
|
306
309
|
open(__FILE__, "w") { |file| file.write(response.body) }
|
307
310
|
end
|
308
|
-
|
311
|
+
|
312
|
+
relative_file = File.expand_path(__FILE__).sub(%r[^#{git.dir.path}/], '')
|
313
|
+
if git.status[relative_file] && git.status[relative_file].type == 'M'
|
314
|
+
git.add(relative_file)
|
315
|
+
git.commit("Updated to latest gem release management tasks.")
|
316
|
+
puts "Updated to latest version of gem release management tasks."
|
317
|
+
else
|
318
|
+
puts "Release managament tasks already are at the latest version."
|
319
|
+
end
|
309
320
|
end
|
310
|
-
|
321
|
+
|
311
322
|
end
|
312
323
|
end
|
data/test/helper.rb
CHANGED
@@ -15,8 +15,9 @@ module ActiveOlapTestHelper
|
|
15
15
|
|
16
16
|
def create_db
|
17
17
|
|
18
|
-
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :
|
19
|
-
|
18
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
|
19
|
+
ActiveRecord::Migration.verbose = false
|
20
|
+
|
20
21
|
ActiveRecord::Schema.define(:version => 1) do
|
21
22
|
create_table :olap_tests do |t|
|
22
23
|
t.string :string_field
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_olap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willem van Bergen
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-10-10 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -31,7 +31,6 @@ files:
|
|
31
31
|
- test/active_olap_test.rb
|
32
32
|
- lib/active_olap/helpers/display_helper.rb
|
33
33
|
- init.rb
|
34
|
-
- README.textile
|
35
34
|
- spec/integration/active_olap_spec.rb
|
36
35
|
- lib/active_olap/test/assertions.rb
|
37
36
|
- lib/active_olap/category.rb
|
@@ -39,6 +38,7 @@ files:
|
|
39
38
|
- Rakefile
|
40
39
|
- MIT-LICENSE
|
41
40
|
- tasks/github-gem.rake
|
41
|
+
- README.rdoc
|
42
42
|
- lib/active_olap.rb
|
43
43
|
- test/helper.rb
|
44
44
|
- lib/active_olap/helpers/form_helper.rb
|
@@ -48,7 +48,7 @@ files:
|
|
48
48
|
- lib/active_olap/cube.rb
|
49
49
|
- lib/active_olap/configurator.rb
|
50
50
|
has_rdoc: true
|
51
|
-
homepage: http://github.com/wvanbergen/active_olap
|
51
|
+
homepage: http://wiki.github.com/wvanbergen/active_olap
|
52
52
|
licenses: []
|
53
53
|
|
54
54
|
post_install_message:
|
@@ -74,7 +74,7 @@ rubyforge_project:
|
|
74
74
|
rubygems_version: 1.3.5
|
75
75
|
signing_key:
|
76
76
|
specification_version: 3
|
77
|
-
summary: Extend ActiveRecord with OLAP query functionality
|
77
|
+
summary: Extend ActiveRecord with OLAP query functionality.
|
78
78
|
test_files:
|
79
79
|
- test/helper_modules_test.rb
|
80
80
|
- test/active_olap_test.rb
|