engine-rea 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +40 -35
- data/VERSION +1 -1
- data/app/models/rea/categories_entity.rb +7 -0
- data/app/models/rea/category.rb +18 -7
- data/app/models/rea/classification.rb +7 -0
- data/app/models/rea/entities_group.rb +7 -0
- data/app/models/rea/group.rb +5 -17
- data/app/models/rea/rea.rb +7 -0
- data/config/locales/en.yml +2 -0
- data/config/locales/zh-CN.yml +16 -17
- data/db/migrate/20121129100245_create_rea_groups.rb +18 -0
- data/db/migrate/20121129100748_create_rea_categories.rb +19 -0
- data/db/migrate/20121129101744_create_rea_classifications.rb +29 -0
- data/db/migrate/20121130051633_create_rea_entities_groups.rb +13 -0
- data/db/migrate/20121130100600_create_rea_categories_entities.rb +13 -0
- data/engine-rea.gemspec +27 -59
- data/lib/generators/rea/install/install_generator.rb +4 -4
- data/lib/rea/active_record_ext.rb +82 -0
- data/lib/rea/application.rb +55 -21
- data/lib/rea/engine.rb +8 -2
- data/lib/rea.rb +5 -10
- data/spec/dummy/db/schema.rb +61 -1
- data/spec/models/rea/categories_entity_spec.rb +7 -0
- data/spec/models/rea/category_spec.rb +10 -19
- data/spec/models/rea/classification_spec.rb +6 -0
- data/spec/models/rea/entities_group_spec.rb +7 -0
- data/spec/models/rea/group_spec.rb +3 -35
- data/spec/rea/active_record_ext_spec.rb +35 -0
- data/spec/rea/application_spec.rb +17 -0
- data/spec/spec_helper.rb +3 -0
- metadata +40 -59
- data/app/models/rea/category_member.rb +0 -8
- data/app/models/rea/category_type.rb +0 -7
- data/app/models/rea/group_type.rb +0 -7
- data/app/models/rea/identifier.rb +0 -51
- data/app/views/layouts/rea/application.html.erb +0 -14
- data/db/migrate/20120601074531_create_rea_category_types.rb +0 -11
- data/db/migrate/20120601074540_create_rea_categories.rb +0 -12
- data/db/migrate/20120605023205_create_rea_category_members.rb +0 -12
- data/db/migrate/20120605030658_create_rea_groups.rb +0 -20
- data/db/migrate/20120605082028_create_rea_identifiers.rb +0 -11
- data/db/migrate/20120717080004_create_rea_group_types.rb +0 -7
- data/lib/rea/aspect_type/base.rb +0 -10
- data/lib/rea/aspect_type/classification.rb +0 -142
- data/lib/rea/aspect_type/description.rb +0 -8
- data/lib/rea/aspect_type/due_date.rb +0 -34
- data/lib/rea/aspect_type/identification.rb +0 -38
- data/lib/rea/aspect_type.rb +0 -33
- data/lib/rea/meta_type/agent.rb +0 -10
- data/lib/rea/meta_type/commitment.rb +0 -26
- data/lib/rea/meta_type/contract.rb +0 -32
- data/lib/rea/meta_type/conversion.rb +0 -6
- data/lib/rea/meta_type/entity.rb +0 -91
- data/lib/rea/meta_type/event.rb +0 -39
- data/lib/rea/meta_type/exchange.rb +0 -6
- data/lib/rea/meta_type/group.rb +0 -25
- data/lib/rea/meta_type/process.rb +0 -28
- data/lib/rea/meta_type/resource.rb +0 -14
- data/lib/rea/meta_type/schedule.rb +0 -0
- data/lib/rea/meta_type/type.rb +0 -0
- data/lib/rea/meta_type.rb +0 -8
- data/lib/rea/model.rb +0 -65
- data/lib/rea/plugins/active_model.rb +0 -18
- data/spec/models/rea/category_member_spec.rb +0 -9
- data/spec/models/rea/category_type_spec.rb +0 -28
- data/spec/models/rea/group_type_spec.rb +0 -8
- data/spec/models/rea/identifier_spec.rb +0 -48
- data/spec/rea/aspect_type/classification_spec.rb +0 -107
- data/spec/rea/aspect_type/due_date_spec.rb +0 -75
- data/spec/rea/aspect_type/identification_spec.rb +0 -64
- data/spec/rea/aspect_type_spec.rb +0 -44
- data/spec/rea/meta_type/agent_spec.rb +0 -28
- data/spec/rea/meta_type/commitment_spec.rb +0 -45
- data/spec/rea/meta_type/contract_spec.rb +0 -42
- data/spec/rea/meta_type/entity_spec.rb +0 -58
- data/spec/rea/meta_type/event_spec.rb +0 -21
- data/spec/rea/meta_type/group_spec.rb +0 -55
- data/spec/rea/meta_type/process_spec.rb +0 -5
- data/spec/rea/meta_type/resource_spec.rb +0 -65
- data/spec/rea/meta_type_spec.rb +0 -11
- data/spec/rea/model_spec.rb +0 -79
@@ -0,0 +1,82 @@
|
|
1
|
+
|
2
|
+
module Rea
|
3
|
+
module ActiveRecordExt
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
def grouping *args
|
11
|
+
((::Rea.metadata[:grouping_class_names] ||= []) << self.name).uniq!
|
12
|
+
@grouping_options = args.extract_options!
|
13
|
+
@grouping_options = {:group_class_name=>::Rea::Group.name,
|
14
|
+
:entities_group_class_name=>::Rea::EntitiesGroup.name}.merge @grouping_options
|
15
|
+
has_many :entities_groups, :as=>:entity, :class_name=>@grouping_options[:entities_group_class_name]
|
16
|
+
has_many :groups, :through=>:entities_groups, :class_name=>@grouping_options[:group_class_name], :uniq=>true
|
17
|
+
attr_accessible :group_ids
|
18
|
+
after_initialize do |entity|
|
19
|
+
entity.groups << entity.class.default_group if entity.new_record? && entity.group_ids.try(:empty?)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def default_group
|
25
|
+
@default_group ||=
|
26
|
+
grouping_options[:group_class_name].constantize.find_by_type_name_and_name(self.name,self.name.underscore)
|
27
|
+
end
|
28
|
+
|
29
|
+
def grouping_options
|
30
|
+
@grouping_options ||={}
|
31
|
+
end
|
32
|
+
|
33
|
+
def members
|
34
|
+
@members ||= {}
|
35
|
+
end
|
36
|
+
|
37
|
+
def naming
|
38
|
+
define_method :display_name do
|
39
|
+
if self.respond_to? :name
|
40
|
+
@display_name ||= proc do
|
41
|
+
default = name.humanize
|
42
|
+
subkey = case
|
43
|
+
when self.respond_to?(:classification)
|
44
|
+
"#{self.classification.try(:name)}.#{self.name}"
|
45
|
+
else
|
46
|
+
"#{self.name}"
|
47
|
+
end
|
48
|
+
key = "#{self.class.name.underscore}.names.#{subkey}"
|
49
|
+
I18n.t(key,:default=>default)
|
50
|
+
end.call
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def member classification, *args
|
56
|
+
((::Rea.metadata[:member_class_names] ||= []) << self.name).uniq!
|
57
|
+
grouping
|
58
|
+
$options = {:multiple=>false,
|
59
|
+
:category_class_name=>::Rea::Category.name,
|
60
|
+
:categories_entity_class_name=>::Rea::CategoriesEntity.name
|
61
|
+
}.merge(args.extract_options!)
|
62
|
+
members[classification] = $options.dup
|
63
|
+
if (args.size > 0) && (categories = args[0]).is_a?(Array)
|
64
|
+
members[classification][:categories] = categories
|
65
|
+
end
|
66
|
+
if $options[:multiple]
|
67
|
+
has_many :categories_entities, :as=>:entity, :class_name=>$options[:categories_entity_class_name]
|
68
|
+
has_many classification, :through=>:categories_entities,
|
69
|
+
:include=>:classification,
|
70
|
+
:class_name=>$options[:category_class_name],
|
71
|
+
:source=>:category,
|
72
|
+
:conditions=>"rea_classifications.type_name = '#{self.name}' and rea_classifications.name = '#{classification.to_s.singularize}'"
|
73
|
+
else
|
74
|
+
belongs_to classification, :class_name=>$options[:category_class_name]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
::ActiveRecord::Base.send :include, Rea::ActiveRecordExt
|
data/lib/rea/application.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
module Rea
|
2
2
|
class Application
|
3
3
|
include ::Rea::Settings
|
4
|
-
include ::Rea::Model
|
5
|
-
|
6
4
|
setting :load_paths, [File.expand_path('app/rea', Rails.root)]
|
7
5
|
|
8
6
|
def setup!
|
@@ -20,8 +18,9 @@ module Rea
|
|
20
18
|
|
21
19
|
def load!
|
22
20
|
return if loaded?
|
23
|
-
|
21
|
+
# Load files
|
24
22
|
files_in_load_path.each{|file| load file }
|
23
|
+
set_metadata
|
25
24
|
@@loaded = true
|
26
25
|
end
|
27
26
|
|
@@ -33,6 +32,41 @@ module Rea
|
|
33
32
|
load_paths.flatten.compact.uniq.collect{|path| Dir["#{path}/**/*.rb"] }.flatten
|
34
33
|
end
|
35
34
|
|
35
|
+
def metadata
|
36
|
+
@metadata ||= ActiveSupport::HashWithIndifferentAccess.new
|
37
|
+
end
|
38
|
+
|
39
|
+
def set_metadata
|
40
|
+
puts ENV["RAILS_ENV"]
|
41
|
+
groupings = ::Rea.metadata['grouping_class_names'] || []
|
42
|
+
members = ::Rea.metadata['member_class_names'] || []
|
43
|
+
groupings.each do |name|
|
44
|
+
begin
|
45
|
+
name.constantize.grouping_options[:group_class_name].constantize.
|
46
|
+
find_or_create_by_name_and_type_name! name.underscore, name
|
47
|
+
rescue Exception=>e
|
48
|
+
puts e
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
members.each do |name|
|
53
|
+
begin
|
54
|
+
klass = name.constantize
|
55
|
+
klass.members.each_pair do |key, value|
|
56
|
+
classification_object = ::Rea::Classification.find_or_create_by_name_and_type_name! key.to_s.underscore, name
|
57
|
+
if (categories = value[:categories])
|
58
|
+
categories.each do |category_name|
|
59
|
+
classification_object.categories.find_or_create_by_name category_name, :group_ids=>[klass.default_group.id]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
rescue Exception=>e
|
64
|
+
puts e
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
36
70
|
|
37
71
|
private
|
38
72
|
# Since we're dealing with all our own file loading, we need
|
@@ -40,11 +74,11 @@ module Rea
|
|
40
74
|
# # If not, file naming becomes very important and can cause clashes.
|
41
75
|
def remove_active_admin_load_paths_from_rails_autoload_and_eager_load
|
42
76
|
ActiveSupport::Dependencies.autoload_paths.reject!{|path|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
77
|
+
load_paths.include?(path) }
|
78
|
+
# Don't eagerload our configs, we'll deal with them ourselves
|
79
|
+
Rails.application.config.eager_load_paths = Rails.application.config.eager_load_paths.reject do |path|
|
80
|
+
load_paths.include?(path)
|
81
|
+
end
|
48
82
|
end
|
49
83
|
|
50
84
|
def attach_reloader
|
@@ -55,30 +89,30 @@ module Rea
|
|
55
89
|
attr_reader :rea_app, :rails_app, :rails_version
|
56
90
|
|
57
91
|
def initialize(rails_app, rea_app, rails_version = "3.2")
|
58
|
-
|
59
|
-
|
60
|
-
|
92
|
+
@rails_app = rails_app
|
93
|
+
@rea_app = rea_app
|
94
|
+
@rails_version = rails_version.to_s
|
61
95
|
end
|
62
96
|
|
63
97
|
def attach!
|
64
|
-
|
65
|
-
|
66
|
-
|
98
|
+
rea_app.load_paths.each do |path|
|
99
|
+
rails_app.config.watchable_dirs[path] = [:rb]
|
100
|
+
end
|
67
101
|
|
68
|
-
|
102
|
+
reloader = self
|
69
103
|
|
70
|
-
|
71
|
-
|
72
|
-
|
104
|
+
ActionDispatch::Reloader.to_prepare do
|
105
|
+
reloader.reload!
|
106
|
+
end
|
73
107
|
end
|
74
108
|
|
75
109
|
def reload!
|
76
|
-
|
77
|
-
|
110
|
+
rea_app.unload!
|
111
|
+
rea_app.load!
|
78
112
|
end
|
79
113
|
|
80
114
|
def major_rails_version
|
81
|
-
|
115
|
+
@rails_version[0..2]
|
82
116
|
end
|
83
117
|
end
|
84
118
|
|
data/lib/rea/engine.rb
CHANGED
@@ -2,8 +2,14 @@ module Rea
|
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
isolate_namespace Rea
|
4
4
|
|
5
|
-
initializer :
|
6
|
-
app.config.
|
5
|
+
initializer :rea_rails_configuration, :before=>:bootstrap_hook do |app|
|
6
|
+
app.config.before_initialize do
|
7
|
+
puts "[REA]configuration....."
|
8
|
+
app.config.i18n.load_path += Dir[::Rea::Engine.root.join('config','locales','*.{rb,yml}').to_s]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
initializer :rea_metadata_setting, :after=>:finisher_hook do |app|
|
7
13
|
end
|
8
14
|
end
|
9
15
|
end
|
data/lib/rea.rb
CHANGED
@@ -1,20 +1,15 @@
|
|
1
1
|
require "rea/engine"
|
2
|
+
require "rea/active_record_ext"
|
3
|
+
require "globalize"
|
2
4
|
|
3
5
|
require 'rails_patch'
|
4
6
|
|
5
7
|
module Rea
|
6
|
-
autoload :Model, 'rea/model'
|
7
8
|
autoload :InstallGenerator, 'generators/rea/install/install_generator'
|
8
9
|
|
9
|
-
autoload :AspectType, 'rea/aspect_type'
|
10
|
-
autoload :MetaType, 'rea/meta_type'
|
11
|
-
|
12
10
|
autoload :Settings, 'rea/settings'
|
13
11
|
autoload :Application, 'rea/application'
|
14
12
|
|
15
|
-
module Plugins
|
16
|
-
autoload :ActiveModel, 'rea/plugins/active_model'
|
17
|
-
end
|
18
13
|
|
19
14
|
class << self
|
20
15
|
|
@@ -25,13 +20,13 @@ module Rea
|
|
25
20
|
end
|
26
21
|
|
27
22
|
def setup
|
28
|
-
puts "
|
23
|
+
puts "[REA]Setup...."
|
29
24
|
application.setup!
|
30
25
|
yield(application)
|
31
26
|
application.prepare!
|
32
27
|
end
|
33
28
|
|
34
|
-
delegate :
|
35
|
-
delegate :
|
29
|
+
delegate :set_metadata, :to=>:application
|
30
|
+
delegate :metadata, :to=>:application
|
36
31
|
end
|
37
32
|
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,6 +11,66 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20121130100600) do
|
15
|
+
|
16
|
+
create_table "categories_groups", :force => true do |t|
|
17
|
+
t.integer "category_id"
|
18
|
+
t.integer "group_id"
|
19
|
+
end
|
20
|
+
|
21
|
+
add_index "categories_groups", ["category_id", "group_id"], :name => "idx_categories_groups"
|
22
|
+
|
23
|
+
create_table "rea_categories", :force => true do |t|
|
24
|
+
t.string "name"
|
25
|
+
t.integer "parent_id"
|
26
|
+
t.integer "classification_id"
|
27
|
+
t.datetime "created_at", :null => false
|
28
|
+
t.datetime "updated_at", :null => false
|
29
|
+
end
|
30
|
+
|
31
|
+
add_index "rea_categories", ["name", "classification_id"], :name => "index_rea_categories_on_name_and_classification_id", :unique => true
|
32
|
+
add_index "rea_categories", ["parent_id"], :name => "index_rea_categories_on_parent_id"
|
33
|
+
|
34
|
+
create_table "rea_categories_entities", :force => true do |t|
|
35
|
+
t.integer "entity_id"
|
36
|
+
t.string "entity_type"
|
37
|
+
t.integer "category_id"
|
38
|
+
t.datetime "created_at", :null => false
|
39
|
+
t.datetime "updated_at", :null => false
|
40
|
+
end
|
41
|
+
|
42
|
+
add_index "rea_categories_entities", ["category_id"], :name => "index_rea_categories_entities_on_category_id"
|
43
|
+
add_index "rea_categories_entities", ["entity_id"], :name => "index_rea_categories_entities_on_entity_id"
|
44
|
+
|
45
|
+
create_table "rea_classifications", :force => true do |t|
|
46
|
+
t.string "name"
|
47
|
+
t.string "type_name"
|
48
|
+
t.boolean "auto"
|
49
|
+
t.datetime "created_at", :null => false
|
50
|
+
t.datetime "updated_at", :null => false
|
51
|
+
end
|
52
|
+
|
53
|
+
add_index "rea_classifications", ["name", "type_name"], :name => "index_rea_classifications_on_name_and_type_name"
|
54
|
+
|
55
|
+
create_table "rea_entities_groups", :force => true do |t|
|
56
|
+
t.integer "entity_id"
|
57
|
+
t.string "entity_type"
|
58
|
+
t.integer "group_id"
|
59
|
+
t.datetime "created_at", :null => false
|
60
|
+
t.datetime "updated_at", :null => false
|
61
|
+
end
|
62
|
+
|
63
|
+
add_index "rea_entities_groups", ["entity_id"], :name => "index_rea_entities_groups_on_entity_id"
|
64
|
+
add_index "rea_entities_groups", ["group_id"], :name => "index_rea_entities_groups_on_group_id"
|
65
|
+
|
66
|
+
create_table "rea_groups", :force => true do |t|
|
67
|
+
t.string "name"
|
68
|
+
t.string "type_name"
|
69
|
+
t.integer "parent_id"
|
70
|
+
t.datetime "created_at", :null => false
|
71
|
+
t.datetime "updated_at", :null => false
|
72
|
+
end
|
73
|
+
|
74
|
+
add_index "rea_groups", ["parent_id"], :name => "index_rea_groups_on_parent_id"
|
15
75
|
|
16
76
|
end
|
@@ -1,23 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
|
3
|
-
describe
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
context :instance do
|
15
|
-
subject { Rea::Category.last }
|
16
|
-
before :all do
|
17
|
-
subject.category_members.create!
|
2
|
+
module Rea
|
3
|
+
describe Category do
|
4
|
+
context :basic do
|
5
|
+
let(:classification){Classification.create :name=>:classification_basic}
|
6
|
+
subject {Category.create :name=>:catgory_basic, :classification_id=>classification.id}
|
7
|
+
before :all do
|
8
|
+
subject.groups.create :name=>:group_basic
|
9
|
+
end
|
10
|
+
|
11
|
+
its(:groups) { should have(1).items}
|
18
12
|
end
|
19
|
-
|
20
|
-
its(:category_members) { should have(1).items }
|
21
13
|
end
|
22
|
-
|
23
14
|
end
|
@@ -1,38 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
|
3
|
-
describe
|
4
|
-
|
5
|
-
subject { described_class.reflect_on_all_associations.map(&:name) }
|
6
|
-
it { should include :group_type }
|
7
|
-
it { should include :categories }
|
8
|
-
it { should include :category_types }
|
9
|
-
end
|
10
|
-
|
11
|
-
context :model do
|
12
|
-
context :categories do
|
13
|
-
subject { described_class.create! :name=>:group }
|
14
|
-
|
15
|
-
it { should_not be_nil }
|
16
|
-
it :could_relate_category do
|
17
|
-
category = Rea::Category.create :name=>:category
|
18
|
-
expect {
|
19
|
-
subject.categories << category
|
20
|
-
}.to change { category.groups.count }.by(1)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context :category_types do
|
25
|
-
let(:category_type){Rea::CategoryType.create :name=>:type}
|
26
|
-
let(:category) { category_type.categories.create :name=>:category }
|
27
|
-
|
28
|
-
subject { described_class.create! :name=>:group }
|
29
|
-
|
30
|
-
before :each do
|
31
|
-
subject.categories = [category]
|
32
|
-
end
|
33
|
-
|
34
|
-
its(:category_types) { should have(1).items }
|
35
|
-
its(:category_types) { should include category_type }
|
36
|
-
end
|
2
|
+
module Rea
|
3
|
+
describe Group do
|
4
|
+
pending "add some examples to (or delete) #{__FILE__}"
|
37
5
|
end
|
38
6
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Rea
|
4
|
+
|
5
|
+
describe ActiveRecordExt do
|
6
|
+
|
7
|
+
with_model :Resource do
|
8
|
+
table do |t|
|
9
|
+
t.references :category_a
|
10
|
+
end
|
11
|
+
model do
|
12
|
+
grouping
|
13
|
+
member :category_a
|
14
|
+
member :category_bs, :multiple=>true
|
15
|
+
member :category_c, [:option1, :option2]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:resource){Resource.create}
|
20
|
+
subject { resource }
|
21
|
+
before(:each) do
|
22
|
+
::Rea.application.unload!
|
23
|
+
::Rea.application.load!
|
24
|
+
end
|
25
|
+
|
26
|
+
it {ActiveRecord::Base.included_modules.should include ActiveRecordExt}
|
27
|
+
|
28
|
+
it { should respond_to :category_a }
|
29
|
+
it { should respond_to :category_bs }
|
30
|
+
its(:category_bs) { should have(0).items }
|
31
|
+
it(:category) { Category.for(subject, :category_c).should have(2).items }
|
32
|
+
it(:member_class_names) {::Rea.metadata[:member_class_names].should have(1).items }
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -5,4 +5,21 @@ describe Rea::Application do
|
|
5
5
|
subject { Rea.application }
|
6
6
|
|
7
7
|
its(:load_paths) { should have(1).items }
|
8
|
+
|
9
|
+
context :set_metadata do
|
10
|
+
with_model :Resource do
|
11
|
+
table do |t|
|
12
|
+
end
|
13
|
+
model do
|
14
|
+
member :cate_a
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
before :each do
|
19
|
+
subject.unload!
|
20
|
+
subject.load!
|
21
|
+
end
|
22
|
+
it(:classification) {Rea::Classification.where(:type_name=>Resource.name).count == 1}
|
23
|
+
it(:group) {Rea::Group.count == 1}
|
24
|
+
end
|
8
25
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engine-rea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.
|
21
|
+
version: 3.2.8
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.2.
|
29
|
+
version: 3.2.8
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: capybara
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 0.4.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: globalize3
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: database_cleaner
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,7 +140,7 @@ dependencies:
|
|
124
140
|
- !ruby/object:Gem::Version
|
125
141
|
version: 2.8.0
|
126
142
|
- !ruby/object:Gem::Dependency
|
127
|
-
name: sqlite3
|
143
|
+
name: sqlite3
|
128
144
|
requirement: !ruby/object:Gem::Requirement
|
129
145
|
none: false
|
130
146
|
requirements:
|
@@ -274,6 +290,7 @@ extensions: []
|
|
274
290
|
extra_rdoc_files:
|
275
291
|
- README.md
|
276
292
|
files:
|
293
|
+
- .rspec
|
277
294
|
- .watchr
|
278
295
|
- Gemfile
|
279
296
|
- Gemfile.lock
|
@@ -286,51 +303,29 @@ files:
|
|
286
303
|
- app/assets/stylesheets/rea/application.css
|
287
304
|
- app/controllers/rea/application_controller.rb
|
288
305
|
- app/helpers/rea/application_helper.rb
|
306
|
+
- app/models/rea/categories_entity.rb
|
289
307
|
- app/models/rea/category.rb
|
290
|
-
- app/models/rea/
|
291
|
-
- app/models/rea/
|
308
|
+
- app/models/rea/classification.rb
|
309
|
+
- app/models/rea/entities_group.rb
|
292
310
|
- app/models/rea/group.rb
|
293
|
-
- app/models/rea/
|
294
|
-
- app/models/rea/identifier.rb
|
295
|
-
- app/views/layouts/rea/application.html.erb
|
311
|
+
- app/models/rea/rea.rb
|
296
312
|
- config/locales/en.yml
|
297
313
|
- config/locales/zh-CN.yml
|
298
314
|
- config/routes.rb
|
299
|
-
- db/migrate/
|
300
|
-
- db/migrate/
|
301
|
-
- db/migrate/
|
302
|
-
- db/migrate/
|
303
|
-
- db/migrate/
|
304
|
-
- db/migrate/20120717080004_create_rea_group_types.rb
|
315
|
+
- db/migrate/20121129100245_create_rea_groups.rb
|
316
|
+
- db/migrate/20121129100748_create_rea_categories.rb
|
317
|
+
- db/migrate/20121129101744_create_rea_classifications.rb
|
318
|
+
- db/migrate/20121130051633_create_rea_entities_groups.rb
|
319
|
+
- db/migrate/20121130100600_create_rea_categories_entities.rb
|
305
320
|
- engine-rea.gemspec
|
306
321
|
- lib/engine-rea.rb
|
307
322
|
- lib/generators/rea/install/USAGE
|
308
323
|
- lib/generators/rea/install/install_generator.rb
|
309
324
|
- lib/rails_patch.rb
|
310
325
|
- lib/rea.rb
|
326
|
+
- lib/rea/active_record_ext.rb
|
311
327
|
- lib/rea/application.rb
|
312
|
-
- lib/rea/aspect_type.rb
|
313
|
-
- lib/rea/aspect_type/base.rb
|
314
|
-
- lib/rea/aspect_type/classification.rb
|
315
|
-
- lib/rea/aspect_type/description.rb
|
316
|
-
- lib/rea/aspect_type/due_date.rb
|
317
|
-
- lib/rea/aspect_type/identification.rb
|
318
328
|
- lib/rea/engine.rb
|
319
|
-
- lib/rea/meta_type.rb
|
320
|
-
- lib/rea/meta_type/agent.rb
|
321
|
-
- lib/rea/meta_type/commitment.rb
|
322
|
-
- lib/rea/meta_type/contract.rb
|
323
|
-
- lib/rea/meta_type/conversion.rb
|
324
|
-
- lib/rea/meta_type/entity.rb
|
325
|
-
- lib/rea/meta_type/event.rb
|
326
|
-
- lib/rea/meta_type/exchange.rb
|
327
|
-
- lib/rea/meta_type/group.rb
|
328
|
-
- lib/rea/meta_type/process.rb
|
329
|
-
- lib/rea/meta_type/resource.rb
|
330
|
-
- lib/rea/meta_type/schedule.rb
|
331
|
-
- lib/rea/meta_type/type.rb
|
332
|
-
- lib/rea/model.rb
|
333
|
-
- lib/rea/plugins/active_model.rb
|
334
329
|
- lib/rea/settings.rb
|
335
330
|
- lib/tasks/cucumber.rake
|
336
331
|
- lib/tasks/rea_tasks.rake
|
@@ -372,28 +367,14 @@ files:
|
|
372
367
|
- spec/dummy/script/rails
|
373
368
|
- spec/factories/rea_resources.rb
|
374
369
|
- spec/generators/rea/install/install_generator_spec.rb
|
375
|
-
- spec/models/rea/
|
370
|
+
- spec/models/rea/categories_entity_spec.rb
|
376
371
|
- spec/models/rea/category_spec.rb
|
377
|
-
- spec/models/rea/
|
372
|
+
- spec/models/rea/classification_spec.rb
|
373
|
+
- spec/models/rea/entities_group_spec.rb
|
378
374
|
- spec/models/rea/group_spec.rb
|
379
|
-
- spec/
|
380
|
-
- spec/models/rea/identifier_spec.rb
|
375
|
+
- spec/rea/active_record_ext_spec.rb
|
381
376
|
- spec/rea/application_spec.rb
|
382
|
-
- spec/rea/aspect_type/classification_spec.rb
|
383
|
-
- spec/rea/aspect_type/due_date_spec.rb
|
384
|
-
- spec/rea/aspect_type/identification_spec.rb
|
385
|
-
- spec/rea/aspect_type_spec.rb
|
386
377
|
- spec/rea/engine_spec.rb
|
387
|
-
- spec/rea/meta_type/agent_spec.rb
|
388
|
-
- spec/rea/meta_type/commitment_spec.rb
|
389
|
-
- spec/rea/meta_type/contract_spec.rb
|
390
|
-
- spec/rea/meta_type/entity_spec.rb
|
391
|
-
- spec/rea/meta_type/event_spec.rb
|
392
|
-
- spec/rea/meta_type/group_spec.rb
|
393
|
-
- spec/rea/meta_type/process_spec.rb
|
394
|
-
- spec/rea/meta_type/resource_spec.rb
|
395
|
-
- spec/rea/meta_type_spec.rb
|
396
|
-
- spec/rea/model_spec.rb
|
397
378
|
- spec/spec_helper.rb
|
398
379
|
homepage: http://github.com/lazing/engine-rea
|
399
380
|
licenses:
|
@@ -410,7 +391,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
410
391
|
version: '0'
|
411
392
|
segments:
|
412
393
|
- 0
|
413
|
-
hash: -
|
394
|
+
hash: -397424799
|
414
395
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
415
396
|
none: false
|
416
397
|
requirements:
|
@@ -419,7 +400,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
419
400
|
version: '0'
|
420
401
|
requirements: []
|
421
402
|
rubyforge_project:
|
422
|
-
rubygems_version: 1.8.
|
403
|
+
rubygems_version: 1.8.24
|
423
404
|
signing_key:
|
424
405
|
specification_version: 3
|
425
406
|
summary: Rails Engine for MDA pattern Resource Event Agent
|