Permalink
Browse files

Update to Pacer 1.0 and release

  • Loading branch information...
1 parent c36911e commit 8334f8a14762ca0d9a7df027f7c7691ec0db8325 Darrick Wiebe committed Sep 4, 2012
Showing with 31 additions and 185 deletions.
  1. +12 −3 Rakefile
  2. +0 −4 lib/pacer-dex.rb
  3. +0 −36 lib/pacer-dex/edge.rb
  4. +11 −114 lib/pacer-dex/graph.rb
  5. +0 −7 lib/pacer-dex/index.rb
  6. +0 −2 lib/pacer-dex/rspec.rb
  7. +4 −3 lib/pacer-dex/version.rb
  8. +0 −12 lib/pacer-dex/vertex.rb
  9. +1 −1 pacer-dex.gemspec
  10. +3 −3 pom.xml
View
@@ -4,7 +4,6 @@ Bundler::GemHelper.install_tasks
file 'pom.xml' => 'lib/pacer-dex/version.rb' do
pom = File.read 'pom.xml'
when_writing('Update pom.xml version number') do
- updated = false
open 'pom.xml', 'w' do |f|
pom.each_line do |line|
line.sub!(%r{<gem.version>.*</gem.version>}, "<gem.version>#{ Pacer::Dex::VERSION }</gem.version>")
@@ -22,5 +21,15 @@ file Pacer::Dex::JAR_PATH => 'pom.xml' do
end
end
-task :build => Pacer::Dex::JAR_PATH
-task :install => Pacer::Dex::JAR_PATH
+task :note do
+ puts "NOTE: touch lib/pacer-neo4j/version.rb (or rake touch) to force everything to rebuild"
+end
+
+task :build => [:note, Pacer::Dex::JAR_PATH]
+task :install => [:note, Pacer::Dex::JAR_PATH]
+
+desc 'Touch version.rb so that the jar rebuilds'
+task :touch do
+ system 'touch', 'lib/pacer-neo4j/version.rb'
+end
+
View
@@ -3,8 +3,4 @@
require 'pacer'
require Pacer::Dex::JAR
-require 'pacer-dex/vertex'
-require 'pacer-dex/edge'
-require 'pacer-dex/index'
require 'pacer-dex/graph'
-require 'pacer-dex/rspec' if defined? RSpec
View
@@ -1,36 +0,0 @@
-require 'yaml'
-
-module Pacer
- DexEdge = com.tinkerpop.blueprints.pgm.impls.dex.DexEdge
-
- # Extend the java class imported from blueprints.
- class DexEdge
- include Pacer::Core::Graph::EdgesRoute
- include ElementMixin
- include EdgeMixin
-
- def in_vertex(extensions = nil)
- v = inVertex
- v.graph = graph
- if extensions.is_a? Enumerable
- v.add_extensions extensions
- elsif extensions
- v.add_extensions [extensions]
- else
- v
- end
- end
-
- def out_vertex(extensions = nil)
- v = outVertex
- v.graph = graph
- if extensions.is_a? Enumerable
- v.add_extensions extensions
- elsif extensions
- v.add_extensions [extensions]
- else
- v
- end
- end
- end
-end
View
@@ -1,126 +1,23 @@
-require 'yaml'
-
module Pacer
- DexGraph = com.tinkerpop.blueprints.pgm.impls.dex.DexGraph
- DexElement = com.tinkerpop.blueprints.pgm.impls.dex.DexElement
-
- # Add 'static methods' to the Pacer namespace.
class << self
# Return a graph for the given path. Will create a graph if none exists at
# that location. (The graph is only created if data is actually added to it).
def dex(path)
+ dex = com.tinkerpop.blueprints.impls.dex.DexGraph
path = File.expand_path(path)
- Pacer.starting_graph(self, path) do
- DexGraph.new(path)
- end
- end
- end
-
-
- # Extend the java class imported from blueprints.
- class DexGraph
- include GraphMixin
- include GraphIndicesMixin
- include GraphTransactionsStub
- include ManagedTransactionsMixin
- include Pacer::Core::Route
- include Pacer::Core::Graph::GraphRoute
- include Pacer::Core::Graph::GraphIndexRoute
-
- # Override to return an enumeration-friendly array of vertices.
- def get_vertices
- getVertices.to_enum(:map).to_route(:graph => self, :element_type => :vertex)
- end
-
- # Override to return an enumeration-friendly array of edges.
- def get_edges
- getEdges.to_enum(:map).to_route(:graph => self, :element_type => :edge)
- end
-
- def element_class
- DexElement
- end
-
- def vertex_class
- DexVertex
- end
-
- def edge_class
- DexEdge
- end
-
- def index_class(et = nil)
- if element_type(et) == DexVertex
- com.tinkerpop.blueprints.pgm.Vertex.java_class
- end
- end
-
- def sanitize_properties(props)
- pairs = props.map do |name, value|
- [name, encode_property(value)]
- end
- Hash[pairs]
- end
-
- def encode_property(value)
- case value
- when nil
- nil
- when String
- value = value.strip
- value unless value == ''
- when Fixnum
- int = java.lang.Integer
- if value > int::MIN_VALUE and value < int::MAX_VALUE
- value.to_java(:int)
- else
- value.to_yaml
- end
- when Numeric
- if value.is_a? Bignum
- value.to_yaml
- else
- value
- end
- when true, false
- value.to_java
- else
- value.to_yaml
- end
- end
-
- if 'x'.to_yaml[0, 5] == '%YAML'
- def decode_property(value)
- if value.is_a? String and value[0, 5] == '%YAML'
- YAML.load(value)
- else
- value
+ open = proc do
+ graph = Pacer.open_graphs[path]
+ unless graph
+ graph = dex.new(path)
+ Pacer.open_graphs[path] = graph
end
+ graph
end
- else
- def decode_property(value)
- if value.is_a? String and value[0, 3] == '---'
- YAML.load(value)
- else
- value
- end
+ shutdown = proc do |g|
+ g.blueprints_graph.shutdown
+ Pacer.open_graphs[path] = nil
end
- end
-
- def supports_custom_element_ids?
- false
- end
-
- def supports_automatic_indices?
- false
- end
-
- def supports_manual_indices?
- false
- end
-
- def supports_edge_indices?
- false
+ PacerGraph.new(Pacer::YamlEncoder, open, shutdown)
end
end
end
View
@@ -1,7 +0,0 @@
-module Pacer
- DexAutomaticIndex = com.tinkerpop.blueprints.pgm.impls.dex.DexAutomaticIndex
-
- class DexAutomaticIndex
- include IndexMixin
- end
-end
View
@@ -27,6 +27,4 @@ def dex_graph2
@dex_graph2 = Pacer.dex(path2)
end
end
-
- include Dex
end
View
@@ -1,9 +1,10 @@
module Pacer
module Dex
- VERSION = "1.0.5"
+ VERSION = "2.0.0"
JAR = "pacer-dex-#{ VERSION }-standalone.jar"
JAR_PATH = "lib/#{ JAR }"
- BLUEPRINTS_VERSION = "1.0"
- PIPES_VERSION = "0.8"
+ BLUEPRINTS_VERSION = "2.1.0"
+ PIPES_VERSION = "2.1.0"
+ PACER_REQ = ">= 1.0.0"
end
end
View
@@ -1,12 +0,0 @@
-require 'yaml'
-
-module Pacer
- DexVertex = com.tinkerpop.blueprints.pgm.impls.dex.DexVertex
-
- # Extend the java class imported from blueprints.
- class DexVertex
- include Pacer::Core::Graph::VerticesRoute
- include ElementMixin
- include VertexMixin
- end
-end
View
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
s.summary = %q{Dex jars and related code for Pacer}
s.description = s.summary
- s.add_dependency 'pacer', '>= 0.8.5'
+ s.add_dependency 'pacer', Pacer::Dex::PACER_REQ
s.rubyforge_project = "pacer-dex"
View
@@ -7,9 +7,9 @@
<artifactId>pacer-dex</artifactId>
<!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
<properties>
- <gem.version>1.0.5</gem.version>
- <blueprints.version>1.0</blueprints.version>
- <pipes.version>0.8</pipes.version>
+ <gem.version>2.0.0</gem.version>
+ <blueprints.version>2.1.0</blueprints.version>
+ <pipes.version>2.1.0</pipes.version>
</properties>
<!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
<version>${gem.version}</version>

0 comments on commit 8334f8a

Please sign in to comment.