-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #870 from adpi2/category
Introduce categorization
- Loading branch information
Showing
21 changed files
with
1,653 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
core/shared/src/main/scala/scaladex/core/model/Category.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
package scaladex.core.model | ||
|
||
sealed trait Category { | ||
val label: String = { | ||
val name = getClass.getSimpleName.stripSuffix("$") | ||
val builder = name.foldLeft(new StringBuilder) { (builder, char) => | ||
if (char.isUpper && builder.nonEmpty) builder += '-' | ||
builder += char.toLower | ||
} | ||
builder.toString | ||
} | ||
|
||
val title: String = { | ||
val name = getClass.getSimpleName.stripSuffix("$") | ||
val builder = name.foldLeft(new StringBuilder) { (builder, char) => | ||
if (char.isUpper && builder.nonEmpty) builder += ' ' | ||
builder += char | ||
} | ||
builder.toString.replaceAll(" And ", " and ") | ||
} | ||
} | ||
|
||
object Category { | ||
val all: Seq[Category] = MetaCategory.all.flatMap(_.categories).distinct | ||
val byLabel: Map[String, Category] = all.map(category => category.label -> category).toMap | ||
|
||
case object AsynchronousAndReactiveProgramming extends Category | ||
case object DistributedComputing extends Category | ||
case object DistributedMessagingSystemsAndMicroservices extends Category | ||
case object Schedulers extends Category | ||
|
||
case object AudioAndMusic extends Category | ||
case object VideoAndImageProcessing extends Category | ||
|
||
case object DataSourcesAndConnectors extends Category | ||
case object DataVizualization extends Category | ||
|
||
case object CommandLineParsing extends Category | ||
case object ConfigurationAndEnvironment extends Category | ||
case object Logging extends Category | ||
case object PerformanceAndMonitoring extends Category | ||
case object Testing extends Category | ||
|
||
case object Databases extends Category | ||
case object IndexingAndSearching extends Category | ||
|
||
case object DatesAndTime extends Category | ||
case object GeometryAndGeopositionning extends Category | ||
case object UnitsOfMeasurement extends Category | ||
|
||
case object DeploymentAndCloud extends Category | ||
case object PackagingAndPublishing extends Category | ||
case object LibraryDependencyManagement extends Category | ||
case object Serverless extends Category | ||
case object VersionManagement extends Category | ||
case object VirtualizationAndContainerization extends Category | ||
|
||
case object BuildTools extends Category | ||
case object CodeAnalysis extends Category | ||
case object LintingAndRefactoring extends Category | ||
case object PrintingAndDebugging extends Category | ||
case object CodeEditorsAndNotebooks extends Category | ||
case object CodeFormatting extends Category | ||
case object ScriptingAndRepls extends Category { | ||
override val title: String = "Scripting and REPLs" | ||
} | ||
case object StaticSitesAndDocumentation extends Category | ||
case object MiscellaneousTools extends Category | ||
|
||
case object AlgorithmsAndDataStructures extends Category | ||
case object Caching extends Category | ||
case object Compilers extends Category | ||
case object CodeGeneration extends Category | ||
case object DependencyInjection extends Category | ||
case object FunctionnalProgrammingAndCategoryTheory extends Category | ||
case object LogicProgrammingAndTypeConstraints extends Category | ||
case object MiscellaneousUtils extends Category | ||
case object Parsing extends Category | ||
case object ScalaLanguageExtensions extends Category | ||
case object ProgrammingLanguageInterfaces extends Category | ||
|
||
case object Bioinformatics extends Category | ||
case object CryptographyAndHashing extends Category | ||
case object EconomyFinanceAndCryptocurrencies extends Category | ||
case object ProbabilityStatisticsAndMachineLearning extends Category | ||
case object NaturalLanguageProcessing extends Category | ||
case object NumericalAndSymbolicComputing extends Category | ||
|
||
case object Mobile extends Category | ||
case object GraphicalInterfacesAndGameDevelopment extends Category | ||
|
||
case object HardwareAndEmulators extends Category | ||
case object FileSystemsAndProcesses extends Category | ||
case object Network extends Category | ||
|
||
case object ArchivesAndCompression extends Category | ||
case object Csv extends Category { | ||
override val title: String = "CSV" | ||
} | ||
case object Json extends Category { | ||
override val title: String = "JSON" | ||
} | ||
case object Markdown extends Category | ||
case object Pdf extends Category { | ||
override val title: String = "PDF" | ||
} | ||
case object Serialization extends Category | ||
case object Templating extends Category | ||
case object TextManipulation extends Category | ||
case object OtherDocumentFormats extends Category | ||
case object Yaml extends Category { | ||
override val title: String = "YAML" | ||
} | ||
case object XmlHtmlAndDom extends Category { | ||
override val title: String = "XML/HTML and DOM" | ||
} | ||
|
||
case object AssetManagementAndBundlers extends Category | ||
case object AuthenticationAndPermissions extends Category | ||
case object Emailing extends Category | ||
case object FormsAndValidation extends Category | ||
case object HttpServersAndClients extends Category { | ||
override val title: String = "HTTP Servers and Clients" | ||
} | ||
case object Internationalization extends Category | ||
case object ThirdPartyApis extends Category { | ||
override val title: String = "Third-Party APIs" | ||
} | ||
case object UrlsAndRouting extends Category { | ||
override val title: String = "URLs and Routing" | ||
} | ||
case object WebFrontend extends Category | ||
case object SemanticWeb extends Category | ||
} |
183 changes: 183 additions & 0 deletions
183
core/shared/src/main/scala/scaladex/core/model/MetaCategory.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
package scaladex.core.model | ||
|
||
sealed trait MetaCategory { | ||
val label: String = { | ||
val name = getClass.getSimpleName.stripSuffix("$") | ||
val builder = name.foldLeft(new StringBuilder) { (builder, char) => | ||
if (char.isUpper && builder.nonEmpty) builder += '-' | ||
builder += char.toLower | ||
} | ||
builder.toString | ||
} | ||
|
||
val title: String | ||
val categories: Seq[Category] | ||
} | ||
|
||
object MetaCategory { | ||
def all: Seq[MetaCategory] = Seq( | ||
AsynchronousConcurrentAndDistributedProgramming, | ||
AudioImagesAndVideo, | ||
BigData, | ||
ConfigurationLoggingTestingAndMonitoring, | ||
DatabasesIndexingAndSearching, | ||
TimePositionsAndUnitsOfMeasurement, | ||
DeploymentVirtualizationAndCloud, | ||
DevelopmentTooling, | ||
GeneralComputerScience, | ||
MathematicsFinanceDataScienceAndBioinformatics, | ||
MobileDesktopAndGameDevelopment, | ||
OperatingSystemsAndHardware, | ||
TextFormatAndCompression, | ||
WebDevelopment | ||
) | ||
|
||
case object AsynchronousConcurrentAndDistributedProgramming extends MetaCategory { | ||
override val title: String = "Asynchronous, Concurrent and Distributed Programming." | ||
|
||
override val categories: Seq[Category] = Seq( | ||
Category.AsynchronousAndReactiveProgramming, | ||
Category.DistributedComputing, | ||
Category.DistributedMessagingSystemsAndMicroservices, | ||
Category.Schedulers | ||
) | ||
} | ||
case object AudioImagesAndVideo extends MetaCategory { | ||
override val title: String = "Audio, Images and Video" | ||
override val categories: Seq[Category] = Seq( | ||
Category.AudioAndMusic, | ||
Category.VideoAndImageProcessing | ||
) | ||
} | ||
case object BigData extends MetaCategory { | ||
override val title: String = "Big Data" | ||
override val categories: Seq[Category] = Seq( | ||
Category.DataSourcesAndConnectors, | ||
Category.DataVizualization, | ||
Category.DistributedComputing | ||
) | ||
} | ||
case object ConfigurationLoggingTestingAndMonitoring extends MetaCategory { | ||
override val title: String = "Configuration, Logging, Testing and Monitoring" | ||
override val categories: Seq[Category] = Seq( | ||
Category.CommandLineParsing, | ||
Category.ConfigurationAndEnvironment, | ||
Category.Logging, | ||
Category.PerformanceAndMonitoring, | ||
Category.Testing | ||
) | ||
} | ||
case object DatabasesIndexingAndSearching extends MetaCategory { | ||
override val title: String = "Databases, Indexing and Searching" | ||
override val categories: Seq[Category] = Seq( | ||
Category.Databases, | ||
Category.IndexingAndSearching | ||
) | ||
} | ||
case object TimePositionsAndUnitsOfMeasurement extends MetaCategory { | ||
override val title: String = "Dates, Time, Positions and Units of Measurement" | ||
override val categories: Seq[Category] = Seq( | ||
Category.DatesAndTime, | ||
Category.GeometryAndGeopositionning, | ||
Category.UnitsOfMeasurement | ||
) | ||
} | ||
case object DeploymentVirtualizationAndCloud extends MetaCategory { | ||
override val title: String = "Deployment, Virtualization and Cloud" | ||
override val categories: Seq[Category] = Seq( | ||
Category.DeploymentAndCloud, | ||
Category.PackagingAndPublishing, | ||
Category.LibraryDependencyManagement, | ||
Category.Serverless, | ||
Category.VersionManagement, | ||
Category.VirtualizationAndContainerization | ||
) | ||
} | ||
case object DevelopmentTooling extends MetaCategory { | ||
override val title = "Development Tooling" | ||
override val categories: Seq[Category] = Seq( | ||
Category.BuildTools, | ||
Category.CodeAnalysis, | ||
Category.LintingAndRefactoring, | ||
Category.PrintingAndDebugging, | ||
Category.CodeEditorsAndNotebooks, | ||
Category.CodeFormatting, | ||
Category.ScriptingAndRepls, | ||
Category.StaticSitesAndDocumentation, | ||
Category.MiscellaneousTools | ||
) | ||
} | ||
case object GeneralComputerScience extends MetaCategory { | ||
override val title: String = "General Computer Science" | ||
override val categories: Seq[Category] = Seq( | ||
Category.AlgorithmsAndDataStructures, | ||
Category.Caching, | ||
Category.Compilers, | ||
Category.CodeGeneration, | ||
Category.DependencyInjection, | ||
Category.FunctionnalProgrammingAndCategoryTheory, | ||
Category.LogicProgrammingAndTypeConstraints, | ||
Category.MiscellaneousUtils, | ||
Category.Parsing, | ||
Category.ScalaLanguageExtensions, | ||
Category.ProgrammingLanguageInterfaces | ||
) | ||
} | ||
case object MathematicsFinanceDataScienceAndBioinformatics extends MetaCategory { | ||
override val title: String = "Mathetmatics, Finance, Data Science and Bioinformatics" | ||
override val categories: Seq[Category] = Seq( | ||
Category.Bioinformatics, | ||
Category.CryptographyAndHashing, | ||
Category.EconomyFinanceAndCryptocurrencies, | ||
Category.ProbabilityStatisticsAndMachineLearning, | ||
Category.NaturalLanguageProcessing, | ||
Category.NumericalAndSymbolicComputing | ||
) | ||
} | ||
case object MobileDesktopAndGameDevelopment extends MetaCategory { | ||
override val title: String = "Mobile, Desktop and Game Development" | ||
override val categories: Seq[Category] = Seq( | ||
Category.Mobile, | ||
Category.GraphicalInterfacesAndGameDevelopment | ||
) | ||
} | ||
case object OperatingSystemsAndHardware extends MetaCategory { | ||
override val title: String = "Operating System, Hardware and Robotics" | ||
override val categories: Seq[Category] = Seq( | ||
Category.HardwareAndEmulators, | ||
Category.FileSystemsAndProcesses, | ||
Category.Network | ||
) | ||
} | ||
case object TextFormatAndCompression extends MetaCategory { | ||
override val title: String = "Text, Formats and Compression" | ||
override val categories: Seq[Category] = Seq( | ||
Category.ArchivesAndCompression, | ||
Category.Csv, | ||
Category.Json, | ||
Category.Markdown, | ||
Category.Pdf, | ||
Category.Serialization, | ||
Category.TextManipulation, | ||
Category.OtherDocumentFormats, | ||
Category.Yaml | ||
) | ||
} | ||
case object WebDevelopment extends MetaCategory { | ||
override val title: String = "Web Development" | ||
override val categories: Seq[Category] = Seq( | ||
Category.AssetManagementAndBundlers, | ||
Category.AuthenticationAndPermissions, | ||
Category.Emailing, | ||
Category.FormsAndValidation, | ||
Category.HttpServersAndClients, | ||
Category.Internationalization, | ||
Category.SemanticWeb, | ||
Category.Templating, | ||
Category.ThirdPartyApis, | ||
Category.UrlsAndRouting, | ||
Category.WebFrontend, | ||
Category.XmlHtmlAndDom | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
core/shared/src/test/scala/scaladex/core/model/CategoryTests.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package scaladex.core.model | ||
|
||
import org.scalatest.funspec.AnyFunSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
class CategoryTests extends AnyFunSpec with Matchers { | ||
it("should compute category label and title") { | ||
Category.AlgorithmsAndDataStructures.label shouldBe "algorithms-and-data-structures" | ||
Category.AlgorithmsAndDataStructures.title shouldBe "Algorithms and Data Structures" | ||
} | ||
|
||
it("should compute meta-category label") { | ||
MetaCategory.AsynchronousConcurrentAndDistributedProgramming.label shouldBe "asynchronous-concurrent-and-distributed-programming" | ||
} | ||
} |
Oops, something went wrong.