keymaker 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ load 'lib/tasks/neo4j.rake'
2
+
1
3
  #############################################################################
2
4
  #
3
5
  # Helper functions
@@ -110,7 +112,7 @@ end
110
112
 
111
113
  desc "Validate #{gemspec_file}"
112
114
  task :validate do
113
- libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
115
+ libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}", "lib/tasks"]
114
116
  unless libfiles.empty?
115
117
  puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
116
118
  exit!
@@ -120,78 +122,3 @@ task :validate do
120
122
  exit!
121
123
  end
122
124
  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
@@ -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.5'
17
+ s.version = '0.0.6'
18
18
  s.date = '2012-06-15'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -82,6 +82,8 @@ Gem::Specification.new do |s|
82
82
  lib/keymaker/serialization.rb
83
83
  lib/keymaker/service.rb
84
84
  lib/keymaker/update_node_properties_request.rb
85
+ lib/tasks/keymaker.rake
86
+ lib/tasks/neo4j.rake
85
87
  spec/keymaker/configuration_spec.rb
86
88
  spec/keymaker/service_spec.rb
87
89
  spec/keymaker_spec.rb
@@ -22,11 +22,9 @@ require 'keymaker/indexing'
22
22
  require 'keymaker/serialization'
23
23
  require 'keymaker/node'
24
24
 
25
- require 'keymaker/rails_tasks' if defined?(Rails) && Rails.respond_to?(:env)
26
-
27
25
  module Keymaker
28
26
 
29
- VERSION = "0.0.5"
27
+ VERSION = "0.0.6"
30
28
 
31
29
  def self.service
32
30
  @service ||= Keymaker::Service.new(Keymaker::Configuration.new)
@@ -1,5 +1,4 @@
1
- # Inspired by the neo4j tasks in maxdemarzi/neography
2
- NEO4J_INSTALL_DIR = ENV['NEO4J_INSTALL_DIR'] || File.expand_path(File.join("tmp", "neo_#{Rails.env}"))
1
+ NEO4J_INSTALL_DIR = ENV['NEO4J_INSTALL_DIR'] || File.expand_path(File.join(Rails.root, "tmp", "neo_#{Rails.env}"))
3
2
  NEO4J_PORT = ENV['NEO4J_PORT'] || Rails.env.test? ? "7475" : "7474"
4
3
 
5
4
  namespace :neo4j do
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
2
+ load 'keymaker/rails_tasks' if defined?(Rails) && Rails.respond_to?(:env)
@@ -0,0 +1,69 @@
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
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.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -158,6 +158,8 @@ files:
158
158
  - lib/keymaker/serialization.rb
159
159
  - lib/keymaker/service.rb
160
160
  - lib/keymaker/update_node_properties_request.rb
161
+ - lib/tasks/keymaker.rake
162
+ - lib/tasks/neo4j.rake
161
163
  - spec/keymaker/configuration_spec.rb
162
164
  - spec/keymaker/service_spec.rb
163
165
  - spec/keymaker_spec.rb
@@ -177,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
179
  version: '0'
178
180
  segments:
179
181
  - 0
180
- hash: 3811076203685826813
182
+ hash: -792013278918887263
181
183
  required_rubygems_version: !ruby/object:Gem::Requirement
182
184
  none: false
183
185
  requirements: