Commit 743c7801 authored by John E. Vincent's avatar John E. Vincent

fix failed tests after refactor. woops

parent 4d691003
......@@ -63,9 +63,9 @@ task :sample, :redis_url do |t, args|
a = Noah::Application.create(:name => 'noah')
if a.save
puts "Creating Configuration entry for 'noah'"
cr = Noah::Configuration.create(:name => 'redis', :format => 'string', :body => 'redis://127.0.0.1:6379/0', :application => a)
ch = Noah::Configuration.create(:name => 'host', :format => 'string', :body => 'localhost', :application => a)
cp = Noah::Configuration.create(:name => 'port', :format => 'string', :body => '9292', :application => a)
cr = Noah::Configuration.create(:name => 'redis', :format => 'string', :body => 'redis://127.0.0.1:6379/0')
ch = Noah::Configuration.create(:name => 'host', :format => 'string', :body => 'localhost')
cp = Noah::Configuration.create(:name => 'port', :format => 'string', :body => '9292')
%w[cr ch cp].each do |c|
a.configurations << eval(c)
end
......@@ -99,13 +99,13 @@ EOJ
a1 = Noah::Application.create(:name => 'myrailsapp1')
if a1.save
c1 = Noah::Configuration.create(:name => 'database.yml', :format => 'yaml', :body => my_yaml, :application => a1)
c1 = Noah::Configuration.create(:name => 'database.yml', :format => 'yaml', :body => my_yaml)
a1.configurations << c1
end
a2 = Noah::Application.create(:name => 'myrestapp1')
if a2.save
c2 = Noah::Configuration.create(:name => 'config.json', :format => 'json', :body => my_json, :application => a2)
c2 = Noah::Configuration.create(:name => 'config.json', :format => 'json', :body => my_json)
a2.configurations << c2
end
puts "Sample data populated!"
......
......@@ -50,11 +50,11 @@ class Noah::App
if app.nil?
halt 404
else
# configs are no longer tied to apps. remove the cascade delete
# configurations = []
# Noah::Configuration.find(:application_id => app.id).sort.each {|x| configurations << x; x.delete} if app.configurations.size > 0
# configs are no longer tied to apps. remove the cascade delete
# configurations = []
# Noah::Configuration.find(:application_id => app.id).sort.each {|x| configurations << x; x.delete} if app.configurations.size > 0
app.delete
# r = {"result" => "success", "action" => "delete", "id" => "#{app.id}", "name" => "#{appname}", "configurations" => "#{configurations.size}"}
# r = {"result" => "success", "action" => "delete", "id" => "#{app.id}", "name" => "#{appname}", "configurations" => "#{configurations.size}"}
r = {"result" => "success", "action" => "delete", "id" => "#{app.id}", "name" => "#{appname}"}
r.to_json
end
......
......@@ -68,9 +68,9 @@ class Noah::App
delete '/configurations/:appname/:element?' do |appname, element|
app = Noah::Application.find(:name => appname).first
if app
config = Noah::Configuration.find(:name=> element, :application_id => app.id).first
config = app.configurations.find(:name=> element).first
if config
config.delete
app.configurations.delete(config)
r = {"result" => "success", "id" => "#{config.id}", "action" => "delete", "application" => "#{app.name}", "item" => "#{element}"}
r.to_json
else
......
......@@ -65,9 +65,10 @@ module Noah
end
protected
def patternize_me
def patternize_me(opts = {:namespace => nil})
opts[:namespace].nil? ? namespace="//noah/#{self.class_to_lower}s" : namespace="//noah/#{opts[:namespace]}/#{self.class_to_lower}s"
name.match(/^\//) ? n = name.gsub(/^\//, '') : n = name
"//noah/#{self.class_to_lower}s/#{n}"
"#{namespace}/#{n}"
end
def stash_name
......@@ -133,3 +134,4 @@ require File.join(File.dirname(__FILE__), 'models','applications')
require File.join(File.dirname(__FILE__), 'models','configurations')
require File.join(File.dirname(__FILE__), 'models','watchers')
require File.join(File.dirname(__FILE__), 'models','ephemerals')
require File.join(File.dirname(__FILE__), 'models','link')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment