Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
lumen-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
17886113
authored
Jun 02, 2019
by
John Doe
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
added rake task for adding NilmDB nodes
parent
c599153e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
lib/tasks/nilm.rake
lib/tasks/nilm.rake
0 → 100644
View file @
17886113
require
'factory_bot_rails'
namespace
:nilm
do
desc
"Add a nilmdb database"
task
:add
,
[
:email
,
:name
,
:url
]
=>
[
:environment
]
do
|
t
,
args
|
adapter
=
Nilmdb
::
Adapter
.
new
(
args
[
:url
])
service
=
CreateNilm
.
new
(
adapter
)
service
.
run
(
name:
args
[
:name
],
url:
args
[
:url
],
owner:
User
.
find_by_email
(
args
[
:email
]))
if
service
.
success?
puts
"created Nilm
#{
args
[
:name
]
}
with owner
#{
args
[
:email
]
}
"
else
puts
args
.
warnings
puts
args
.
errors
end
end
end
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