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.
Files changed (49) hide show
  1. data/MIT-LICENSE +1 -1
  2. data/README.rdoc +3 -0
  3. data/Rakefile +26 -1
  4. data/lib/actic.rb +1 -177
  5. data/lib/actic/engine.rb +3 -3
  6. data/lib/app/models/alarm.rb +10 -0
  7. data/lib/app/models/calendar.rb +40 -0
  8. data/lib/app/models/component.rb +99 -0
  9. data/lib/app/models/event.rb +58 -0
  10. data/lib/app/models/free_busy.rb +3 -0
  11. data/lib/app/models/inspectable.rb +2 -0
  12. data/lib/app/models/journal.rb +4 -0
  13. data/lib/app/models/pattern.rb +7 -0
  14. data/lib/app/models/patterns/ex_date.rb +5 -0
  15. data/lib/app/models/patterns/ex_rule.rb +5 -0
  16. data/lib/app/models/patterns/r_date.rb +5 -0
  17. data/lib/app/models/patterns/r_rule.rb +5 -0
  18. data/lib/app/models/sub_calendar.rb +3 -0
  19. data/lib/app/models/todo.rb +5 -0
  20. data/lib/migrate/20101217173535_create_components.rb +87 -0
  21. data/lib/migrate/20101218062739_create_inspectables.rb +12 -0
  22. metadata +43 -38
  23. data/.DS_Store +0 -0
  24. data/.idea/.rakeTasks +0 -7
  25. data/.idea/actic.iml +0 -33
  26. data/.idea/encodings.xml +0 -5
  27. data/.idea/misc.xml +0 -8
  28. data/.idea/modules.xml +0 -9
  29. data/.idea/vcs.xml +0 -8
  30. data/.idea/workspace.xml +0 -373
  31. data/Gemfile +0 -29
  32. data/Gemfile.lock +0 -21
  33. data/README +0 -52
  34. data/actic.gemspec +0 -23
  35. data/lib/actic/models/actic_calendar.rb +0 -8
  36. data/lib/actic/models/event.rb +0 -5
  37. data/lib/actic/models/sub_component.rb +0 -5
  38. data/lib/actic/railtie.rb +0 -62
  39. data/lib/actic/version.rb +0 -3
  40. data/lib/generators/actic/USAGE +0 -8
  41. data/lib/generators/actic/actic_generator.rb +0 -3
  42. data/lib/generators/actic_calendar/USAGE +0 -8
  43. data/lib/generators/actic_calendar/actic_calendar_generator.rb +0 -51
  44. data/lib/generators/actic_calendar/templates/actic_calendar.rb.txt +0 -4
  45. data/lib/generators/actic_calendar/templates/migration.rb.txt +0 -20
  46. data/lib/generators/actic_subcomponent/USAGE +0 -8
  47. data/lib/generators/actic_subcomponent/actic_subcomponent_generator.rb +0 -13
  48. data/lib/generators/actic_subcomponent/templates/event.rb.txt +0 -2
  49. 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"
@@ -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
-
@@ -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
@@ -1,8 +0,0 @@
1
- class ActicCalendar < ActiveRecord::Base
2
- include Actic::Calendar
3
- has_many :subcomponents
4
-
5
- def responds_to_actical?
6
- true
7
- end
8
- end
@@ -1,5 +0,0 @@
1
- module Actic
2
- class Event < SubComponent
3
- belongs_to :calendar
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- module Actic
2
- class SubComponent < ActiveRecord::Base
3
- #Code here
4
- end
5
- end
@@ -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
@@ -1,3 +0,0 @@
1
- module Actic
2
- VERSION = "0.0.2"
3
- end
@@ -1,8 +0,0 @@
1
- Description:
2
- Explain the generator
3
-
4
- Example:
5
- rails generate actic Thing
6
-
7
- This will create:
8
- what/will/it/create
@@ -1,3 +0,0 @@
1
- class ActicGenerator < Rails::Generators::NamedBase
2
- source_root File.expand_path('../templates', __FILE__)
3
- end
@@ -1,8 +0,0 @@
1
- Description:
2
- Explain the generator
3
-
4
- Example:
5
- rails generate actic_calendar Thing
6
-
7
- This will create:
8
- what/will/it/create
@@ -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,4 +0,0 @@
1
- class <%= name.classify %> < ActicCalendar
2
- set_table_name :<%= table_name %>
3
- #Code here
4
- 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,8 +0,0 @@
1
- Description:
2
- Explain the generator
3
-
4
- Example:
5
- rails generate actic_subcomponent Thing
6
-
7
- This will create:
8
- what/will/it/create
@@ -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
@@ -1,2 +0,0 @@
1
- class <%= name.classify %> < Actic::Subcomponent::Event
2
- end
@@ -1,2 +0,0 @@
1
- class <%= name.classify %> < Actic::Subcomponent::Event
2
- end