Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
Noah
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Noah
Commits
743c7801
Commit
743c7801
authored
Apr 06, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix failed tests after refactor. woops
parent
4d691003
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
13 deletions
+15
-13
Rakefile
Rakefile
+5
-5
application_routes.rb
lib/noah/application_routes.rb
+4
-4
configuration_routes.rb
lib/noah/configuration_routes.rb
+2
-2
models.rb
lib/noah/models.rb
+4
-2
No files found.
Rakefile
View file @
743c7801
...
...
@@ -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!"
...
...
lib/noah/application_routes.rb
View file @
743c7801
...
...
@@ -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
...
...
lib/noah/configuration_routes.rb
View file @
743c7801
...
...
@@ -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
...
...
lib/noah/models.rb
View file @
743c7801
...
...
@@ -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'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment