fabulator-exhibit 0.0.2 → 0.0.3

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/History.txt CHANGED
@@ -1,7 +1,7 @@
1
- === 0.0.1 2010-03-01
1
+ === 0.0.3 2010-09-07
2
2
 
3
3
  * 1 major enhancement:
4
- * Initial release
4
+ * Works with Fabulator 0.0.7 and later
5
5
 
6
6
  === 0.0.2
7
7
 
@@ -12,3 +12,9 @@
12
12
 
13
13
  * 1 minor enhancement:
14
14
  * Document dependence on uuid gem in gem spec
15
+
16
+ === 0.0.1 2010-03-01
17
+
18
+ * 1 major enhancement:
19
+ * Initial release
20
+
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ begin
7
7
  gem.email = "jgsmith@tamu.edu"
8
8
  gem.homepage = "http://github.com/jgsmith/ruby-fabulator-exhibit"
9
9
  gem.authors = ["James Smith"]
10
- gem.add_dependency('fabulator', '>= 0.0.1')
10
+ gem.add_dependency('fabulator', '>= 0.0.7')
11
11
  gem.add_dependency('uuid', '>= 2.1.0')
12
12
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
13
13
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -59,7 +59,7 @@ When /I unify the types? (.*)/ do |ts|
59
59
  pn = t.split(/:/, 2)
60
60
  [ @context.get_ns(pn[0]), pn[1] ]
61
61
  }
62
- @type_result = Fabulator::ActionLib.unify_types(
62
+ @type_result = Fabulator::TagLib.unify_types(
63
63
  types.collect { |t|
64
64
  pn = t.split(/:/, 2)
65
65
  [ @context.get_ns(pn[0]), pn[1] ]
@@ -10,7 +10,8 @@ Given /the statemachine/ do |doc_xml|
10
10
 
11
11
  @parser ||= Fabulator::Expr::Parser.new
12
12
  if @sm.nil?
13
- @sm = Fabulator::Core::StateMachine.new.compile_xml(doc, @context)
13
+ @sm = Fabulator::Core::StateMachine.new
14
+ @sm.compile_xml(doc, @context)
14
15
  else
15
16
  @sm.compile_xml(doc, @context)
16
17
  end
@@ -1,20 +1,18 @@
1
-
2
1
  module Fabulator
3
2
  EXHIBIT_NS = "http://dh.tamu.edu/ns/fabulator/exhibit/1.0#"
4
3
 
5
- require 'fabulator/exhibit/actions/item'
6
- require 'fabulator/exhibit/actions/property'
7
- require 'fabulator/exhibit/actions/type'
8
- require 'fabulator/exhibit/actions/value'
4
+ require 'fabulator/exhibit/actions/item'
5
+ require 'fabulator/exhibit/actions/property'
6
+ require 'fabulator/exhibit/actions/type'
7
+ require 'fabulator/exhibit/actions/value'
9
8
 
10
9
  module Exhibit
11
10
  module Actions
12
- class Lib
13
- include Fabulator::ActionLib
11
+ class Lib < Fabulator::TagLib
14
12
 
15
13
  @@databases = { }
16
14
 
17
- register_namespace EXHIBIT_NS
15
+ namespace EXHIBIT_NS
18
16
 
19
17
  action 'database', Database
20
18
  action 'item', Item
@@ -16,24 +16,24 @@ module Fabulator
16
16
 
17
17
  def run(context, autovivify = false)
18
18
  @context.with(context) do |ctx|
19
- items = @select.run(ctx)
19
+ items = self.select(ctx)
20
20
 
21
21
  db = @database.run(ctx).first.to_s
22
22
 
23
23
  items.each do |item|
24
24
  info = Fabulator::Exhibit::Actions::Lib.accumulate_item_info do
25
- @actions.run(ctx.with_root(item))
25
+ self.run_actions(ctx.with_root(item))
26
26
  end
27
27
  info['id'] = (@id.run(ctx.with_root(item)).first.to_s rescue nil)
28
- if @mode == 'add'
28
+ if self.mode == 'add'
29
29
  if info['id'].nil?
30
30
  @@uuid ||= UUID.new
31
31
  info['id'] = @@uuid.generate(:compact)
32
32
  end
33
- info['type'] = @type.run(ctx.with_root(item)).first.to_s
34
- info['label'] = @label.run(ctx.with_root(item)).first.to_s
33
+ info['type'] = self.type(ctx.with_root(item)).first.to_s
34
+ info['label'] = self.label(ctx.with_root(item)).first.to_s
35
35
  Fabulator::Exhibit::Actions::Lib.add_info(db, :items, info)
36
- elsif @mode == 'remove' && !info['id'].nil?
36
+ elsif self.mode == 'remove' && !info['id'].nil?
37
37
  Fabulator::Exhibit::Actions::Lib.remove_info(db, :items, info['id'])
38
38
  end
39
39
  end
@@ -52,15 +52,15 @@ module Fabulator
52
52
  def run(context, autovivify = false)
53
53
  ret = [ ]
54
54
  @context.with(context) do |ctx|
55
- nom = @database.run(ctx).first.to_s
56
- mode = @mode.run(ctx).first.to_s
57
- scope_type = (@scope_type.run(ctx).first.to_s rescue nil)
55
+ nom = self.database(ctx).first.to_s
56
+ m = self.mode(ctx).first.to_s
57
+ scopeType = (self.scope_type(ctx).first.to_s rescue nil)
58
58
  db = nil
59
- if mode == 'merge' || !scope_type.nil?
59
+ if m == 'merge' || !scopeType.nil?
60
60
  db = Fabulator::Exhibit::Actions::Lib.fetch_database(nom)
61
- if !db.nil? && mode == 'overwrite' # !scope_type.nil? is a consequence
61
+ if !db.nil? && m == 'overwrite' # !scope_type.nil? is a consequence
62
62
  # remove any items of scope_type
63
- db[:items].delete_if{ |k,v| v['type'] == scope_type }
63
+ db[:items].delete_if{ |k,v| v['type'] == scopeType }
64
64
  end
65
65
  end
66
66
  if db.nil?
@@ -69,7 +69,7 @@ module Fabulator
69
69
  Fabulator::Exhibit::Actions::Lib.set_database(nom, db)
70
70
 
71
71
  begin
72
- ret = @actions.run(ctx)
72
+ ret = self.run_actions(ctx)
73
73
  ensure
74
74
  Fabulator::Exhibit::Actions::Lib.store_database(
75
75
  nom,
@@ -10,10 +10,10 @@ module Fabulator
10
10
  def run(context, autovivify = false)
11
11
  @context.with(context) do |ctx|
12
12
  Fabulator::Exhibit::Actions::Lib.add_info(
13
- @database.run(ctx).first.to_s,
13
+ self.database(ctx).first.to_s,
14
14
  :properties, {
15
- 'id' => @name.run(ctx).first.to_s,
16
- 'valueType' => @valueType.run(ctx).first.to_s
15
+ 'id' => self.name(ctx).first.to_s,
16
+ 'valueType' => self.valueType(ctx).first.to_s
17
17
  }
18
18
  )
19
19
  end
@@ -10,12 +10,13 @@ module Fabulator
10
10
 
11
11
  def run(context, autovivify = false)
12
12
  @context.with(context) do |ctx|
13
- info = { :id => @name.run(ctx).first.to_s }
14
- if !@pluralLabel.nil?
15
- info['pluralLabel'] = @pluralLabel.run(ctx).first.to_s
13
+ info = { :id => self.name(ctx).first.to_s }
14
+ pl = (self.pluralLabel(ctx).first.to_s rescue nil)
15
+ if !pl.nil?
16
+ info['pluralLabel'] = pl
16
17
  end
17
18
  Fabulator::Exhibit::Actions::Lib.add_info(
18
- @database.run(ctx).first.to_s, :types, info
19
+ self.database(ctx).first.to_s, :types, info
19
20
  )
20
21
  end
21
22
  end
@@ -11,8 +11,8 @@ module Fabulator
11
11
  def run(context, autovivify = false)
12
12
  @context.with(context) do |ctx|
13
13
  Fabulator::Exhibit::Actions::Lib.add_item_to_accumulator(
14
- @name.run(ctx).first.to_s,
15
- @select.run(ctx).collect{ |s| s.value }
14
+ self.name(ctx).first.to_s,
15
+ self.select(ctx).collect{ |s| s.value }
16
16
  )
17
17
  end
18
18
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fabulator-exhibit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Smith
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-10 00:00:00 +00:00
18
+ date: 2010-09-07 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 29
29
+ hash: 17
30
30
  segments:
31
31
  - 0
32
32
  - 0
33
- - 1
34
- version: 0.0.1
33
+ - 7
34
+ version: 0.0.7
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency