Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eugene Shen
jio
Commits
90df066a
Commit
90df066a
authored
Dec 21, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dumb command object added to jio
parent
3709ae64
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
149 additions
and
0 deletions
+149
-0
src/jio/commands/_allDocsCommand.js
src/jio/commands/_allDocsCommand.js
+24
-0
src/jio/commands/_getCommand.js
src/jio/commands/_getCommand.js
+32
-0
src/jio/commands/_postCommand.js
src/jio/commands/_postCommand.js
+18
-0
src/jio/commands/_putAttachmentCommand.js
src/jio/commands/_putAttachmentCommand.js
+27
-0
src/jio/commands/_putCommand.js
src/jio/commands/_putCommand.js
+26
-0
src/jio/commands/_removeCommand.js
src/jio/commands/_removeCommand.js
+16
-0
src/jio/commands/command.js
src/jio/commands/command.js
+6
-0
No files found.
src/jio/commands/_allDocsCommand.js
0 → 100644
View file @
90df066a
var
_allDocsCommand
=
function
(
spec
,
my
)
{
var
that
=
command
(
spec
,
my
);
spec
=
spec
||
{};
my
=
my
||
{};
// Attributes //
// Methods //
that
.
getLabel
=
function
()
{
return
'
_allDocs
'
;
};
that
.
executeOn
=
function
(
storage
)
{
storage
.
_allDocs
(
that
);
};
that
.
canBeRestored
=
function
()
{
return
false
;
};
that
.
validateState
=
function
()
{
return
true
;
};
return
that
;
};
src/jio/commands/_getCommand.js
0 → 100644
View file @
90df066a
var
_getCommand
=
function
(
spec
,
my
)
{
var
that
=
command
(
spec
,
my
);
spec
=
spec
||
{};
my
=
my
||
{};
// Attributes //
// Methods //
that
.
getLabel
=
function
()
{
return
'
_get
'
;
};
that
.
validateState
=
function
()
{
if
(
!
that
.
getDocId
())
{
that
.
error
({
status
:
20
,
statusText
:
'
Document Id Required
'
,
error
:
'
document_id_required
'
,
message
:
'
No document id.
'
,
reason
:
'
no document id
'
});
return
false
;
}
return
true
;
};
that
.
executeOn
=
function
(
storage
)
{
storage
.
_get
(
that
);
};
that
.
canBeRestored
=
function
()
{
return
false
;
};
return
that
;
};
src/jio/commands/_postCommand.js
0 → 100644
View file @
90df066a
var
_postCommand
=
function
(
spec
,
my
)
{
var
that
=
command
(
spec
,
my
);
spec
=
spec
||
{};
my
=
my
||
{};
// Attributes //
var
priv
=
{};
// Methods //
that
.
getLabel
=
function
()
{
return
'
_post
'
;
};
that
.
executeOn
=
function
(
storage
)
{
storage
.
_post
(
that
);
};
return
that
;
};
src/jio/commands/_putAttachmentCommand.js
0 → 100644
View file @
90df066a
var
_putAttachmentCommand
=
function
(
spec
,
my
)
{
var
that
=
command
(
spec
,
my
);
spec
=
spec
||
{};
my
=
my
||
{};
// Attributes //
// Methods //
that
.
getLabel
=
function
()
{
return
'
_putAttachment
'
;
};
that
.
executeOn
=
function
(
storage
)
{
storage
.
_putAttachment
(
that
);
};
that
.
validateState
=
function
()
{
if
(
typeof
that
.
getContent
()
!==
'
string
'
)
{
that
.
error
({
status
:
22
,
statusText
:
'
Content Required
'
,
error
:
'
content_required
'
,
message
:
'
No data to put.
'
,
reason
:
'
no data to put
'
});
return
false
;
}
return
true
;
};
return
that
;
};
src/jio/commands/_putCommand.js
0 → 100644
View file @
90df066a
var
_putCommand
=
function
(
spec
,
my
)
{
var
that
=
command
(
spec
,
my
);
spec
=
spec
||
{};
my
=
my
||
{};
// Attributes //
var
priv
=
{};
// Methods //
that
.
getLabel
=
function
()
{
return
'
_put
'
;
};
/**
* Validates the storage handler.
* @param {object} handler The storage handler
*/
that
.
validate
=
function
()
{
return
that
.
validateState
();
};
that
.
executeOn
=
function
(
storage
)
{
storage
.
_put
(
that
);
};
return
that
;
};
src/jio/commands/_removeCommand.js
0 → 100644
View file @
90df066a
var
_removeCommand
=
function
(
spec
,
my
)
{
var
that
=
command
(
spec
,
my
);
spec
=
spec
||
{};
my
=
my
||
{};
// Attributes //
// Methods //
that
.
getLabel
=
function
()
{
return
'
_remove
'
;
};
that
.
executeOn
=
function
(
storage
)
{
storage
.
_remove
(
that
);
};
return
that
;
};
src/jio/commands/command.js
View file @
90df066a
...
@@ -11,6 +11,12 @@ var command = function(spec, my) {
...
@@ -11,6 +11,12 @@ var command = function(spec, my) {
'
remove
'
:
removeCommand
,
'
remove
'
:
removeCommand
,
'
allDocs
'
:
allDocsCommand
,
'
allDocs
'
:
allDocsCommand
,
'
putAttachment
'
:
putAttachmentCommand
'
putAttachment
'
:
putAttachmentCommand
'
_post
'
:
_postCommand
,
'
_put
'
:
_putCommand
,
'
_get
'
:
_getCommand
,
'
_remove
'
:
_removeCommand
,
'
_allDocs
'
:
_allDocsCommand
,
'
_putAttachment
'
:
_putAttachmentCommand
};
};
// creates the good command thanks to his label
// creates the good command thanks to his label
if
(
spec
.
label
&&
priv
.
commandlist
[
spec
.
label
])
{
if
(
spec
.
label
&&
priv
.
commandlist
[
spec
.
label
])
{
...
...
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