n4j 0.0.1 → 0.0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -126
- data/lib/n4j.rb +1 -0
- data/lib/n4j/railtie.rb +10 -0
- data/lib/n4j/version.rb +1 -1
- data/{tasks → lib/tasks}/.gitkeep +0 -0
- data/{tasks → lib/tasks}/n4j.rake +70 -69
- metadata +12 -11
data/Rakefile
CHANGED
@@ -9,129 +9,4 @@ Rake::TestTask.new(:test) do |test|
|
|
9
9
|
end
|
10
10
|
|
11
11
|
|
12
|
-
|
13
|
-
desc "Create n4j.yml"
|
14
|
-
task :create_n4j_config do
|
15
|
-
require 'psych'
|
16
|
-
conf_file = Psych.dump({'development' => {'port' => 7480, 'secure_port' => 7481},
|
17
|
-
'test' => {'port' => 7481, 'secure_port' => 7483}})
|
18
|
-
FileUtils.mkdir_p 'config'
|
19
|
-
File.open('config/n4j.yml', 'w') {|f| f.write(conf_file) }
|
20
|
-
end
|
21
|
-
|
22
|
-
desc "Clear development database."
|
23
|
-
task :clear_development do
|
24
|
-
port = YAML.parse_file('config/n4j.yml').to_ruby['development']['port']
|
25
|
-
result = `curl --request DELETE http://localhost:#{port}/cleandb/all-gone`
|
26
|
-
puts result
|
27
|
-
end
|
28
|
-
|
29
|
-
desc "Status of Neo4j servers"
|
30
|
-
task :status do
|
31
|
-
number_of_neo4j_instances = `ps aux | grep ne[o]4j | wc -l`
|
32
|
-
number_of_neo4j_instances.strip!
|
33
|
-
puts "#{number_of_neo4j_instances} total instances of Neo4j running, system wide."
|
34
|
-
unless number_of_neo4j_instances.to_i < 1
|
35
|
-
YAML.parse_file("config/n4j.yml").to_ruby.each_pair do |environment, conf|
|
36
|
-
pid_filename = "tmp/pids/n4j_#{environment}_pid"
|
37
|
-
if File.exist?(pid_filename)
|
38
|
-
pid = IO.read "tmp/pids/n4j_#{environment}_pid"
|
39
|
-
pid.chomp!
|
40
|
-
result = `ps p#{pid} | grep #{pid} | wc -l`
|
41
|
-
result.strip!
|
42
|
-
puts "#{result} instances running for #{environment} (pid: #{pid})."
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
desc 'Start servers'
|
49
|
-
task :start do |task_name|
|
50
|
-
require 'erb'
|
51
|
-
|
52
|
-
YAML.parse_file('config/n4j.yml').to_ruby.each_pair do |environment, conf|
|
53
|
-
@environment = environment
|
54
|
-
@port = conf['port']
|
55
|
-
@secure_port = conf['secure_port']
|
56
|
-
@server_version = 1.6
|
57
|
-
|
58
|
-
neo4j_bin_link = `which neo4j`
|
59
|
-
neo4j_bin_link.chomp!
|
60
|
-
neo4j_bin = Pathname.new(neo4j_bin_link).realpath
|
61
|
-
|
62
|
-
java_command = `which java`
|
63
|
-
java_command.chomp!
|
64
|
-
|
65
|
-
libexec = Pathname.new(neo4j_bin_link).realpath.dirname.dirname
|
66
|
-
|
67
|
-
libdir = "#{libexec}/lib"
|
68
|
-
syslib = "#{libexec}/system/lib"
|
69
|
-
plugin_dir = "#{libexec}/plugins"
|
70
|
-
n4j_plugins = 'neo4j_plugins'
|
71
|
-
neo4j_home = "tmp/n4j/#{@environment}"
|
72
|
-
pid_file = "tmp/pids/n4j_#{@environment}_pid"
|
73
|
-
|
74
|
-
FileUtils.mkdir_p neo4j_home
|
75
|
-
FileUtils.mkdir_p "#{neo4j_home}/data/log"
|
76
|
-
FileUtils.mkdir_p 'tmp/pids'
|
77
|
-
|
78
|
-
class_path = [libdir, syslib, plugin_dir, n4j_plugins].collect {|dir| Dir.glob(dir + '/*.jar')}.flatten.join(':')
|
79
|
-
java_opts = "-server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Xms3m -Xmx64m"
|
80
|
-
|
81
|
-
# system "cp lib/n4j/templates/neo4j.properties tmp/n4j/#{@environment}/"
|
82
|
-
# system "cp lib/n4j/templates/logging.properties tmp/n4j/#{@environment}/"
|
83
|
-
FileUtils.cp 'templates/neo4j.properties', "tmp/n4j/#{@environment}/neo4j.properties"
|
84
|
-
FileUtils.cp 'templates/logging.properties', "tmp/n4j/#{@environment}/logging.properties"
|
85
|
-
|
86
|
-
FileUtils.touch "#{neo4j_home}/data/log/console.log"
|
87
|
-
|
88
|
-
neo4j_server_properties = ERB.new(IO.read("templates/neo4j-server-#{@server_version}.properties")).result
|
89
|
-
neo4j_server_properties_path = "#{neo4j_home}/neo4j-server.properties"
|
90
|
-
File.open(neo4j_server_properties_path, 'w') {|f| f.write(neo4j_server_properties) }
|
91
|
-
|
92
|
-
neo4j_wrapper_conf = ERB.new(IO.read('templates/neo4j-wrapper.conf')).result
|
93
|
-
neo4j_wrapper_conf_path = "#{neo4j_home}/neo4j-wrapper.conf"
|
94
|
-
File.open(neo4j_wrapper_conf_path, 'w') {|f| f.write(neo4j_wrapper_conf) }
|
95
|
-
|
96
|
-
launch_neo4j_command = "#{java_command}
|
97
|
-
-cp #{class_path}
|
98
|
-
-server
|
99
|
-
-XX:+DisableExplicitGC
|
100
|
-
-Dorg.neo4j.server.properties=#{neo4j_server_properties_path}
|
101
|
-
-Djava.util.logging.config.file=#{neo4j_home}/logging.properties
|
102
|
-
-Xms3m
|
103
|
-
-Xmx64m
|
104
|
-
-Dlog4j.configuration=file:#{neo4j_home}/log4j.properties
|
105
|
-
-Dorg.neo4j.server.properties=#{neo4j_server_properties_path}
|
106
|
-
-Djava.util.logging.config.file=#{neo4j_home}/logging.properties
|
107
|
-
-Dneo4j.home=#{neo4j_home}
|
108
|
-
-Dneo4j.instance=#{libexec} org.neo4j.server.Bootstrapper
|
109
|
-
>> #{neo4j_home}/data/log/console.log 2>&1 & echo $! > \"#{pid_file}\"
|
110
|
-
"
|
111
|
-
|
112
|
-
system launch_neo4j_command.gsub(/\n/,' ').gsub(/\s+/, ' ')
|
113
|
-
puts "#{environment.capitalize} Neo4j launched."
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
desc "Stop server"
|
118
|
-
task :stop do
|
119
|
-
YAML.parse_file('config/n4j.yml').to_ruby.each_pair do |environment, conf|
|
120
|
-
pid_filename = "tmp/pids/n4j_#{environment}_pid"
|
121
|
-
if File.exist?(pid_filename)
|
122
|
-
pid = IO.read pid_filename
|
123
|
-
pid.chomp!
|
124
|
-
result = `ps p#{pid} | grep #{pid} | wc -l`
|
125
|
-
if result.to_i > 0
|
126
|
-
Process.kill("HUP", pid.to_i)
|
127
|
-
puts "Killed #{environment} Neo4j."
|
128
|
-
else
|
129
|
-
puts "#{environment.capitalize} Neo4j wasn't running."
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
end
|
12
|
+
load 'lib/tasks/n4j.rake'
|
data/lib/n4j.rb
CHANGED
data/lib/n4j/railtie.rb
ADDED
data/lib/n4j/version.rb
CHANGED
File without changes
|
@@ -1,125 +1,126 @@
|
|
1
|
-
require 'erb'
|
2
|
-
|
3
1
|
namespace :n4j do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
gn.save
|
2
|
+
desc "Create n4j.yml"
|
3
|
+
task :create_n4j_config do
|
4
|
+
require 'psych'
|
5
|
+
conf_file = Psych.dump({'development' => {'port' => 7480, 'secure_port' => 7481},
|
6
|
+
'test' => {'port' => 7481, 'secure_port' => 7483}})
|
7
|
+
FileUtils.mkdir_p 'config'
|
8
|
+
File.open('config/n4j.yml', 'w') {|f| f.write(conf_file) }
|
12
9
|
end
|
13
|
-
|
10
|
+
|
14
11
|
desc "Clear development database."
|
15
12
|
task :clear_development do
|
16
13
|
port = YAML.parse_file('config/n4j.yml').to_ruby['development']['port']
|
17
14
|
result = `curl --request DELETE http://localhost:#{port}/cleandb/all-gone`
|
18
15
|
puts result
|
19
16
|
end
|
20
|
-
|
17
|
+
|
21
18
|
desc "Status of Neo4j servers"
|
22
19
|
task :status do
|
23
20
|
number_of_neo4j_instances = `ps aux | grep ne[o]4j | wc -l`
|
24
21
|
number_of_neo4j_instances.strip!
|
25
22
|
puts "#{number_of_neo4j_instances} total instances of Neo4j running, system wide."
|
26
23
|
unless number_of_neo4j_instances.to_i < 1
|
27
|
-
YAML.parse_file(
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
24
|
+
YAML.parse_file("config/n4j.yml").to_ruby.each_pair do |environment, conf|
|
25
|
+
pid_filename = "tmp/pids/n4j_#{environment}_pid"
|
26
|
+
if File.exist?(pid_filename)
|
27
|
+
pid = IO.read "tmp/pids/n4j_#{environment}_pid"
|
28
|
+
pid.chomp!
|
29
|
+
result = `ps p#{pid} | grep #{pid} | wc -l`
|
30
|
+
result.strip!
|
31
|
+
puts "#{result} instances running for #{environment} (pid: #{pid})."
|
32
|
+
end
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
desc 'Start servers'
|
38
38
|
task :start do |task_name|
|
39
|
+
require 'erb'
|
40
|
+
|
39
41
|
YAML.parse_file('config/n4j.yml').to_ruby.each_pair do |environment, conf|
|
40
42
|
@environment = environment
|
41
43
|
@port = conf['port']
|
42
44
|
@secure_port = conf['secure_port']
|
43
45
|
@server_version = 1.6
|
44
|
-
|
46
|
+
|
45
47
|
neo4j_bin_link = `which neo4j`
|
46
48
|
neo4j_bin_link.chomp!
|
47
49
|
neo4j_bin = Pathname.new(neo4j_bin_link).realpath
|
48
50
|
|
49
|
-
|
50
|
-
|
51
|
-
libdir = "#{libexec}/lib"
|
52
|
-
syslib = "#{libexec}/system/lib"
|
53
|
-
plugin_dir = "#{libexec}/plugins"
|
54
|
-
n4j_plugins = 'lib/n4j/neo4j_plugins'
|
55
|
-
# coordinator ???
|
56
|
-
|
57
|
-
class_path = [libdir, syslib, plugin_dir, n4j_plugins].collect {|dir| Dir.glob(dir + '/*.jar')}.flatten.join(':')
|
58
|
-
|
59
|
-
java_opts = "-server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Xms3m -Xmx64m"
|
60
|
-
|
51
|
+
java_command = `which java`
|
52
|
+
java_command.chomp!
|
61
53
|
|
54
|
+
libexec = Pathname.new(neo4j_bin_link).realpath.dirname.dirname
|
62
55
|
|
63
|
-
|
56
|
+
libdir = "#{libexec}/lib"
|
57
|
+
syslib = "#{libexec}/system/lib"
|
58
|
+
plugin_dir = "#{libexec}/plugins"
|
59
|
+
n4j_plugins = 'neo4j_plugins'
|
60
|
+
neo4j_home = "tmp/n4j/#{@environment}"
|
61
|
+
pid_file = "tmp/pids/n4j_#{@environment}_pid"
|
64
62
|
|
65
63
|
FileUtils.mkdir_p neo4j_home
|
66
64
|
FileUtils.mkdir_p "#{neo4j_home}/data/log"
|
67
|
-
|
68
65
|
FileUtils.mkdir_p 'tmp/pids'
|
69
|
-
pid_file = "tmp/pids/n4j_#{@environment}_pid"
|
70
66
|
|
71
|
-
|
72
|
-
|
67
|
+
class_path = [libdir, syslib, plugin_dir, n4j_plugins].collect {|dir| Dir.glob(dir + '/*.jar')}.flatten.join(':')
|
68
|
+
java_opts = "-server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Xms3m -Xmx64m"
|
73
69
|
|
74
|
-
system "cp lib/n4j/templates/neo4j.properties tmp/n4j/#{@environment}/"
|
75
|
-
system "cp lib/n4j/templates/logging.properties tmp/n4j/#{@environment}/"
|
70
|
+
# system "cp lib/n4j/templates/neo4j.properties tmp/n4j/#{@environment}/"
|
71
|
+
# system "cp lib/n4j/templates/logging.properties tmp/n4j/#{@environment}/"
|
72
|
+
FileUtils.cp 'templates/neo4j.properties', "tmp/n4j/#{@environment}/neo4j.properties"
|
73
|
+
FileUtils.cp 'templates/logging.properties', "tmp/n4j/#{@environment}/logging.properties"
|
76
74
|
|
77
|
-
|
75
|
+
FileUtils.touch "#{neo4j_home}/data/log/console.log"
|
78
76
|
|
79
|
-
neo4j_server_properties = "
|
80
|
-
ERB.new(IO.read("lib/n4j/templates/neo4j-server-#{@server_version}.properties")).result
|
77
|
+
neo4j_server_properties = ERB.new(IO.read("templates/neo4j-server-#{@server_version}.properties")).result
|
81
78
|
neo4j_server_properties_path = "#{neo4j_home}/neo4j-server.properties"
|
82
79
|
File.open(neo4j_server_properties_path, 'w') {|f| f.write(neo4j_server_properties) }
|
83
|
-
|
84
|
-
neo4j_wrapper_conf =
|
85
|
-
ERB.new(IO.read('lib/n4j/templates/neo4j-wrapper.conf')).result
|
80
|
+
|
81
|
+
neo4j_wrapper_conf = ERB.new(IO.read('templates/neo4j-wrapper.conf')).result
|
86
82
|
neo4j_wrapper_conf_path = "#{neo4j_home}/neo4j-wrapper.conf"
|
87
83
|
File.open(neo4j_wrapper_conf_path, 'w') {|f| f.write(neo4j_wrapper_conf) }
|
88
84
|
|
89
|
-
launch_neo4j_command = "#{java_command}
|
90
|
-
-cp #{class_path}
|
91
|
-
-server
|
92
|
-
-XX:+DisableExplicitGC
|
93
|
-
-Dorg.neo4j.server.properties=#{neo4j_server_properties_path}
|
94
|
-
-Djava.util.logging.config.file=#{neo4j_home}/logging.properties
|
95
|
-
-Xms3m
|
96
|
-
-Xmx64m
|
97
|
-
-Dlog4j.configuration=file:#{neo4j_home}/log4j.properties
|
98
|
-
-Dorg.neo4j.server.properties=#{neo4j_server_properties_path}
|
99
|
-
-Djava.util.logging.config.file=#{neo4j_home}/logging.properties
|
100
|
-
-Dneo4j.home=#{neo4j_home}
|
85
|
+
launch_neo4j_command = "#{java_command}
|
86
|
+
-cp #{class_path}
|
87
|
+
-server
|
88
|
+
-XX:+DisableExplicitGC
|
89
|
+
-Dorg.neo4j.server.properties=#{neo4j_server_properties_path}
|
90
|
+
-Djava.util.logging.config.file=#{neo4j_home}/logging.properties
|
91
|
+
-Xms3m
|
92
|
+
-Xmx64m
|
93
|
+
-Dlog4j.configuration=file:#{neo4j_home}/log4j.properties
|
94
|
+
-Dorg.neo4j.server.properties=#{neo4j_server_properties_path}
|
95
|
+
-Djava.util.logging.config.file=#{neo4j_home}/logging.properties
|
96
|
+
-Dneo4j.home=#{neo4j_home}
|
101
97
|
-Dneo4j.instance=#{libexec} org.neo4j.server.Bootstrapper
|
102
|
-
>> #{neo4j_home}/data/log/console.log 2>&1 & echo $! > \"#{pid_file}\"
|
98
|
+
>> #{neo4j_home}/data/log/console.log 2>&1 & echo $! > \"#{pid_file}\"
|
103
99
|
"
|
104
|
-
|
100
|
+
|
105
101
|
system launch_neo4j_command.gsub(/\n/,' ').gsub(/\s+/, ' ')
|
106
102
|
puts "#{environment.capitalize} Neo4j launched."
|
107
|
-
|
108
103
|
end
|
109
104
|
end
|
110
|
-
|
105
|
+
|
111
106
|
desc "Stop server"
|
112
107
|
task :stop do
|
113
108
|
YAML.parse_file('config/n4j.yml').to_ruby.each_pair do |environment, conf|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
109
|
+
pid_filename = "tmp/pids/n4j_#{environment}_pid"
|
110
|
+
if File.exist?(pid_filename)
|
111
|
+
pid = IO.read pid_filename
|
112
|
+
pid.chomp!
|
113
|
+
result = `ps p#{pid} | grep #{pid} | wc -l`
|
114
|
+
if result.to_i > 0
|
115
|
+
Process.kill("HUP", pid.to_i)
|
116
|
+
puts "Killed #{environment} Neo4j."
|
117
|
+
else
|
118
|
+
puts "#{environment.capitalize} Neo4j wasn't running."
|
119
|
+
end
|
122
120
|
end
|
123
121
|
end
|
124
122
|
end
|
123
|
+
|
124
|
+
|
125
|
+
|
125
126
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: n4j
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
4
|
+
version: 0.0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-22 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
16
|
-
requirement: &
|
16
|
+
requirement: &70264005284380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70264005284380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &70264005283880 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70264005283880
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: activemodel
|
38
|
-
requirement: &
|
38
|
+
requirement: &70264005283460 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70264005283460
|
47
47
|
description: A little spiked out thing.
|
48
48
|
email:
|
49
49
|
- samsm@samsm.com
|
@@ -65,15 +65,16 @@ files:
|
|
65
65
|
- lib/n4j/field.rb
|
66
66
|
- lib/n4j/node.rb
|
67
67
|
- lib/n4j/populate.rb
|
68
|
+
- lib/n4j/railtie.rb
|
68
69
|
- lib/n4j/relationship.rb
|
69
70
|
- lib/n4j/representation.rb
|
70
71
|
- lib/n4j/request.rb
|
71
72
|
- lib/n4j/traversal.rb
|
72
73
|
- lib/n4j/version.rb
|
74
|
+
- lib/tasks/.gitkeep
|
75
|
+
- lib/tasks/n4j.rake
|
73
76
|
- n4j.gemspec
|
74
77
|
- neo4j_plugins/test-delete-db-extension-1.5.jar
|
75
|
-
- tasks/.gitkeep
|
76
|
-
- tasks/n4j.rake
|
77
78
|
- templates/README.txt
|
78
79
|
- templates/logging.properties
|
79
80
|
- templates/neo4j-server-1.5.properties
|
@@ -99,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
100
|
version: '0'
|
100
101
|
segments:
|
101
102
|
- 0
|
102
|
-
hash: -
|
103
|
+
hash: -2011595927392270751
|
103
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
105
|
none: false
|
105
106
|
requirements:
|
@@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
109
|
version: '0'
|
109
110
|
segments:
|
110
111
|
- 0
|
111
|
-
hash: -
|
112
|
+
hash: -2011595927392270751
|
112
113
|
requirements: []
|
113
114
|
rubyforge_project: n4j
|
114
115
|
rubygems_version: 1.8.10
|