actic 0.0.2 → 0.0.2.1
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 +1 -1
- data/README.rdoc +3 -0
- data/Rakefile +26 -1
- data/lib/actic.rb +1 -177
- data/lib/actic/engine.rb +3 -3
- data/lib/app/models/alarm.rb +10 -0
- data/lib/app/models/calendar.rb +40 -0
- data/lib/app/models/component.rb +99 -0
- data/lib/app/models/event.rb +58 -0
- data/lib/app/models/free_busy.rb +3 -0
- data/lib/app/models/inspectable.rb +2 -0
- data/lib/app/models/journal.rb +4 -0
- data/lib/app/models/pattern.rb +7 -0
- data/lib/app/models/patterns/ex_date.rb +5 -0
- data/lib/app/models/patterns/ex_rule.rb +5 -0
- data/lib/app/models/patterns/r_date.rb +5 -0
- data/lib/app/models/patterns/r_rule.rb +5 -0
- data/lib/app/models/sub_calendar.rb +3 -0
- data/lib/app/models/todo.rb +5 -0
- data/lib/migrate/20101217173535_create_components.rb +87 -0
- data/lib/migrate/20101218062739_create_inspectables.rb +12 -0
- metadata +43 -38
- data/.DS_Store +0 -0
- data/.idea/.rakeTasks +0 -7
- data/.idea/actic.iml +0 -33
- data/.idea/encodings.xml +0 -5
- data/.idea/misc.xml +0 -8
- data/.idea/modules.xml +0 -9
- data/.idea/vcs.xml +0 -8
- data/.idea/workspace.xml +0 -373
- data/Gemfile +0 -29
- data/Gemfile.lock +0 -21
- data/README +0 -52
- data/actic.gemspec +0 -23
- data/lib/actic/models/actic_calendar.rb +0 -8
- data/lib/actic/models/event.rb +0 -5
- data/lib/actic/models/sub_component.rb +0 -5
- data/lib/actic/railtie.rb +0 -62
- data/lib/actic/version.rb +0 -3
- data/lib/generators/actic/USAGE +0 -8
- data/lib/generators/actic/actic_generator.rb +0 -3
- data/lib/generators/actic_calendar/USAGE +0 -8
- data/lib/generators/actic_calendar/actic_calendar_generator.rb +0 -51
- data/lib/generators/actic_calendar/templates/actic_calendar.rb.txt +0 -4
- data/lib/generators/actic_calendar/templates/migration.rb.txt +0 -20
- data/lib/generators/actic_subcomponent/USAGE +0 -8
- data/lib/generators/actic_subcomponent/actic_subcomponent_generator.rb +0 -13
- data/lib/generators/actic_subcomponent/templates/event.rb.txt +0 -2
- data/lib/generators/actic_subcomponent/templates/journal.rb.txt +0 -2
data/Gemfile
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in actic.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
#gem "rails", "3.0.0"
|
7
|
-
if File.exist? File.expand_path('../../rails', __FILE__)
|
8
|
-
#gem "rails", "3.0.0", :path => "../rails"
|
9
|
-
else
|
10
|
-
#gem "rails", "3.0.0", :git => "git://github.com/rails/rails.git"
|
11
|
-
end
|
12
|
-
|
13
|
-
platforms :jruby do
|
14
|
-
#gem 'activerecord-jdbcsqlite3-adapter'
|
15
|
-
end
|
16
|
-
|
17
|
-
platforms :ruby do
|
18
|
-
#gem "sqlite3-ruby"
|
19
|
-
if RUBY_VERSION < '1.9'
|
20
|
-
#gem "ruby-debug", ">= 0.10.3"
|
21
|
-
end
|
22
|
-
group :mongoid do
|
23
|
-
#gem "mongo"
|
24
|
-
#gem "mongoid", :git => "git://github.com/durran/mongoid.git"
|
25
|
-
#gem "bson_ext"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# gem 'ri_cal', :require => 'ri_cal', :git => "git@github.com:tevio/ri_cal.git"
|
data/Gemfile.lock
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git@github.com:tevio/ri_cal.git
|
3
|
-
revision: 9523264c8c87ad54f557d2e2d93e8d4b69d28983
|
4
|
-
specs:
|
5
|
-
ri_cal (0.8.7)
|
6
|
-
|
7
|
-
PATH
|
8
|
-
remote: .
|
9
|
-
specs:
|
10
|
-
actic (0.0.1)
|
11
|
-
|
12
|
-
GEM
|
13
|
-
remote: http://rubygems.org/
|
14
|
-
specs:
|
15
|
-
|
16
|
-
PLATFORMS
|
17
|
-
ruby
|
18
|
-
|
19
|
-
DEPENDENCIES
|
20
|
-
actic!
|
21
|
-
ri_cal!
|
data/README
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
Actic
|
2
|
-
=====
|
3
|
-
Hi,
|
4
|
-
|
5
|
-
This is a very early beta, functionality is currently very limited.
|
6
|
-
|
7
|
-
This gem fuses iCalendar with ORM, can be used to make your data model date and event aware.
|
8
|
-
it can be used to create calendar objects and events at the moment,
|
9
|
-
more subcomponents will be added in time
|
10
|
-
|
11
|
-
Generators
|
12
|
-
=========
|
13
|
-
|
14
|
-
rails g actic_calendar ### will generate a calendar model and migration with the model name Calendar.
|
15
|
-
rails g actic_calendar NuCal owner:references ### you can supply a name and/or additional database fields
|
16
|
-
rails g actic_calendar owner:references ### you can supply additional fields and no name!
|
17
|
-
|
18
|
-
|
19
|
-
API Example
|
20
|
-
==========
|
21
|
-
|
22
|
-
Models implementing this interface will need to offer an 'ical' string field ( t.string :ical ) in the database schema. ( if you use the generators you wont need to worry about this )
|
23
|
-
|
24
|
-
class Event < ActiveRecord::Base
|
25
|
-
include Actic::Event
|
26
|
-
end
|
27
|
-
|
28
|
-
event = Event.new
|
29
|
-
event.start_time = DateTime.now
|
30
|
-
event.end_time = DateTime.now + 3.hours
|
31
|
-
|
32
|
-
event.recurrence = "FREQ=DAILY;COUNT=10"
|
33
|
-
# OR
|
34
|
-
event.recurs :freq => :daily, :count => 10
|
35
|
-
|
36
|
-
event.description = "Bake Cake"
|
37
|
-
event.occurrences(:after => DateTime.now, :before => (DateTime.now + 5.days))
|
38
|
-
|
39
|
-
|
40
|
-
class Calendar < ActiveRecord::Base
|
41
|
-
include Actic::Calendar
|
42
|
-
end
|
43
|
-
|
44
|
-
c = Calendar.new
|
45
|
-
c.add_subcomponent event
|
46
|
-
|
47
|
-
|
48
|
-
Many Thanks to RubyRedrick ( Rick DeNatale ) for the awesome ri_cal library
|
49
|
-
|
50
|
-
Copyright (c) 2010 Steve Martin, released under the MIT license
|
51
|
-
|
52
|
-
|
data/actic.gemspec
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "actic/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "actic"
|
7
|
-
s.version = Actic::VERSION
|
8
|
-
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ["Steve A Martin"]
|
10
|
-
s.email = ["steve@shakewell.co.uk"]
|
11
|
-
s.homepage = "http://rubygems.org/gems/actic"
|
12
|
-
s.summary = %q{A fusion of ORM and ical}
|
13
|
-
s.description = %q{This gem includes the actic orm wrapperb and a series of generators, it is purely for rails 3}
|
14
|
-
|
15
|
-
s.rubyforge_project = "actic"
|
16
|
-
|
17
|
-
s.add_dependency('ri_cal', '>= 0.8.7')
|
18
|
-
|
19
|
-
s.files = `git ls-files`.split("\n")
|
20
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
-
s.require_paths = ["lib"]
|
23
|
-
end
|
data/lib/actic/models/event.rb
DELETED
data/lib/actic/railtie.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'actic'
|
2
|
-
require 'rails'
|
3
|
-
module Actic
|
4
|
-
class Railtie < Rails::Railtie
|
5
|
-
#railtie_name :actic
|
6
|
-
|
7
|
-
initializer "actic_railtie.configure_rails_initialization" do
|
8
|
-
end
|
9
|
-
|
10
|
-
# initializer "actic_railtie.configure_rails_initialization",
|
11
|
-
# :before => "actice_railtie.blah_init" do
|
12
|
-
#
|
13
|
-
# end
|
14
|
-
#config.autoload_paths += %W(models/calendar)
|
15
|
-
|
16
|
-
config.after_initialize do
|
17
|
-
#require "models/calendar"
|
18
|
-
#require "models/event"
|
19
|
-
#require "models/sub_component"
|
20
|
-
## inject actic methods into active record
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
config.before_eager_load do
|
25
|
-
#SomeClass.set_important_value = "RoboCop"
|
26
|
-
end
|
27
|
-
|
28
|
-
# Production only
|
29
|
-
config.to_prepare do
|
30
|
-
# MyRailtie.setup!
|
31
|
-
end
|
32
|
-
|
33
|
-
console do
|
34
|
-
# Foo.con_thing!
|
35
|
-
end
|
36
|
-
|
37
|
-
generators do
|
38
|
-
|
39
|
-
#require '../../generators/actic/actic_generator'
|
40
|
-
#require '../../generators/actic_calendar/actic_calendar_generator'
|
41
|
-
#require '../../generators/actic_subcomponent/actic_subcomponent_generator'
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
rake_tasks do
|
46
|
-
# require 'path/to/railtie.tasks'
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# after_initialize
|
53
|
-
# app_middleware
|
54
|
-
# before_configuration
|
55
|
-
# before_eager_load
|
56
|
-
# before_initialize
|
57
|
-
# generators
|
58
|
-
# method_missing
|
59
|
-
# new
|
60
|
-
# respond_to?
|
61
|
-
# to_prepare
|
62
|
-
# to_prepare_blocks
|
data/lib/actic/version.rb
DELETED
data/lib/generators/actic/USAGE
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'rails/generators/migration'
|
2
|
-
class ActicCalendarGenerator < Rails::Generators::Base
|
3
|
-
include Rails::Generators::Migration
|
4
|
-
|
5
|
-
source_root File.expand_path('../templates', __FILE__)
|
6
|
-
argument :name, :type => :string, :default => "calendar"
|
7
|
-
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type", :required => false
|
8
|
-
|
9
|
-
|
10
|
-
def self.next_migration_number(dirname)
|
11
|
-
if ActiveRecord::Base.timestamped_migrations
|
12
|
-
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
13
|
-
else
|
14
|
-
"%.3d" % (current_migration_number(dirname) + 1)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def create_migration_file
|
19
|
-
migration_template 'migration.rb.txt', "db/migrate/create_#{table_name}.rb"
|
20
|
-
end
|
21
|
-
|
22
|
-
def generate_model
|
23
|
-
if name.include? ":"
|
24
|
-
self.attributes = name
|
25
|
-
self.name = "calendar"
|
26
|
-
self.attributes = format_attributes(self.attributes)
|
27
|
-
end
|
28
|
-
template "actic_calendar.rb.txt", "app/models/#{file_name}.rb"
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
def file_name
|
33
|
-
name.underscore
|
34
|
-
end
|
35
|
-
|
36
|
-
def table_name
|
37
|
-
name.tableize
|
38
|
-
end
|
39
|
-
|
40
|
-
def format_attributes(attrs)
|
41
|
-
fat = []
|
42
|
-
a = attrs
|
43
|
-
b = a.split
|
44
|
-
b.each {|c|
|
45
|
-
d = c.split(':')
|
46
|
-
e = {:name => d[0], :type => d[1] }
|
47
|
-
fat << e
|
48
|
-
}
|
49
|
-
fat
|
50
|
-
end
|
51
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
class Create<%= table_name.camelize %> < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table(:<%= table_name %>) do |t|
|
4
|
-
t.string :ical
|
5
|
-
|
6
|
-
<% if attributes %>
|
7
|
-
<% for attribute in attributes -%>
|
8
|
-
t.<%= attribute[:type] %> :<%= attribute[:name] %>
|
9
|
-
<% end -%>
|
10
|
-
<% end -%>
|
11
|
-
|
12
|
-
t.timestamps
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.down
|
18
|
-
drop_table :<%= table_name %>
|
19
|
-
end
|
20
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class ActicSubcomponentGenerator < Rails::Generators::NamedBase
|
2
|
-
source_root File.expand_path('../templates', __FILE__)
|
3
|
-
argument :subcomponent, :type => :string, :default => "event"
|
4
|
-
argument :actic_calendar, :type => :string, :default => "calendar"
|
5
|
-
|
6
|
-
# the generator will generate different sub components based on the 'subcomponent' argument
|
7
|
-
def generate_subcomponent
|
8
|
-
if subcomponent == "event"
|
9
|
-
elsif subcomponent == "journal"
|
10
|
-
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|