keymaker 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +76 -3
- data/keymaker.gemspec +2 -3
- data/lib/keymaker.rb +3 -1
- data/lib/keymaker/rails_tasks.rb +1 -0
- data/lib/keymaker/railtie.rb +7 -0
- metadata +3 -4
- data/lib/tasks/keymaker.rake +0 -2
- data/lib/tasks/neo4j.rake +0 -69
data/Rakefile
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
load 'lib/tasks/neo4j.rake'
|
2
|
-
|
3
1
|
#############################################################################
|
4
2
|
#
|
5
3
|
# Helper functions
|
@@ -112,7 +110,7 @@ end
|
|
112
110
|
|
113
111
|
desc "Validate #{gemspec_file}"
|
114
112
|
task :validate do
|
115
|
-
libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"
|
113
|
+
libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
|
116
114
|
unless libfiles.empty?
|
117
115
|
puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
|
118
116
|
exit!
|
@@ -122,3 +120,78 @@ task :validate do
|
|
122
120
|
exit!
|
123
121
|
end
|
124
122
|
end
|
123
|
+
|
124
|
+
#############################################################################
|
125
|
+
#
|
126
|
+
# Neo4j tasks
|
127
|
+
#
|
128
|
+
#############################################################################
|
129
|
+
|
130
|
+
KEYMAKER_ROOT = File.expand_path(File.dirname(__FILE__) + '/../..')
|
131
|
+
KEYMAKER_TMP_DIR = File.expand_path(File.join(KEYMAKER_ROOT, "tmp"))
|
132
|
+
NEO4J_INSTALL_DIR = ENV['NEO4J_INSTALL_DIR'] || File.expand_path(File.join(KEYMAKER_TMP_DIR, "keymaker_development"))
|
133
|
+
NEO4J_PORT = ENV['NEO4J_PORT'] || '7477' # Don't clobber standard neo4j ports 7474 or 7475 for development
|
134
|
+
|
135
|
+
namespace :neo4j do
|
136
|
+
|
137
|
+
desc "Install neo4j on localhost:#{NEO4J_PORT}. e.g. rake neo4j:install[community,1.7.M03]"
|
138
|
+
task :install, :edition, :version do |t, args|
|
139
|
+
args.with_defaults(:edition => "community", :version => "1.7")
|
140
|
+
|
141
|
+
source_name = "neo4j-#{args[:edition]}-#{args[:version]}"
|
142
|
+
tarball = "#{source_name}-unix.tar.gz"
|
143
|
+
|
144
|
+
puts "Installing #{source_name} to localhost:#{NEO4J_PORT}..."
|
145
|
+
|
146
|
+
ssl_url_true = "org.neo4j.server.webserver.https.enabled=true"
|
147
|
+
ssl_url_false = ssl_url_true.gsub("true","false")
|
148
|
+
|
149
|
+
%x[mkdir -p #{KEYMAKER_TMP_DIR}; cd #{KEYMAKER_TMP_DIR}]
|
150
|
+
FileUtils.rm_rf(NEO4J_INSTALL_DIR) if Dir.exists?(NEO4J_INSTALL_DIR) && File.owned?(NEO4J_INSTALL_DIR)
|
151
|
+
%x[wget http://dist.neo4j.org/#{tarball}]
|
152
|
+
%x[tar xvzf #{tarball}]
|
153
|
+
|
154
|
+
%x[mv #{source_name} #{NEO4J_INSTALL_DIR}]
|
155
|
+
%x[rm #{tarball}]
|
156
|
+
|
157
|
+
%x[sed -i.bak 's/7474/#{NEO4J_PORT}/g' #{NEO4J_INSTALL_DIR}/conf/neo4j-server.properties]
|
158
|
+
%x[sed -i.bak 's/#{ssl_url_true}/#{ssl_url_false}/g' #{NEO4J_INSTALL_DIR}/conf/neo4j-server.properties]
|
159
|
+
|
160
|
+
puts "#{source_name} Installed into the #{NEO4J_INSTALL_DIR} directory."
|
161
|
+
puts "Run `rake neo4j:start` to start it"
|
162
|
+
end
|
163
|
+
|
164
|
+
desc "Start the neo4j server running on localhost:#{NEO4J_PORT}"
|
165
|
+
task :start do
|
166
|
+
puts "Starting neo4j for keymaker_development..."
|
167
|
+
%x[#{NEO4J_INSTALL_DIR}/bin/neo4j start]
|
168
|
+
end
|
169
|
+
|
170
|
+
desc "Stop the neo4j server running on localhost:#{NEO4J_PORT}"
|
171
|
+
task :stop do
|
172
|
+
puts "Stopping neo4j for keymaker_development..."
|
173
|
+
%x[#{NEO4J_INSTALL_DIR}/bin/neo4j stop]
|
174
|
+
end
|
175
|
+
|
176
|
+
desc "Restart the neo4j server running on localhost:#{NEO4J_PORT}"
|
177
|
+
task :restart do
|
178
|
+
puts "Restarting neo4j for keymaker_development..."
|
179
|
+
%x[#{NEO4J_INSTALL_DIR}/bin/neo4j restart]
|
180
|
+
end
|
181
|
+
|
182
|
+
desc "Wipe out and recreate the neo4j server running on localhost:#{NEO4J_PORT}"
|
183
|
+
task :reset do
|
184
|
+
puts "Resetting neo4j for keymaker_development..."
|
185
|
+
# Stop the server
|
186
|
+
%x[#{NEO4J_INSTALL_DIR}/bin/neo4j stop]
|
187
|
+
# Reset the database
|
188
|
+
FileUtils.rm_rf("#{NEO4J_INSTALL_DIR}/data/graph.db")
|
189
|
+
FileUtils.mkdir("#{NEO4J_INSTALL_DIR}/data/graph.db")
|
190
|
+
# Remove log files
|
191
|
+
FileUtils.rm_rf("#{NEO4J_INSTALL_DIR}/data/log")
|
192
|
+
FileUtils.mkdir("#{NEO4J_INSTALL_DIR}/data/log")
|
193
|
+
# Start the server
|
194
|
+
%x[#{NEO4J_INSTALL_DIR}/bin/neo4j start]
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
data/keymaker.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
## If your rubyforge_project name is different, then edit it and comment out
|
15
15
|
## the sub! line in the Rakefile
|
16
16
|
s.name = 'keymaker'
|
17
|
-
s.version = '0.0.
|
17
|
+
s.version = '0.0.7'
|
18
18
|
s.date = '2012-06-15'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
@@ -76,14 +76,13 @@ Gem::Specification.new do |s|
|
|
76
76
|
lib/keymaker/node.rb
|
77
77
|
lib/keymaker/path_traverse_request.rb
|
78
78
|
lib/keymaker/rails_tasks.rb
|
79
|
+
lib/keymaker/railtie.rb
|
79
80
|
lib/keymaker/remove_node_from_index_request.rb
|
80
81
|
lib/keymaker/request.rb
|
81
82
|
lib/keymaker/response.rb
|
82
83
|
lib/keymaker/serialization.rb
|
83
84
|
lib/keymaker/service.rb
|
84
85
|
lib/keymaker/update_node_properties_request.rb
|
85
|
-
lib/tasks/keymaker.rake
|
86
|
-
lib/tasks/neo4j.rake
|
87
86
|
spec/keymaker/configuration_spec.rb
|
88
87
|
spec/keymaker/service_spec.rb
|
89
88
|
spec/keymaker_spec.rb
|
data/lib/keymaker.rb
CHANGED
@@ -22,9 +22,11 @@ require 'keymaker/indexing'
|
|
22
22
|
require 'keymaker/serialization'
|
23
23
|
require 'keymaker/node'
|
24
24
|
|
25
|
+
require 'keymaker/railtie' if defined? Rails::Railtie
|
26
|
+
|
25
27
|
module Keymaker
|
26
28
|
|
27
|
-
VERSION = "0.0.
|
29
|
+
VERSION = "0.0.7"
|
28
30
|
|
29
31
|
def self.service
|
30
32
|
@service ||= Keymaker::Service.new(Keymaker::Configuration.new)
|
data/lib/keymaker/rails_tasks.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keymaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -152,14 +152,13 @@ files:
|
|
152
152
|
- lib/keymaker/node.rb
|
153
153
|
- lib/keymaker/path_traverse_request.rb
|
154
154
|
- lib/keymaker/rails_tasks.rb
|
155
|
+
- lib/keymaker/railtie.rb
|
155
156
|
- lib/keymaker/remove_node_from_index_request.rb
|
156
157
|
- lib/keymaker/request.rb
|
157
158
|
- lib/keymaker/response.rb
|
158
159
|
- lib/keymaker/serialization.rb
|
159
160
|
- lib/keymaker/service.rb
|
160
161
|
- lib/keymaker/update_node_properties_request.rb
|
161
|
-
- lib/tasks/keymaker.rake
|
162
|
-
- lib/tasks/neo4j.rake
|
163
162
|
- spec/keymaker/configuration_spec.rb
|
164
163
|
- spec/keymaker/service_spec.rb
|
165
164
|
- spec/keymaker_spec.rb
|
@@ -179,7 +178,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
179
178
|
version: '0'
|
180
179
|
segments:
|
181
180
|
- 0
|
182
|
-
hash:
|
181
|
+
hash: 2124841849284898919
|
183
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
183
|
none: false
|
185
184
|
requirements:
|
data/lib/tasks/keymaker.rake
DELETED
data/lib/tasks/neo4j.rake
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# Inspired by the neo4j tasks in maxdemarzi/neography
|
2
|
-
KEYMAKER_ROOT = File.expand_path(File.dirname(__FILE__) + '/../..')
|
3
|
-
KEYMAKER_TMP_DIR = File.expand_path(File.join(KEYMAKER_ROOT, "tmp"))
|
4
|
-
NEO4J_INSTALL_DIR = ENV['NEO4J_INSTALL_DIR'] || File.expand_path(File.join(KEYMAKER_TMP_DIR, "keymaker_development"))
|
5
|
-
NEO4J_PORT = ENV['NEO4J_PORT'] || '7477' # Don't clobber standard neo4j ports 7474 or 7475 for development
|
6
|
-
|
7
|
-
namespace :neo4j do
|
8
|
-
|
9
|
-
desc "Install neo4j on localhost:#{NEO4J_PORT}. e.g. rake neo4j:install[community,1.7.M03]"
|
10
|
-
task :install, :edition, :version do |t, args|
|
11
|
-
args.with_defaults(:edition => "community", :version => "1.7")
|
12
|
-
|
13
|
-
source_name = "neo4j-#{args[:edition]}-#{args[:version]}"
|
14
|
-
tarball = "#{source_name}-unix.tar.gz"
|
15
|
-
|
16
|
-
puts "Installing #{source_name} to localhost:#{NEO4J_PORT}..."
|
17
|
-
|
18
|
-
ssl_url_true = "org.neo4j.server.webserver.https.enabled=true"
|
19
|
-
ssl_url_false = ssl_url_true.gsub("true","false")
|
20
|
-
|
21
|
-
%x[mkdir -p #{KEYMAKER_TMP_DIR}; cd #{KEYMAKER_TMP_DIR}]
|
22
|
-
FileUtils.rm_rf(NEO4J_INSTALL_DIR) if Dir.exists?(NEO4J_INSTALL_DIR) && File.owned?(NEO4J_INSTALL_DIR)
|
23
|
-
%x[wget http://dist.neo4j.org/#{tarball}]
|
24
|
-
%x[tar xvzf #{tarball}]
|
25
|
-
|
26
|
-
%x[mv #{source_name} #{NEO4J_INSTALL_DIR}]
|
27
|
-
%x[rm #{tarball}]
|
28
|
-
|
29
|
-
%x[sed -i.bak 's/7474/#{NEO4J_PORT}/g' #{NEO4J_INSTALL_DIR}/conf/neo4j-server.properties]
|
30
|
-
%x[sed -i.bak 's/#{ssl_url_true}/#{ssl_url_false}/g' #{NEO4J_INSTALL_DIR}/conf/neo4j-server.properties]
|
31
|
-
|
32
|
-
puts "#{source_name} Installed into the #{NEO4J_INSTALL_DIR} directory."
|
33
|
-
puts "Run `rake neo4j:start` to start it"
|
34
|
-
end
|
35
|
-
|
36
|
-
desc "Start the neo4j server running on localhost:#{NEO4J_PORT}"
|
37
|
-
task :start do
|
38
|
-
puts "Starting neo4j for keymaker_development..."
|
39
|
-
%x[#{NEO4J_INSTALL_DIR}/bin/neo4j start]
|
40
|
-
end
|
41
|
-
|
42
|
-
desc "Stop the neo4j server running on localhost:#{NEO4J_PORT}"
|
43
|
-
task :stop do
|
44
|
-
puts "Stopping neo4j for keymaker_development..."
|
45
|
-
%x[#{NEO4J_INSTALL_DIR}/bin/neo4j stop]
|
46
|
-
end
|
47
|
-
|
48
|
-
desc "Restart the neo4j server running on localhost:#{NEO4J_PORT}"
|
49
|
-
task :restart do
|
50
|
-
puts "Restarting neo4j for keymaker_development..."
|
51
|
-
%x[#{NEO4J_INSTALL_DIR}/bin/neo4j restart]
|
52
|
-
end
|
53
|
-
|
54
|
-
desc "Wipe out and recreate the neo4j server running on localhost:#{NEO4J_PORT}"
|
55
|
-
task :reset do
|
56
|
-
puts "Resetting neo4j for keymaker_development..."
|
57
|
-
# Stop the server
|
58
|
-
%x[#{NEO4J_INSTALL_DIR}/bin/neo4j stop]
|
59
|
-
# Reset the database
|
60
|
-
FileUtils.rm_rf("#{NEO4J_INSTALL_DIR}/data/graph.db")
|
61
|
-
FileUtils.mkdir("#{NEO4J_INSTALL_DIR}/data/graph.db")
|
62
|
-
# Remove log files
|
63
|
-
FileUtils.rm_rf("#{NEO4J_INSTALL_DIR}/data/log")
|
64
|
-
FileUtils.mkdir("#{NEO4J_INSTALL_DIR}/data/log")
|
65
|
-
# Start the server
|
66
|
-
%x[#{NEO4J_INSTALL_DIR}/bin/neo4j start]
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|