activityutils 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -3,4 +3,9 @@ Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
5
  lib/activityutils.rb
6
+ lib/activityutils/models.rb
7
+ lib/activityutils/schema.rb
8
+ lib/activityutils/server.rb
9
+ lib/activityutils/server/public/style.css
10
+ lib/activityutils/server/views/index.erb
6
11
  lib/activityutils/version.rb
data/README.md CHANGED
@@ -11,8 +11,93 @@ activityutils gems - activity (timeline) utilities
11
11
 
12
12
  TBD
13
13
 
14
+
14
15
  ## Alternatives
15
16
 
17
+
18
+ ### Database Schemas
19
+
20
+ ~~~
21
+ create_table :activity_engine_activities do |t|
22
+ t.integer :user_id
23
+ t.string :subject_type, index: true, null: false
24
+ t.string :subject_id, index: true, null: false
25
+ t.string :activity_type, index: true, null: false
26
+ t.text :message
27
+ t.timestamps
28
+ end
29
+ ~~~
30
+
31
+ (source: [ndlib/activity_engine](https://github.com/ndlib/activity_engine/blob/master/db/migrate/20130722162331_create_activity_engine_activities.rb))
32
+
33
+ ~~~
34
+ create_table :activities do |t|
35
+ t.integer :user_id, :limit => 10
36
+ t.string :action, :limit => 50
37
+ t.integer :item_id, :limit => 10
38
+ t.string :item_type
39
+ t.datetime :created_at
40
+ end
41
+ ~~~
42
+
43
+ (source: [bborn/communityengine](https://github.com/bborn/communityengine/blob/master/db/migrate/039_create_activities_table.rb))
44
+
45
+ ~~~
46
+ create_table :activities do |t|
47
+ t.references :user # who performed the activity
48
+ t.boolean :public, :default => true
49
+ t.integer :item_id # which item was the activity performed on
50
+ t.string :item_type # what type of item was it (photo, user, blog_post, etc)
51
+ t.string :action # what action was performed on the item (create, destroy, update, etc)
52
+ t.timestamps
53
+ end
54
+ ~~~
55
+
56
+ (source: [timothyf/EngineY](https://github.com/timothyf/EngineY/blob/master/db/migrate/20090116165201_create_activities.rb))
57
+
58
+
59
+ ~~~
60
+ create_table :activities do |t|
61
+ t.integer :person_id
62
+ t.boolean :public
63
+ t.integer :item_id
64
+ t.string :item_type
65
+ t.timestamps
66
+ end
67
+ ~~~
68
+
69
+ (source: [insoshi/insoshi](https://github.com/insoshi/insoshi/blob/master/db/migrate/010_create_events_and_feed.rb))
70
+
71
+
72
+ ~~~
73
+ create_table :activities do |t|
74
+ t.belongs_to :trackable, :polymorphic => true
75
+ t.belongs_to :owner, :polymorphic => true
76
+ t.string :key
77
+ t.text :parameters
78
+ t.belongs_to :recipient, :polymorphic => true
79
+ t.timestamps
80
+ end
81
+ ~~~
82
+
83
+ (source: [pokonski/public_activity](https://github.com/pokonski/public_activity/blob/master/lib/generators/public_activity/migration/templates/migration.rb))
84
+
85
+ ~~~
86
+ create_table :activity_logs do |t|
87
+ t.integer :user_id
88
+ t.integer :loggable_id
89
+ t.string :loggable_type
90
+ t.string :action
91
+ t.integer :parent_activity_id
92
+ t.string :action_type
93
+ t.text :data
94
+ t.timestamps
95
+ end
96
+ ~~~
97
+
98
+ (source: [JonErikDSuero/activitylog](https://github.com/JonErikDSuero/activitylog/blob/master/lib/generators/activity_log/templates/create_activity_logs.rb))
99
+
100
+
16
101
  TBD
17
102
 
18
103
  ## License
data/lib/activityutils.rb CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  require 'activityutils/version' # let it always go first
4
4
 
5
+ require 'activityutils/schema'
6
+ require 'activityutils/models'
7
+
5
8
 
6
9
  module ActivityUtils
7
10
 
@@ -9,12 +12,6 @@ module ActivityUtils
9
12
  "activityutils/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
10
13
  end
11
14
 
12
- =begin
13
- def self.root
14
- "#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
15
- end
16
- =end
17
-
18
15
  end # module ActivityUtils
19
16
 
20
17
 
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ module ActivityDb
4
+ module Models
5
+
6
+
7
+ class Activity < ActiveRecord::Base
8
+
9
+ self.table_name = 'activities'
10
+
11
+
12
+ end # class Activity
13
+
14
+
15
+ end # module Models
16
+ end # module ActivityDb
17
+
@@ -0,0 +1,35 @@
1
+ module ActivityDb
2
+
3
+ class CreateDb < ActiveRecord::Migration
4
+
5
+ def up
6
+
7
+ create_table :activities do |t|
8
+ t.integer :user_id # references user
9
+
10
+ t.integer :trackable_id
11
+ t.string :trackable_type # is polymorphic
12
+
13
+ t.string :action # holds only create|update|delete - for trackable record
14
+
15
+ ## optional free form (free text) activity -- make it into a table of its own? why? why not?
16
+ # why - keeps render uniform
17
+ # why not - creates an extra record/model/table
18
+
19
+ t.text :text # optional - text to render
20
+ t.string :tmpl # optional - template key
21
+
22
+ ### t.string :params - add parameters column - why ?? why not??
23
+
24
+ t.timestamps # - only need created-at - supposed no changes e.g. no modified_at
25
+ end
26
+
27
+ end # method up
28
+
29
+ def down
30
+ raise ActiveRecord::IrreversibleMigration
31
+ end
32
+
33
+ end # class CreateDb
34
+
35
+ end # module ActivityDb
@@ -0,0 +1,59 @@
1
+ ######
2
+ # NB: use rackup to startup Sinatra service (see config.ru)
3
+ #
4
+ # e.g. config.ru:
5
+ # require './boot'
6
+ # run ActivityDb::Server
7
+
8
+
9
+ # 3rd party libs/gems
10
+
11
+ require 'sinatra/base'
12
+
13
+ # our own code
14
+
15
+ require 'logutils'
16
+
17
+
18
+ module ActivityDb
19
+
20
+ class Server < Sinatra::Base
21
+
22
+ def self.banner
23
+ "activitydb-server #{ActivityUtils::VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] on Sinatra/#{Sinatra::VERSION} (#{ENV['RACK_ENV']})"
24
+ end
25
+
26
+ def self.root
27
+ "#{File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )}"
28
+ end
29
+
30
+ PUBLIC_FOLDER = "#{root}/lib/activityutils/server/public"
31
+ VIEWS_FOLDER = "#{root}/lib/activityutils/server/views"
32
+
33
+ puts "[boot] activitydb - setting public folder to: #{PUBLIC_FOLDER}"
34
+ puts "[boot] activitydb - setting views folder to: #{VIEWS_FOLDER}"
35
+
36
+ set :public_folder, PUBLIC_FOLDER # set up the static dir (with images/js/css inside)
37
+ set :views, VIEWS_FOLDER # set up the views dir
38
+
39
+ set :static, true # set up static file routing
40
+
41
+
42
+ #####################
43
+ # Models
44
+
45
+ include ActivityDb::Models
46
+
47
+ ##############################################
48
+ # Controllers / Routing / Request Handlers
49
+
50
+ get '/' do
51
+ erb :index
52
+ end
53
+
54
+ end # class Server
55
+ end # module ActivityDb
56
+
57
+
58
+ # say hello
59
+ puts ActivityDb::Server.banner
@@ -0,0 +1,3 @@
1
+
2
+ /* add styles here */
3
+
@@ -0,0 +1,7 @@
1
+
2
+ <!-- timeline -->
3
+
4
+ <p>
5
+ timeline goes here
6
+ </p>
7
+
@@ -1,4 +1,4 @@
1
1
 
2
2
  module ActivityUtils
3
- VERSION = '0.0.1'
3
+ VERSION = '0.1.0'
4
4
  end
metadata CHANGED
@@ -1,76 +1,70 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activityutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Gerald Bauer
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-10-31 00:00:00.000000000 Z
12
+ date: 2013-11-01 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: logutils
15
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &69327590 !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0.5'
20
22
  type: :runtime
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ! '>='
25
- - !ruby/object:Gem::Version
26
- version: '0.5'
24
+ version_requirements: *69327590
27
25
  - !ruby/object:Gem::Dependency
28
26
  name: rdoc
29
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &69327310 !ruby/object:Gem::Requirement
28
+ none: false
30
29
  requirements:
31
30
  - - ~>
32
31
  - !ruby/object:Gem::Version
33
- version: '4.0'
32
+ version: '3.10'
34
33
  type: :development
35
34
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '4.0'
35
+ version_requirements: *69327310
41
36
  - !ruby/object:Gem::Dependency
42
37
  name: hoe
43
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &69327070 !ruby/object:Gem::Requirement
39
+ none: false
44
40
  requirements:
45
41
  - - ~>
46
42
  - !ruby/object:Gem::Version
47
- version: '3.6'
43
+ version: '3.3'
48
44
  type: :development
49
45
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: '3.6'
46
+ version_requirements: *69327070
55
47
  description: activityutils - activity (timeline) utilities
56
48
  email: webslideshow@googlegroups.com
57
49
  executables: []
58
50
  extensions: []
59
51
  extra_rdoc_files:
60
- - History.md
61
52
  - Manifest.txt
62
- - README.md
63
53
  files:
64
54
  - History.md
65
55
  - Manifest.txt
66
56
  - README.md
67
57
  - Rakefile
68
58
  - lib/activityutils.rb
59
+ - lib/activityutils/models.rb
60
+ - lib/activityutils/schema.rb
61
+ - lib/activityutils/server.rb
62
+ - lib/activityutils/server/public/style.css
63
+ - lib/activityutils/server/views/index.erb
69
64
  - lib/activityutils/version.rb
70
65
  homepage: https://github.com/rubylibs/activityutils
71
66
  licenses:
72
67
  - Public Domain
73
- metadata: {}
74
68
  post_install_message:
75
69
  rdoc_options:
76
70
  - --main
@@ -78,19 +72,21 @@ rdoc_options:
78
72
  require_paths:
79
73
  - lib
80
74
  required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
81
76
  requirements:
82
77
  - - ! '>='
83
78
  - !ruby/object:Gem::Version
84
79
  version: 1.9.2
85
80
  required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
86
82
  requirements:
87
83
  - - ! '>='
88
84
  - !ruby/object:Gem::Version
89
85
  version: '0'
90
86
  requirements: []
91
87
  rubyforge_project: activityutils
92
- rubygems_version: 2.1.9
88
+ rubygems_version: 1.8.17
93
89
  signing_key:
94
- specification_version: 4
90
+ specification_version: 3
95
91
  summary: activityutils - activity (timeline) utilities
96
92
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 0ae2108f2bbee31c82fc29c69cfcac8cd1affeda
4
- data.tar.gz: 034bc659e821dc98f6133aa2062596baea3ceab2
5
- SHA512:
6
- metadata.gz: d3d50b2dc791e841907d000ac2e6eb618731018701a6c80cfdd5bed9b91651a091e679e1fa4a157d9609c2082943aa1b076e9fbd074728d53b7e6611068b62da
7
- data.tar.gz: 240b158f8ff62f4f77d936ae597fd8de944be7c1036766f6f3c662318bdd7a2297de365efa127c2e87fda21785767fbe695bdb4af337a0ff938eabcf9a9a8542