acts_as_word_cloud 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/.document +5 -0
- data/.gitignore_new +7 -0
- data/.rspec +1 -0
- data/CHANGELOG +3 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +130 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +122 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/acts_as_word_cloud.gemspec +127 -0
- data/features/acts_as_word_cloud.feature +9 -0
- data/features/step_definitions/acts_as_word_cloud_steps.rb +0 -0
- data/features/support/env.rb +13 -0
- data/lib/acts_as_word_cloud/config.rb +31 -0
- data/lib/acts_as_word_cloud/engine.rb +4 -0
- data/lib/acts_as_word_cloud/railtie.rb +12 -0
- data/lib/acts_as_word_cloud/word_cloud.rb +227 -0
- data/lib/acts_as_word_cloud.rb +2 -0
- data/lib/generators/acts_as_word_cloud/install_generator.rb +23 -0
- data/lib/generators/acts_as_word_cloud/templates/config.rb +7 -0
- data/lib/model_methods_helper.rb +87 -0
- data/spec/acts_as_word_cloud_spec.rb +109 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/article.rb +9 -0
- data/spec/dummy/app/models/author.rb +7 -0
- data/spec/dummy/app/models/following.rb +5 -0
- data/spec/dummy/app/models/publisher.rb +7 -0
- data/spec/dummy/app/models/reader.rb +7 -0
- data/spec/dummy/app/models/site.rb +8 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +65 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20121107162154_create_system.rb +64 -0
- data/spec/dummy/db/schema.rb +81 -0
- data/spec/dummy/features/support/blueprints.rb +57 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/lib/model_methods_helper.rb +87 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/spec_helper.rb +21 -0
- metadata +211 -0
data/.DS_Store
ADDED
Binary file
|
data/.document
ADDED
data/.gitignore_new
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/CHANGELOG
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
gem "rails", "~> 3.1.0"
|
6
|
+
|
7
|
+
# Add dependencies to develop your gem here.
|
8
|
+
# Include everything needed to run rake, tests, features, etc.
|
9
|
+
group :development do
|
10
|
+
gem "sqlite3"
|
11
|
+
gem "rspec", "~> 2.8.0"
|
12
|
+
gem "rdoc", "~> 3.12"
|
13
|
+
gem "cucumber", ">= 0"
|
14
|
+
gem "bundler", "~> 1.2.3"
|
15
|
+
gem "jeweler", "~> 1.8.4"
|
16
|
+
gem "debugger"
|
17
|
+
end
|
18
|
+
|
19
|
+
group :test do
|
20
|
+
gem "machinist", "= 1.0.6"
|
21
|
+
gem "faker", "~>1.0.1"
|
22
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (3.1.10)
|
5
|
+
actionpack (= 3.1.10)
|
6
|
+
mail (~> 2.3.3)
|
7
|
+
actionpack (3.1.10)
|
8
|
+
activemodel (= 3.1.10)
|
9
|
+
activesupport (= 3.1.10)
|
10
|
+
builder (~> 3.0.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
i18n (~> 0.6)
|
13
|
+
rack (~> 1.3.6)
|
14
|
+
rack-cache (~> 1.2)
|
15
|
+
rack-mount (~> 0.8.2)
|
16
|
+
rack-test (~> 0.6.1)
|
17
|
+
sprockets (~> 2.0.4)
|
18
|
+
activemodel (3.1.10)
|
19
|
+
activesupport (= 3.1.10)
|
20
|
+
builder (~> 3.0.0)
|
21
|
+
i18n (~> 0.6)
|
22
|
+
activerecord (3.1.10)
|
23
|
+
activemodel (= 3.1.10)
|
24
|
+
activesupport (= 3.1.10)
|
25
|
+
arel (~> 2.2.3)
|
26
|
+
tzinfo (~> 0.3.29)
|
27
|
+
activeresource (3.1.10)
|
28
|
+
activemodel (= 3.1.10)
|
29
|
+
activesupport (= 3.1.10)
|
30
|
+
activesupport (3.1.10)
|
31
|
+
multi_json (>= 1.0, < 1.3)
|
32
|
+
arel (2.2.3)
|
33
|
+
builder (3.0.4)
|
34
|
+
columnize (0.3.6)
|
35
|
+
cucumber (1.2.1)
|
36
|
+
builder (>= 2.1.2)
|
37
|
+
diff-lcs (>= 1.1.3)
|
38
|
+
gherkin (~> 2.11.0)
|
39
|
+
json (>= 1.4.6)
|
40
|
+
debugger (1.2.1)
|
41
|
+
columnize (>= 0.3.1)
|
42
|
+
debugger-linecache (~> 1.1.1)
|
43
|
+
debugger-ruby_core_source (~> 1.1.4)
|
44
|
+
debugger-linecache (1.1.2)
|
45
|
+
debugger-ruby_core_source (>= 1.1.1)
|
46
|
+
debugger-ruby_core_source (1.1.4)
|
47
|
+
diff-lcs (1.1.3)
|
48
|
+
erubis (2.7.0)
|
49
|
+
faker (1.0.1)
|
50
|
+
i18n (~> 0.4)
|
51
|
+
gherkin (2.11.5)
|
52
|
+
json (>= 1.4.6)
|
53
|
+
git (1.2.5)
|
54
|
+
hike (1.2.1)
|
55
|
+
i18n (0.6.1)
|
56
|
+
jeweler (1.8.4)
|
57
|
+
bundler (~> 1.0)
|
58
|
+
git (>= 1.2.5)
|
59
|
+
rake
|
60
|
+
rdoc
|
61
|
+
json (1.7.5)
|
62
|
+
machinist (1.0.6)
|
63
|
+
mail (2.3.3)
|
64
|
+
i18n (>= 0.4.0)
|
65
|
+
mime-types (~> 1.16)
|
66
|
+
treetop (~> 1.4.8)
|
67
|
+
mime-types (1.19)
|
68
|
+
multi_json (1.2.0)
|
69
|
+
polyglot (0.3.3)
|
70
|
+
rack (1.3.9)
|
71
|
+
rack-cache (1.2)
|
72
|
+
rack (>= 0.4)
|
73
|
+
rack-mount (0.8.3)
|
74
|
+
rack (>= 1.0.0)
|
75
|
+
rack-ssl (1.3.2)
|
76
|
+
rack
|
77
|
+
rack-test (0.6.2)
|
78
|
+
rack (>= 1.0)
|
79
|
+
rails (3.1.10)
|
80
|
+
actionmailer (= 3.1.10)
|
81
|
+
actionpack (= 3.1.10)
|
82
|
+
activerecord (= 3.1.10)
|
83
|
+
activeresource (= 3.1.10)
|
84
|
+
activesupport (= 3.1.10)
|
85
|
+
bundler (~> 1.0)
|
86
|
+
railties (= 3.1.10)
|
87
|
+
railties (3.1.10)
|
88
|
+
actionpack (= 3.1.10)
|
89
|
+
activesupport (= 3.1.10)
|
90
|
+
rack-ssl (~> 1.3.2)
|
91
|
+
rake (>= 0.8.7)
|
92
|
+
rdoc (~> 3.4)
|
93
|
+
thor (~> 0.14.6)
|
94
|
+
rake (0.9.2.2)
|
95
|
+
rdoc (3.12)
|
96
|
+
json (~> 1.4)
|
97
|
+
rspec (2.8.0)
|
98
|
+
rspec-core (~> 2.8.0)
|
99
|
+
rspec-expectations (~> 2.8.0)
|
100
|
+
rspec-mocks (~> 2.8.0)
|
101
|
+
rspec-core (2.8.0)
|
102
|
+
rspec-expectations (2.8.0)
|
103
|
+
diff-lcs (~> 1.1.2)
|
104
|
+
rspec-mocks (2.8.0)
|
105
|
+
sprockets (2.0.4)
|
106
|
+
hike (~> 1.2)
|
107
|
+
rack (~> 1.0)
|
108
|
+
tilt (~> 1.1, != 1.3.0)
|
109
|
+
sqlite3 (1.3.6)
|
110
|
+
thor (0.14.6)
|
111
|
+
tilt (1.3.3)
|
112
|
+
treetop (1.4.12)
|
113
|
+
polyglot
|
114
|
+
polyglot (>= 0.3.1)
|
115
|
+
tzinfo (0.3.35)
|
116
|
+
|
117
|
+
PLATFORMS
|
118
|
+
ruby
|
119
|
+
|
120
|
+
DEPENDENCIES
|
121
|
+
bundler (~> 1.2.3)
|
122
|
+
cucumber
|
123
|
+
debugger
|
124
|
+
faker (~> 1.0.1)
|
125
|
+
jeweler (~> 1.8.4)
|
126
|
+
machinist (= 1.0.6)
|
127
|
+
rails (~> 3.1.0)
|
128
|
+
rdoc (~> 3.12)
|
129
|
+
rspec (~> 2.8.0)
|
130
|
+
sqlite3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Jeremiah Hemphill
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
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.
|
data/README.rdoc
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
= acts_as_word_cloud
|
2
|
+
|
3
|
+
Searches through model to get string attributes and recursively searches other associated models.
|
4
|
+
|
5
|
+
= How to use
|
6
|
+
|
7
|
+
class Article < ActiveRecord::Base
|
8
|
+
acts_as_word_cloud :excluded_models => [Reader, Following], :depth => 2
|
9
|
+
|
10
|
+
belongs_to :site
|
11
|
+
belongs_to :author
|
12
|
+
belongs_to :publisher
|
13
|
+
has_many :followings
|
14
|
+
has_many :readers, :through => :followings
|
15
|
+
end
|
16
|
+
|
17
|
+
Article.last.word_cloud(:array)
|
18
|
+
=> ["Artcle title", "genre", "description", "review", "Website name", "domain", "tagline", <names of affiliated companies>,
|
19
|
+
"Author name", "gender", "location", "bio", "quote", <titles of other authored articles>,
|
20
|
+
"Publisher name", "address", "city", "state", "zip code", "phone number", <titles of other articles published>]
|
21
|
+
|
22
|
+
== Add the gem to your gemfile
|
23
|
+
|
24
|
+
gem "acts_as_word_cloud"
|
25
|
+
|
26
|
+
== Install the migration and config
|
27
|
+
|
28
|
+
rails generate acts_as_word_cloud:install
|
29
|
+
rake db:migrate
|
30
|
+
|
31
|
+
== Add the mixin to your models
|
32
|
+
|
33
|
+
class Article < ActiveRecord::Base
|
34
|
+
acts_as_word_cloud :methods_to_use => [<Symbol>], :excluded_models => [<Constant>], :skipped_attributes => [<Symbol>], :depth => <Integer>
|
35
|
+
end
|
36
|
+
|
37
|
+
There are four options to customize search per model:
|
38
|
+
* methods_to_use : specify which methods (that return strings) should be called when the model is being searched. Models that are being scanned as associations on the model calling word_cloud will only return a value if each of them has a methods_to_use containing a valid method for that model.
|
39
|
+
* excluded_models : select associated models that you would like to leave out of the search.
|
40
|
+
* skipped_attributes : by default, all string attributes are returned, unless some are set to be skipped.
|
41
|
+
* depth : indicates the level of recursion word_cloud should take on the model being searched.
|
42
|
+
|
43
|
+
== Set options for gem's config file
|
44
|
+
|
45
|
+
/config/initializers/acts_as_word_cloud.rb:
|
46
|
+
|
47
|
+
ActsAsWordCloud.configure do |config|
|
48
|
+
config.min_depth = 1
|
49
|
+
config.no_mixin_fields = [:name, :title, :label]
|
50
|
+
end
|
51
|
+
|
52
|
+
Here you can set the default minimum depth to use on all models that include the mixin. (Depth must be greater than or equal to 1, word_cloud will return an error message if not so)
|
53
|
+
|
54
|
+
The no_mixin_fields option allows you to list methods to call on models that do not include the mixin for the gem. These models would be traversed during searches on models with the mixin if they aren't explicitly excluded in the hash. If no methods are added to the list or if a model does not respond to any on this list, word_cloud will return the object's class name.
|
55
|
+
|
56
|
+
== Searching
|
57
|
+
|
58
|
+
Example:
|
59
|
+
|
60
|
+
class Publisher < ActiveRecord::Base
|
61
|
+
belongs_to :site
|
62
|
+
end
|
63
|
+
|
64
|
+
class Site < ActiveRecord::Base
|
65
|
+
acts_as_word_cloud :excluded_models => [Author]
|
66
|
+
|
67
|
+
has_many :publishers
|
68
|
+
has_many :authors
|
69
|
+
has_many :articles
|
70
|
+
end
|
71
|
+
|
72
|
+
class Author < ActiveRecord::Base
|
73
|
+
acts_as_word_cloud :methods_to_use => [:full_name, :random_quote] :skipped_attributes => [:phone_number]
|
74
|
+
|
75
|
+
has_many :articles
|
76
|
+
belongs_to :site
|
77
|
+
end
|
78
|
+
|
79
|
+
class Article < ActiveRecord::Base
|
80
|
+
acts_as_word_cloud :methods_to_use => [:title], :depth => 2
|
81
|
+
|
82
|
+
belongs_to :author
|
83
|
+
belongs_to :site
|
84
|
+
end
|
85
|
+
|
86
|
+
Once model defaults are set, the method to call is .word_cloud:
|
87
|
+
|
88
|
+
Site.last.word_cloud
|
89
|
+
=> model's string attributes, Publisher names (:name having been added to no_mixin_fields in config file),
|
90
|
+
and associated Article titles (this model ignores its associated Author objects)
|
91
|
+
|
92
|
+
Author.last.word_cloud
|
93
|
+
=> model's string attributes except for :phone_number and the values for the methods :full_name and :random_quote,
|
94
|
+
associated Article titles, and nothing for associated Sites since methods_to_use isn't set on the Site model
|
95
|
+
|
96
|
+
Article.last.word_cloud
|
97
|
+
=> model's string attributes, (because of depth 2) the above data for Author and Site associated to current Article.
|
98
|
+
keeping in mind that the above results are due to the default depth being set to 1
|
99
|
+
and that so would they be on the recursive calls to those associated objects
|
100
|
+
|
101
|
+
When the method is scanning through objects recursively it goes as 'deep' as the original model's setting suggests. There may be cycling through the same objects but it will never be stuck in an endless loop since each further model's depth setting is not consulted.
|
102
|
+
|
103
|
+
Optionally, word_cloud can take two parameters:
|
104
|
+
|
105
|
+
* An integer to specify a different recursion depth for that specific method call
|
106
|
+
* The symbol :array to get results listed in an array, by default they are returned in a single string
|
107
|
+
|
108
|
+
== Contributing to acts_as_word_cloud
|
109
|
+
|
110
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
111
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
112
|
+
* Fork the project.
|
113
|
+
* Start a feature/bugfix branch.
|
114
|
+
* Commit and push until you are happy with your contribution.
|
115
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
116
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
117
|
+
|
118
|
+
== Copyright
|
119
|
+
|
120
|
+
Copyright (c) 2012 Jeremiah Hemphill. See LICENSE.txt for
|
121
|
+
further details.
|
122
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "acts_as_word_cloud"
|
18
|
+
gem.homepage = "http://github.com/jeremiahishere/acts_as_word_cloud"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Search function for associated objects on model}
|
21
|
+
gem.description = %Q{Returns values for specified methods on each object containing mixix and values from general methods specified for models that don't have the mixin; depending on 'depth' value passed in the method will also recursively return values for associated objects on each model scanned}
|
22
|
+
gem.email = "jeremiah@cloudspace.com"
|
23
|
+
gem.authors = ["Jeremiah Hemphill"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
require 'cucumber/rake/task'
|
40
|
+
Cucumber::Rake::Task.new(:features)
|
41
|
+
|
42
|
+
task :default => :spec
|
43
|
+
|
44
|
+
require 'rdoc/task'
|
45
|
+
Rake::RDocTask.new do |rdoc|
|
46
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
47
|
+
|
48
|
+
rdoc.rdoc_dir = 'rdoc'
|
49
|
+
rdoc.title = "acts_as_word_cloud #{version}"
|
50
|
+
rdoc.rdoc_files.include('README*')
|
51
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "acts_as_word_cloud"
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jeremiah Hemphill"]
|
12
|
+
s.date = "2013-02-19"
|
13
|
+
s.description = "Returns values for specified methods on each object containing mixix and values from general methods specified for models that don't have the mixin; depending on 'depth' value passed in the method will also recursively return values for associated objects on each model scanned"
|
14
|
+
s.email = "jeremiah@cloudspace.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".DS_Store",
|
21
|
+
".document",
|
22
|
+
".gitignore_new",
|
23
|
+
".rspec",
|
24
|
+
"CHANGELOG",
|
25
|
+
"Gemfile",
|
26
|
+
"Gemfile.lock",
|
27
|
+
"LICENSE.txt",
|
28
|
+
"README.rdoc",
|
29
|
+
"Rakefile",
|
30
|
+
"VERSION",
|
31
|
+
"acts_as_word_cloud.gemspec",
|
32
|
+
"features/acts_as_word_cloud.feature",
|
33
|
+
"features/step_definitions/acts_as_word_cloud_steps.rb",
|
34
|
+
"features/support/env.rb",
|
35
|
+
"lib/acts_as_word_cloud.rb",
|
36
|
+
"lib/acts_as_word_cloud/config.rb",
|
37
|
+
"lib/acts_as_word_cloud/engine.rb",
|
38
|
+
"lib/acts_as_word_cloud/railtie.rb",
|
39
|
+
"lib/acts_as_word_cloud/word_cloud.rb",
|
40
|
+
"lib/generators/acts_as_word_cloud/install_generator.rb",
|
41
|
+
"lib/generators/acts_as_word_cloud/templates/config.rb",
|
42
|
+
"lib/model_methods_helper.rb",
|
43
|
+
"spec/acts_as_word_cloud_spec.rb",
|
44
|
+
"spec/dummy/README.rdoc",
|
45
|
+
"spec/dummy/Rakefile",
|
46
|
+
"spec/dummy/app/assets/javascripts/application.js",
|
47
|
+
"spec/dummy/app/assets/stylesheets/application.css",
|
48
|
+
"spec/dummy/app/controllers/application_controller.rb",
|
49
|
+
"spec/dummy/app/helpers/application_helper.rb",
|
50
|
+
"spec/dummy/app/mailers/.gitkeep",
|
51
|
+
"spec/dummy/app/models/.gitkeep",
|
52
|
+
"spec/dummy/app/models/article.rb",
|
53
|
+
"spec/dummy/app/models/author.rb",
|
54
|
+
"spec/dummy/app/models/following.rb",
|
55
|
+
"spec/dummy/app/models/publisher.rb",
|
56
|
+
"spec/dummy/app/models/reader.rb",
|
57
|
+
"spec/dummy/app/models/site.rb",
|
58
|
+
"spec/dummy/app/views/layouts/application.html.erb",
|
59
|
+
"spec/dummy/config.ru",
|
60
|
+
"spec/dummy/config/application.rb",
|
61
|
+
"spec/dummy/config/boot.rb",
|
62
|
+
"spec/dummy/config/database.yml",
|
63
|
+
"spec/dummy/config/environment.rb",
|
64
|
+
"spec/dummy/config/environments/development.rb",
|
65
|
+
"spec/dummy/config/environments/production.rb",
|
66
|
+
"spec/dummy/config/environments/test.rb",
|
67
|
+
"spec/dummy/config/initializers/backtrace_silencers.rb",
|
68
|
+
"spec/dummy/config/initializers/inflections.rb",
|
69
|
+
"spec/dummy/config/initializers/mime_types.rb",
|
70
|
+
"spec/dummy/config/initializers/secret_token.rb",
|
71
|
+
"spec/dummy/config/initializers/session_store.rb",
|
72
|
+
"spec/dummy/config/initializers/wrap_parameters.rb",
|
73
|
+
"spec/dummy/config/locales/en.yml",
|
74
|
+
"spec/dummy/config/routes.rb",
|
75
|
+
"spec/dummy/db/migrate/20121107162154_create_system.rb",
|
76
|
+
"spec/dummy/db/schema.rb",
|
77
|
+
"spec/dummy/features/support/blueprints.rb",
|
78
|
+
"spec/dummy/lib/assets/.gitkeep",
|
79
|
+
"spec/dummy/lib/model_methods_helper.rb",
|
80
|
+
"spec/dummy/log/.gitkeep",
|
81
|
+
"spec/dummy/public/404.html",
|
82
|
+
"spec/dummy/public/422.html",
|
83
|
+
"spec/dummy/public/500.html",
|
84
|
+
"spec/dummy/public/favicon.ico",
|
85
|
+
"spec/dummy/script/rails",
|
86
|
+
"spec/spec_helper.rb"
|
87
|
+
]
|
88
|
+
s.homepage = "http://github.com/jeremiahishere/acts_as_word_cloud"
|
89
|
+
s.licenses = ["MIT"]
|
90
|
+
s.require_paths = ["lib"]
|
91
|
+
s.rubygems_version = "1.8.15"
|
92
|
+
s.summary = "Search function for associated objects on model"
|
93
|
+
|
94
|
+
if s.respond_to? :specification_version then
|
95
|
+
s.specification_version = 3
|
96
|
+
|
97
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
98
|
+
s.add_runtime_dependency(%q<rails>, ["~> 3.1.0"])
|
99
|
+
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
100
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
101
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
102
|
+
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
103
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.2.3"])
|
104
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
105
|
+
s.add_development_dependency(%q<debugger>, [">= 0"])
|
106
|
+
else
|
107
|
+
s.add_dependency(%q<rails>, ["~> 3.1.0"])
|
108
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
109
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
110
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
111
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
112
|
+
s.add_dependency(%q<bundler>, ["~> 1.2.3"])
|
113
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
114
|
+
s.add_dependency(%q<debugger>, [">= 0"])
|
115
|
+
end
|
116
|
+
else
|
117
|
+
s.add_dependency(%q<rails>, ["~> 3.1.0"])
|
118
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
119
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
120
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
121
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
122
|
+
s.add_dependency(%q<bundler>, ["~> 1.2.3"])
|
123
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
124
|
+
s.add_dependency(%q<debugger>, [">= 0"])
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
begin
|
3
|
+
Bundler.setup(:default, :development)
|
4
|
+
rescue Bundler::BundlerError => e
|
5
|
+
$stderr.puts e.message
|
6
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
7
|
+
exit e.status_code
|
8
|
+
end
|
9
|
+
|
10
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
11
|
+
require 'acts_as_word_cloud'
|
12
|
+
|
13
|
+
require 'rspec/expectations'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# this file was stolen from kaminari
|
2
|
+
require 'active_support/configurable'
|
3
|
+
|
4
|
+
module ActsAsWordCloud
|
5
|
+
|
6
|
+
# create new configs by passing a block with the config assignment
|
7
|
+
def self.configure(&block)
|
8
|
+
yield @config ||= ActsAsWordCloud::Configuration.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.config
|
12
|
+
@config
|
13
|
+
end
|
14
|
+
|
15
|
+
# setup config data
|
16
|
+
class Configuration
|
17
|
+
include ActiveSupport::Configurable
|
18
|
+
config_accessor :min_depth
|
19
|
+
config_accessor :no_mixin_fields
|
20
|
+
|
21
|
+
def param_name
|
22
|
+
config.param_name.respond_to?(:call) ? config.param_name.call() : config.param_name
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# setup default options
|
27
|
+
# this should match the generator config that goes in the initializer file
|
28
|
+
configure do |config|
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
require 'acts_as_word_cloud/config'
|
4
|
+
|
5
|
+
module ActsAsWordCloud
|
6
|
+
class Railtie < ::Rails::Railtie
|
7
|
+
initializer 'acts_as_word_cloud' do |app|
|
8
|
+
require 'acts_as_word_cloud/word_cloud'
|
9
|
+
ActiveRecord::Base.send :include, ActsAsWordCloud::WordCloud
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|