andyw8-acts_as_event_owner 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/Gemfile +4 -0
- data/LICENSE +24 -0
- data/README.textile +217 -0
- data/Rakefile +10 -0
- data/acts_as_event_owner.gemspec +20 -0
- data/generators/acts_as_event_owner_migration/USAGE +6 -0
- data/generators/acts_as_event_owner_migration/acts_as_event_owner_migration_generator.rb +7 -0
- data/generators/acts_as_event_owner_migration/templates/acts_as_event_owner_migration.rb +38 -0
- data/lib/acts_as_event_owner.rb +19 -0
- data/lib/acts_as_event_owner/core.rb +46 -0
- data/lib/acts_as_event_owner/event_occurrence.rb +7 -0
- data/lib/acts_as_event_owner/event_specification.rb +186 -0
- data/lib/acts_as_event_owner/exception.rb +4 -0
- data/lib/acts_as_event_owner/railtie.rb +13 -0
- data/lib/acts_as_event_owner/ri_cal_fix.rb +7 -0
- data/lib/acts_as_event_owner/version.rb +3 -0
- data/lib/generators/acts_as_event_owner/migration/migration_generator.rb +31 -0
- data/lib/generators/acts_as_event_owner/migration/templates/active_record/acts_as_event_owner_migration.rb +38 -0
- data/lib/generators/acts_as_event_owner_migration/USAGE +6 -0
- data/lib/generators/acts_as_event_owner_migration/acts_as_event_owner_migration_generator.rb +7 -0
- data/lib/generators/acts_as_event_owner_migration/templates/acts_as_event_owner_migration.rb +38 -0
- data/lib/tasks/acts_as_event_owner_tasks.rake +14 -0
- data/rails/init.rb +1 -0
- data/spec/acts_as_event_owner/core_spec.rb +78 -0
- data/spec/acts_as_event_owner/event_specification_spec.rb +454 -0
- data/spec/schema.rb +43 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/support/model_builders.rb +13 -0
- data/spec/support/user.rb +3 -0
- metadata +99 -0
data/spec/schema.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 1) do
|
2
|
+
create_table "event_occurrences", :force => true do |t|
|
3
|
+
t.integer "owner_id"
|
4
|
+
t.string "owner_type"
|
5
|
+
t.integer "event_specification_id"
|
6
|
+
t.datetime "start_at"
|
7
|
+
t.datetime "end_at"
|
8
|
+
t.string "description"
|
9
|
+
t.datetime "created_at"
|
10
|
+
t.datetime "updated_at"
|
11
|
+
t.string "added_string"
|
12
|
+
t.boolean "added_boolean"
|
13
|
+
t.datetime "added_datetime"
|
14
|
+
end
|
15
|
+
add_index "event_occurrences", ["event_specification_id"], :name => "index_event_occurrences_on_event_specification_id"
|
16
|
+
add_index "event_occurrences", ["owner_id", "owner_type"], :name => "index_event_occurrences_on_owner_id_and_owner_type"
|
17
|
+
|
18
|
+
create_table "event_specifications", :force => true do |t|
|
19
|
+
t.integer "owner_id"
|
20
|
+
t.string "owner_type"
|
21
|
+
t.string "description"
|
22
|
+
t.datetime "start_at"
|
23
|
+
t.datetime "end_at"
|
24
|
+
t.string "repeat"
|
25
|
+
t.integer "frequency", :default => 1
|
26
|
+
t.string "on"
|
27
|
+
t.string "on_the"
|
28
|
+
t.string "target"
|
29
|
+
t.datetime "until"
|
30
|
+
t.datetime "created_at"
|
31
|
+
t.datetime "updated_at"
|
32
|
+
t.string "added_string"
|
33
|
+
t.boolean "added_boolean"
|
34
|
+
t.datetime "added_datetime"
|
35
|
+
end
|
36
|
+
add_index "event_specifications", ["owner_id", "owner_type"], :name => "index_event_specifications_on_owner_id_and_owner_type"
|
37
|
+
|
38
|
+
create_table "users", :force => true do |t|
|
39
|
+
t.string "name"
|
40
|
+
t.datetime "created_at"
|
41
|
+
t.datetime "updated_at"
|
42
|
+
end
|
43
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_record'
|
3
|
+
require 'active_support/time_with_zone'
|
4
|
+
require 'pp'
|
5
|
+
|
6
|
+
ActiveRecord::Base.default_timezone = :utc
|
7
|
+
|
8
|
+
ActiveRecord::Base.establish_connection({
|
9
|
+
:adapter => 'sqlite3',
|
10
|
+
:database => ':memory:'
|
11
|
+
})
|
12
|
+
# ActiveRecord::Base.logger = Logger.new(File.open("test.log", "w"))
|
13
|
+
|
14
|
+
require File.expand_path('../../lib/acts_as_event_owner', __FILE__)
|
15
|
+
include ActsAsEventOwner
|
16
|
+
|
17
|
+
require 'support/model_builders'
|
18
|
+
require 'support/user'
|
19
|
+
|
20
|
+
ActiveRecord::Base.silence do
|
21
|
+
ActiveRecord::Migration.verbose = false
|
22
|
+
load(File.dirname(__FILE__) + '/schema.rb')
|
23
|
+
end
|
24
|
+
|
25
|
+
def clean_database!
|
26
|
+
[ActsAsEventOwner::EventSpecification, ActsAsEventOwner::EventOccurrence, User].each do |model|
|
27
|
+
ActiveRecord::Base.connection.execute "DELETE FROM #{model.table_name}"
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
def attributes_for_event_specification(overrides={})
|
2
|
+
{
|
3
|
+
:description => 'do something'
|
4
|
+
}.merge(overrides)
|
5
|
+
end
|
6
|
+
|
7
|
+
def new_event_specification(overrides={})
|
8
|
+
ActsAsEventOwner::EventSpecification.new(attributes_for_event_specification(overrides))
|
9
|
+
end
|
10
|
+
|
11
|
+
def create_event_specification(overrides={})
|
12
|
+
ActsAsEventOwner::EventSpecification.create(attributes_for_event_specification(overrides))
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: andyw8-acts_as_event_owner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.4
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Danny Burkes
|
9
|
+
- Andy Waite
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-02-11 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ri_cal
|
17
|
+
prerelease: false
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
none: false
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
none: false
|
31
|
+
description: Simple calendar events for any ActiveRecord model
|
32
|
+
email:
|
33
|
+
- dburkes@netable.com
|
34
|
+
- github@andywaite.com
|
35
|
+
executables: []
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- .gitignore
|
40
|
+
- Gemfile
|
41
|
+
- LICENSE
|
42
|
+
- README.textile
|
43
|
+
- Rakefile
|
44
|
+
- acts_as_event_owner.gemspec
|
45
|
+
- generators/acts_as_event_owner_migration/USAGE
|
46
|
+
- generators/acts_as_event_owner_migration/acts_as_event_owner_migration_generator.rb
|
47
|
+
- generators/acts_as_event_owner_migration/templates/acts_as_event_owner_migration.rb
|
48
|
+
- lib/acts_as_event_owner.rb
|
49
|
+
- lib/acts_as_event_owner/core.rb
|
50
|
+
- lib/acts_as_event_owner/event_occurrence.rb
|
51
|
+
- lib/acts_as_event_owner/event_specification.rb
|
52
|
+
- lib/acts_as_event_owner/exception.rb
|
53
|
+
- lib/acts_as_event_owner/railtie.rb
|
54
|
+
- lib/acts_as_event_owner/ri_cal_fix.rb
|
55
|
+
- lib/acts_as_event_owner/version.rb
|
56
|
+
- lib/generators/acts_as_event_owner/migration/migration_generator.rb
|
57
|
+
- lib/generators/acts_as_event_owner/migration/templates/active_record/acts_as_event_owner_migration.rb
|
58
|
+
- lib/generators/acts_as_event_owner_migration/USAGE
|
59
|
+
- lib/generators/acts_as_event_owner_migration/acts_as_event_owner_migration_generator.rb
|
60
|
+
- lib/generators/acts_as_event_owner_migration/templates/acts_as_event_owner_migration.rb
|
61
|
+
- lib/tasks/acts_as_event_owner_tasks.rake
|
62
|
+
- rails/init.rb
|
63
|
+
- spec/acts_as_event_owner/core_spec.rb
|
64
|
+
- spec/acts_as_event_owner/event_specification_spec.rb
|
65
|
+
- spec/schema.rb
|
66
|
+
- spec/spec_helper.rb
|
67
|
+
- spec/support/model_builders.rb
|
68
|
+
- spec/support/user.rb
|
69
|
+
homepage: http://github.com/andyw8/acts_as_event_owner
|
70
|
+
licenses: []
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
none: false
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
none: false
|
87
|
+
requirements: []
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 1.8.24
|
90
|
+
signing_key:
|
91
|
+
specification_version: 3
|
92
|
+
summary: Simple calendar events for any ActiveRecord model
|
93
|
+
test_files:
|
94
|
+
- spec/acts_as_event_owner/core_spec.rb
|
95
|
+
- spec/acts_as_event_owner/event_specification_spec.rb
|
96
|
+
- spec/schema.rb
|
97
|
+
- spec/spec_helper.rb
|
98
|
+
- spec/support/model_builders.rb
|
99
|
+
- spec/support/user.rb
|