Completed
Push — master ( 439767...1fc2c9 )
by
unknown
02:46
created

src/cli/cms/operations/post.js   A

Complexity

Total Complexity 5
Complexity/F 2.5

Size

Lines of Code 34
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 5
c 1
b 0
f 0
nc 1
mnd 2
bc 4
fnc 2
dl 0
loc 34
rs 10
bpm 2
cpm 2.5
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
B post.js ➔ unpublish 0 23 4
1
import path from 'path'
2
3
import {
4
  cmsOperations
5
  ,coreUtils
6
  ,config
7
  ,Manager
8
  ,FileParser
9
} from '../../'
10
11
12
export function unpublish(filePath) {
13
  var tplUrl = FileParser.getFileDataFromUrl(path.join(config.publish.url, filePath))
14
  if(coreUtils.file.exist(tplUrl.json.path)) {
15
    var json = JSON.parse(JSON.stringify(FileParser.getJson(tplUrl.json.path)))
16
    if(typeof json.abe_meta.publish !== 'undefined' && json.abe_meta.publish !== null) {
17
      delete json.abe_meta.publish
18
    }
19
20
    cmsOperations.save.save(
21
      path.join(config.root, config.draft.url, json.abe_meta.link.replace(config.root)),
22
      json.abe_meta.template,
23
      json,
24
      '',
25
      'reject',
26
      null,
27
      'reject'
28
    )
29
    .then((resSave) => {
0 ignored issues
show
Unused Code introduced by
The parameter resSave is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
30
      FileParser.removeFile(tplUrl.publish.path, tplUrl.publish.json)
31
      Manager.instance.updateList()
32
    })
33
  }
34
}