bookmarker 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- metadata +7 -87
- data/MIT-LICENSE +0 -20
- data/README.rdoc +0 -3
- data/Rakefile +0 -38
- data/lib/bookmarker.rb +0 -18
- data/lib/bookmarker/bookmark.rb +0 -18
- data/lib/bookmarker/bookmark_maker.rb +0 -58
- data/lib/bookmarker/bookmarkable.rb +0 -23
- data/lib/bookmarker/engine.rb +0 -4
- data/lib/bookmarker/extenders/bookmark_maker.rb +0 -22
- data/lib/bookmarker/extenders/bookmarkable.rb +0 -22
- data/lib/bookmarker/version.rb +0 -3
- data/lib/generators/bookmarker/bookmarker_generator.rb +0 -39
- data/lib/generators/bookmarker/install_generator.rb +0 -35
- data/lib/generators/bookmarker/templates/migration.rb +0 -21
- data/lib/init.rb +0 -1
- data/lib/tasks/bookmarker_tasks.rake +0 -4
- data/test/bookmarker_test.rb +0 -7
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -59
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -37
- data/test/dummy/config/environments/production.rb +0 -67
- data/test/dummy/config/environments/test.rb +0 -37
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -58
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +0 -6
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/test_helper.rb +0 -15
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookmarker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -59,62 +59,14 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
description:
|
62
|
+
description: Simple add bookmarks functionality to your models
|
63
63
|
email:
|
64
64
|
- kazanlug@gmail.com
|
65
65
|
executables: []
|
66
66
|
extensions: []
|
67
67
|
extra_rdoc_files: []
|
68
|
-
files:
|
69
|
-
|
70
|
-
- lib/bookmarker/bookmarkable.rb
|
71
|
-
- lib/bookmarker/bookmark_maker.rb
|
72
|
-
- lib/bookmarker/engine.rb
|
73
|
-
- lib/bookmarker/extenders/bookmarkable.rb
|
74
|
-
- lib/bookmarker/extenders/bookmark_maker.rb
|
75
|
-
- lib/bookmarker/version.rb
|
76
|
-
- lib/bookmarker.rb
|
77
|
-
- lib/generators/bookmarker/bookmarker_generator.rb
|
78
|
-
- lib/generators/bookmarker/install_generator.rb
|
79
|
-
- lib/generators/bookmarker/templates/migration.rb
|
80
|
-
- lib/init.rb
|
81
|
-
- lib/tasks/bookmarker_tasks.rake
|
82
|
-
- MIT-LICENSE
|
83
|
-
- Rakefile
|
84
|
-
- README.rdoc
|
85
|
-
- test/bookmarker_test.rb
|
86
|
-
- test/dummy/app/assets/javascripts/application.js
|
87
|
-
- test/dummy/app/assets/stylesheets/application.css
|
88
|
-
- test/dummy/app/controllers/application_controller.rb
|
89
|
-
- test/dummy/app/helpers/application_helper.rb
|
90
|
-
- test/dummy/app/views/layouts/application.html.erb
|
91
|
-
- test/dummy/config/application.rb
|
92
|
-
- test/dummy/config/boot.rb
|
93
|
-
- test/dummy/config/database.yml
|
94
|
-
- test/dummy/config/environment.rb
|
95
|
-
- test/dummy/config/environments/development.rb
|
96
|
-
- test/dummy/config/environments/production.rb
|
97
|
-
- test/dummy/config/environments/test.rb
|
98
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
99
|
-
- test/dummy/config/initializers/inflections.rb
|
100
|
-
- test/dummy/config/initializers/mime_types.rb
|
101
|
-
- test/dummy/config/initializers/secret_token.rb
|
102
|
-
- test/dummy/config/initializers/session_store.rb
|
103
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
104
|
-
- test/dummy/config/locales/en.yml
|
105
|
-
- test/dummy/config/routes.rb
|
106
|
-
- test/dummy/config.ru
|
107
|
-
- test/dummy/db/test.sqlite3
|
108
|
-
- test/dummy/log/test.log
|
109
|
-
- test/dummy/public/404.html
|
110
|
-
- test/dummy/public/422.html
|
111
|
-
- test/dummy/public/500.html
|
112
|
-
- test/dummy/public/favicon.ico
|
113
|
-
- test/dummy/Rakefile
|
114
|
-
- test/dummy/README.rdoc
|
115
|
-
- test/dummy/script/rails
|
116
|
-
- test/test_helper.rb
|
117
|
-
homepage: http://www.smartapps.ru
|
68
|
+
files: []
|
69
|
+
homepage: https://github.com/maratgaliev/bookmarker
|
118
70
|
licenses: []
|
119
71
|
post_install_message:
|
120
72
|
rdoc_options: []
|
@@ -137,37 +89,5 @@ rubyforge_project:
|
|
137
89
|
rubygems_version: 1.8.24
|
138
90
|
signing_key:
|
139
91
|
specification_version: 3
|
140
|
-
summary: Add bookmarks to your models
|
141
|
-
test_files:
|
142
|
-
- test/bookmarker_test.rb
|
143
|
-
- test/dummy/app/assets/javascripts/application.js
|
144
|
-
- test/dummy/app/assets/stylesheets/application.css
|
145
|
-
- test/dummy/app/controllers/application_controller.rb
|
146
|
-
- test/dummy/app/helpers/application_helper.rb
|
147
|
-
- test/dummy/app/views/layouts/application.html.erb
|
148
|
-
- test/dummy/config/application.rb
|
149
|
-
- test/dummy/config/boot.rb
|
150
|
-
- test/dummy/config/database.yml
|
151
|
-
- test/dummy/config/environment.rb
|
152
|
-
- test/dummy/config/environments/development.rb
|
153
|
-
- test/dummy/config/environments/production.rb
|
154
|
-
- test/dummy/config/environments/test.rb
|
155
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
156
|
-
- test/dummy/config/initializers/inflections.rb
|
157
|
-
- test/dummy/config/initializers/mime_types.rb
|
158
|
-
- test/dummy/config/initializers/secret_token.rb
|
159
|
-
- test/dummy/config/initializers/session_store.rb
|
160
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
161
|
-
- test/dummy/config/locales/en.yml
|
162
|
-
- test/dummy/config/routes.rb
|
163
|
-
- test/dummy/config.ru
|
164
|
-
- test/dummy/db/test.sqlite3
|
165
|
-
- test/dummy/log/test.log
|
166
|
-
- test/dummy/public/404.html
|
167
|
-
- test/dummy/public/422.html
|
168
|
-
- test/dummy/public/500.html
|
169
|
-
- test/dummy/public/favicon.ico
|
170
|
-
- test/dummy/Rakefile
|
171
|
-
- test/dummy/README.rdoc
|
172
|
-
- test/dummy/script/rails
|
173
|
-
- test/test_helper.rb
|
92
|
+
summary: Add bookmarks to your models
|
93
|
+
test_files: []
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright 2013 YOURNAME
|
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
DELETED
data/Rakefile
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
begin
|
3
|
-
require 'bundler/setup'
|
4
|
-
rescue LoadError
|
5
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'rdoc/task'
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
14
|
-
|
15
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
-
rdoc.rdoc_dir = 'rdoc'
|
17
|
-
rdoc.title = 'Bookmarker'
|
18
|
-
rdoc.options << '--line-numbers'
|
19
|
-
rdoc.rdoc_files.include('README.rdoc')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
Bundler::GemHelper.install_tasks
|
27
|
-
|
28
|
-
require 'rake/testtask'
|
29
|
-
|
30
|
-
Rake::TestTask.new(:test) do |t|
|
31
|
-
t.libs << 'lib'
|
32
|
-
t.libs << 'test'
|
33
|
-
t.pattern = 'test/**/*_test.rb'
|
34
|
-
t.verbose = false
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
task :default => :test
|
data/lib/bookmarker.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'active_record'
|
2
|
-
require 'active_support/inflector'
|
3
|
-
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
6
|
-
|
7
|
-
module Bookmarker
|
8
|
-
if defined?(ActiveRecord::Base)
|
9
|
-
require "bookmarker/engine"
|
10
|
-
require "bookmarker/version"
|
11
|
-
require "bookmarker/engine"
|
12
|
-
require 'bookmarker/extenders/bookmarkable'
|
13
|
-
require 'bookmarker/extenders/bookmark_maker'
|
14
|
-
require 'bookmarker/bookmark'
|
15
|
-
ActiveRecord::Base.extend Bookmarker::Extenders::Bookmarkable
|
16
|
-
ActiveRecord::Base.extend Bookmarker::Extenders::BookmarkMaker
|
17
|
-
end
|
18
|
-
end
|
data/lib/bookmarker/bookmark.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module Bookmarker
|
2
|
-
class Bookmark < ::ActiveRecord::Base
|
3
|
-
|
4
|
-
attr_accessible :bookmarkable_id, :bookmarkable_type,
|
5
|
-
:bookmark_maker_id, :bookmark_maker_type,
|
6
|
-
:bookmarkable, :bookmark_maker, :description
|
7
|
-
|
8
|
-
belongs_to :bookmarkable, :polymorphic => true
|
9
|
-
belongs_to :bookmark_maker, :polymorphic => true
|
10
|
-
|
11
|
-
validates_presence_of :bookmarkable_id
|
12
|
-
validates_presence_of :bookmark_maker_id
|
13
|
-
|
14
|
-
validates_uniqueness_of :bookmarkable_id, :scope => [:bookmarkable_type, :bookmark_maker_id, :bookmarkable_type]
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
module Bookmarker
|
2
|
-
module BookmarkMaker
|
3
|
-
|
4
|
-
def self.included(base)
|
5
|
-
|
6
|
-
aliases = {
|
7
|
-
:add_bookmark => [:new_bookmark],
|
8
|
-
:unbookmark => [:remove_bookmark]
|
9
|
-
}
|
10
|
-
|
11
|
-
base.class_eval do
|
12
|
-
|
13
|
-
belongs_to :bookmark_maker, :polymorphic => true
|
14
|
-
|
15
|
-
validates_uniqueness_of :bookmark
|
16
|
-
|
17
|
-
has_many :bookmarks, :class_name => "Bookmarker::Bookmark", :as => :bookmark_maker
|
18
|
-
|
19
|
-
aliases.each do |method, links|
|
20
|
-
links.each do |new_method|
|
21
|
-
alias_method(new_method, method)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def add_bookmark bookmarkable
|
28
|
-
|
29
|
-
bookmark = Bookmarker::Bookmark.new( :bookmarkable => bookmarkable, :bookmark_maker => self)
|
30
|
-
|
31
|
-
if bookmark.save
|
32
|
-
true
|
33
|
-
else
|
34
|
-
false
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
def find_bookmarks bookmarkable_model
|
40
|
-
bookmarks.where(:bookmarkable_type => bookmarkable_model.base_class.name.to_s)
|
41
|
-
end
|
42
|
-
|
43
|
-
def remove_bookmarks
|
44
|
-
bookmarks.delete_all
|
45
|
-
end
|
46
|
-
|
47
|
-
def unbookmark bookmarkable
|
48
|
-
bookmark = self.bookmarks.where(:bookmarkable_id => bookmarkable.id, :bookmarkable_type => bookmarkable.class.name.to_s).first
|
49
|
-
if bookmark.destroy
|
50
|
-
true
|
51
|
-
else
|
52
|
-
false
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Bookmarker
|
2
|
-
module Bookmarkable
|
3
|
-
|
4
|
-
def self.included(base)
|
5
|
-
base.extend ClassMethods
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.included base
|
9
|
-
base.class_eval do
|
10
|
-
belongs_to :bookmarkable, :polymorphic => true
|
11
|
-
has_many :bookmarks, :class_name => "Bookmarker::Bookmark", :as => :bookmarkable
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def default_conditions
|
16
|
-
{
|
17
|
-
:bookmarkable_id => self.id,
|
18
|
-
:bookmarkable_type => self.base_class.name.to_s
|
19
|
-
}
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
data/lib/bookmarker/engine.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module Bookmarker
|
2
|
-
module Extenders
|
3
|
-
module BookmarkMaker
|
4
|
-
|
5
|
-
def bookmark_maker?
|
6
|
-
false
|
7
|
-
end
|
8
|
-
|
9
|
-
def is_bookmark_maker(*args)
|
10
|
-
require 'bookmarker/bookmark_maker'
|
11
|
-
include Bookmarker::BookmarkMaker
|
12
|
-
|
13
|
-
class_eval do
|
14
|
-
def self.bookmark_maker?
|
15
|
-
true
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Bookmarker
|
2
|
-
module Extenders
|
3
|
-
module Bookmarkable
|
4
|
-
|
5
|
-
def bookmarkable?
|
6
|
-
false
|
7
|
-
end
|
8
|
-
|
9
|
-
|
10
|
-
def is_bookmarkable
|
11
|
-
require 'bookmarker/bookmarkable'
|
12
|
-
include Bookmarker::Bookmarkable
|
13
|
-
class_eval do
|
14
|
-
def self.bookmarkable?
|
15
|
-
true
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/lib/bookmarker/version.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
require 'rails/generators/migration'
|
3
|
-
|
4
|
-
module Bookmarker
|
5
|
-
module Generators
|
6
|
-
class InstallGenerator < Rails::Generators::Base
|
7
|
-
include Rails::Generators::Migration
|
8
|
-
|
9
|
-
source_root File.expand_path("../templates", __FILE__)
|
10
|
-
|
11
|
-
desc "Generates migration for Bookmarker"
|
12
|
-
|
13
|
-
def self.orm
|
14
|
-
Rails::Generators.options[:rails][:orm]
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.source_root
|
18
|
-
File.join(File.dirname(__FILE__), 'templates', (orm.to_s unless orm.class.eql?(String)) )
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.orm_has_migration?
|
22
|
-
[:active_record].include? orm
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.next_migration_number(dirname)
|
26
|
-
if ActiveRecord::Base.timestamped_migrations
|
27
|
-
Time.new.utc.strftime("%Y%m%d%H%M%S")
|
28
|
-
else
|
29
|
-
"%.3d" % (current_migration_number(dirname) + 1)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def create_migration_file
|
34
|
-
migration_template 'migration.rb', 'db/migrate/create_bookmarks_table.rb'
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
require 'rails/generators/migration'
|
3
|
-
|
4
|
-
module Bookmarker
|
5
|
-
module Generators
|
6
|
-
class InstallGenerator < Rails::Generators::Base
|
7
|
-
include Rails::Generators::Migration
|
8
|
-
|
9
|
-
source_root File.expand_path("../templates", __FILE__)
|
10
|
-
|
11
|
-
desc "Generates migration for Bookmarker"
|
12
|
-
|
13
|
-
def self.orm
|
14
|
-
Rails::Generators.options[:rails][:orm]
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.orm_has_migration?
|
18
|
-
[:active_record].include? orm
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.next_migration_number(dirname)
|
22
|
-
if ActiveRecord::Base.timestamped_migrations
|
23
|
-
Time.new.utc.strftime("%Y%m%d%H%M%S")
|
24
|
-
else
|
25
|
-
"%.3d" % (current_migration_number(dirname) + 1)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def copy_migration
|
30
|
-
migration_template 'migration.rb', 'db/migrate/create_bookmarks_table.rb'
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|