Skip to content

Commit

Permalink
Merge pull request #8 from toddjordan/remove-since-tag
Browse files Browse the repository at this point in the history
Remove since tag, get version from project-version relationship
  • Loading branch information
sivakumar-kailasam committed Apr 7, 2019
2 parents d665134 + 937ed5a commit 541f63c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function extractMethodsFromClasses(classes) {
currentClass.data.attributes.methods
.reduce((classMethods, currentMethod) => {
// Transform the current method and push on to methods.
classMethods.push(schemas.methodSchema(currentMethod))
classMethods.push(schemas.methodSchema(currentMethod, currentClass))
return classMethods
}, [])
// Merge all methods of all classes into a single array
Expand All @@ -187,7 +187,7 @@ function extractStaticFunctionsFromModules(modules) {

return moduleStaticFunctions
.reduce((moduleStaticFunctions, currentStaticFunction) => {
moduleStaticFunctions.push(schemas.methodSchema(currentStaticFunction))
moduleStaticFunctions.push(schemas.methodSchema(currentStaticFunction, currentModule))
return moduleStaticFunctions
}, [])
.concat(methods)
Expand Down
5 changes: 3 additions & 2 deletions lib/schemas/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
export default function classSchema(classObj) {
const data = classObj.data
const attributes = data.attributes
const versionId = data.relationships['project-version'].data.id;
const version = versionId.substring(versionId.lastIndexOf('-')+1);

return {
id: data.id,
Expand All @@ -14,8 +16,7 @@ export default function classSchema(classObj) {
namespace: attributes.namespace,
_tags: [
`module:${attributes.module}`,
`version:${attributes.version}`,
`since:${attributes.since}`
`version:${version}`
]
}
}
8 changes: 5 additions & 3 deletions lib/schemas/method.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
* @param {Object} method - An object with the method information.
* @returns {Object} - Transformed object
*/
export default function methodSchema(method) {
export default function methodSchema(method, versioned) {
let versionId = versioned.data.relationships['project-version'].data.id;
let version = versionId.substring(versionId.lastIndexOf('-')+1);

return {
file: method.file,
line: method.line,
Expand All @@ -17,8 +20,7 @@ export default function methodSchema(method) {

_tags: [
`module:${method.module}`,
`version:${method.version}`,
`since:${method.since}`
`version:${version}`
],

hierarchy: {
Expand Down
8 changes: 6 additions & 2 deletions lib/schemas/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
export default function moduleSchema(module) {
const data = module.data
const attributes = data.attributes

let versionId = data.relationships['project-version'].data.id;
let version = versionId.substring(versionId.lastIndexOf('-')+1);
return {
id: data.id,
name: attributes.name,
submodules: attributes.submodules,
namespaces: attributes.namespaces,
_tags: [`module:${attributes.name}`, `version:${attributes.version}`]
_tags: [
`module:${attributes.name}`,
`version:${version}`
]
}
}

0 comments on commit 541f63c

Please sign in to comment.