Skip to content

Commit 6cc9749

Browse files
release: 0.1.2
release: 0.1.2
2 parents 5e8bb0a + 6f01706 commit 6cc9749

25 files changed

+775
-386
lines changed

README.md

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
<h1 align="center">
2-
<br>
3-
<a href="https://sourcerer.io"><img src="https://user-images.githubusercontent.com/29913247/31576516-0ce3e9ae-b105-11e7-9a8b-89f96bd44a3d.png" alt="Sourcerer" width="200"></a>
4-
<br>
5-
Sourcerer App
6-
<br>
7-
</h1>
81

9-
<h3 align="center">
10-
Sourcerer app creates an intelligent profile for software engineers
11-
</h3>
2+
<h1 style="font-weight:normal">
3+
<a href="https://sourcerer.io"><img src=https://user-images.githubusercontent.com/20287615/34189346-d426d4c2-e4ef-11e7-9da4-cc76a1ed111d.png alt="Sourcerer Logo", width=50></a>
4+
sourcerer.io
5+
</h1>
6+
An intelligent profile for software engineers
127
<br>
138

149
What is it?
1510
===========
1611

12+
![profile-sliced-sized](https://user-images.githubusercontent.com/20287615/34188912-b3aaf8ba-e4ed-11e7-861c-2adf13a921ac.png)
13+
<br>
14+
1715
Once you feed it some git repos, you will get a beautiful profile that will help
1816
you learn things about yourself, connect to others, and become a better
1917
engineer. Example profiles: <https://sourcerer.io/sergey>,
20-
<https://sourcerer.io/frankie>, <https://sourcerer.io/ice1snice>.
18+
<https://sourcerer.io/frankie>, <https://sourcerer.io/ice1snice>, <https://sourcerer.io/wemmer>.
2119

2220
Profile is the first step. Some of the things on our roadmap:
2321
news that is relevant to your code, engineers to follow and learn from,
@@ -32,13 +30,13 @@ is a good start as it describes the client-server protocol.
3230

3331
You will need an account, sign up on <https://sourcerer.io/>
3432

35-
Prerequirements
36-
=================
33+
Requirements
34+
============
3735

38-
* Sourcerer alpha/beta access
3936
* Linux or macOS
4037
* Java 8+ Platform ([JRE](http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html) for Linux or [JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) for macOS)
4138
* Git repositories with master branch with at least one commit
39+
* Account on <https://sourcerer.io/>
4240

4341
Install/uninstall
4442
=================

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ buildConfig {
3636
buildConfigField 'String', 'PROFILE_URL', 'https://sourcerer.io/'
3737

3838
// App version.
39-
buildConfigField 'int', 'VERSION_CODE', '3'
40-
buildConfigField 'String', 'VERSION', '0.1.0'
39+
buildConfigField 'int', 'VERSION_CODE', '4'
40+
buildConfigField 'String', 'VERSION', '0.1.2'
4141

4242
// Logging.
4343
buildConfigField 'String', 'ENV', project.hasProperty('env') ? env : 'production'

do.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ GRADLE_VERSION=4.2.0
3939
# run only inside build container
4040
build_jar_inside() {
4141
if [ "$NAMESPACE" == "sandbox" ]; then
42-
API="https://sandbox.eng.sourcerer.io/api/commit"
42+
API="http://sandbox.sourcerer/api/commit"
4343
elif [ "$NAMESPACE" == "staging" ]; then
44-
API="https://staging.eng.sourcerer.io/api/commit"
44+
API="http://staging.sourcerer/api/commit"
4545
elif [ "$NAMESPACE" == "local" ]; then
4646
API="http://localhost:3181"
4747
else

src/main/kotlin/app/FactCodes.kt

+3
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ object FactCodes {
2323
val VARIABLE_NAMING_SNAKE_CASE = 0
2424
val VARIABLE_NAMING_CAMEL_CASE = 1
2525
val VARIABLE_NAMING_OTHER = 2
26+
val INDENTATION = 14
27+
val INDENTATION_TABS = 0
28+
val INDENTATION_SPACES = 1
2629
}

src/main/kotlin/app/Logger.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ object Logger {
9393
}
9494

9595
private fun configLevelValue() : Int {
96-
val a = mapOf("trace" to TRACE, "debug" to DEBUG, "info" to INFO, "warn" to WARN, "error" to ERROR)
96+
val a = mapOf("trace" to TRACE, "debug" to DEBUG, "info" to INFO,
97+
"warn" to WARN, "error" to ERROR)
9798
return a.getValue(BuildConfig.LOG_LEVEL)
9899
}
99100

src/main/kotlin/app/Main.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import app.utils.CommandConfig
1111
import app.utils.CommandAdd
1212
import app.utils.CommandList
1313
import app.utils.CommandRemove
14+
import app.utils.FileHelper.toPath
1415
import app.utils.Options
1516
import app.utils.PasswordHelper
1617
import app.utils.RepoHelper
@@ -75,9 +76,9 @@ class Main(argv: Array<String>) {
7576
}
7677

7778
private fun doAdd(commandAdd: CommandAdd) {
78-
val path = commandAdd.path
79+
val path = commandAdd.path?.toPath()
7980
if (path != null && RepoHelper.isValidRepo(path)) {
80-
val localRepo = LocalRepo(path)
81+
val localRepo = LocalRepo(path.toString())
8182
localRepo.hashAllContributors = commandAdd.hashAll
8283
configurator.addLocalRepoPersistent(localRepo)
8384
configurator.saveToFile()

src/main/kotlin/app/extractors/Extractor.kt

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Extractor : ExtractorInterface {
2828
in GoExtractor.FILE_EXTS -> GoExtractor()
2929
in ObjectiveCExtractor.FILE_EXTS -> ObjectiveCExtractor()
3030
in SwiftExtractor.FILE_EXTS -> SwiftExtractor()
31+
in KotlinExtractor.FILE_EXTS -> KotlinExtractor()
3132
else -> CommonExtractor()
3233
}
3334
}

src/main/kotlin/app/extractors/JavaExtractor.kt

+2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ class JavaExtractor : ExtractorInterface {
7979
override fun tokenize(line: String): List<String> {
8080
val importRegex = Regex("""^(.*import)\s[^\n]*""")
8181
val commentRegex = Regex("""^([^\n]*//)[^\n]*""")
82+
val packageRegex = Regex("""^(.*package)\s[^\n]*""")
8283
var newLine = importRegex.replace(line, "")
8384
newLine = commentRegex.replace(newLine, "")
85+
newLine = packageRegex.replace(newLine, "")
8486
return super.tokenize(newLine)
8587
}
8688

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Copyright 2017 Sourcerer Inc. All Rights Reserved.
2+
// Author: Liubov Yaronskaya ([email protected])
3+
4+
package app.extractors
5+
6+
import app.model.CommitStats
7+
import app.model.DiffFile
8+
9+
class KotlinExtractor : ExtractorInterface {
10+
companion object {
11+
val LANGUAGE_NAME = "kotlin"
12+
val FILE_EXTS = listOf("kt")
13+
val LIBRARIES = ExtractorInterface.getLibraries(LANGUAGE_NAME)
14+
val evaluator by lazy {
15+
ExtractorInterface.getLibraryClassifier(LANGUAGE_NAME)
16+
}
17+
}
18+
19+
override fun extract(files: List<DiffFile>): List<CommitStats> {
20+
files.map { file -> file.language = LANGUAGE_NAME }
21+
return super.extract(files)
22+
}
23+
24+
override fun extractImports(fileContent: List<String>): List<String> {
25+
val imports = mutableSetOf<String>()
26+
27+
val regex = Regex("""import\s+(\w+[.\w+]*)""")
28+
fileContent.forEach {
29+
val res = regex.find(it)
30+
if (res != null) {
31+
val importedName = res.groupValues[1]
32+
LIBRARIES.forEach { library ->
33+
if (importedName.startsWith(library)) {
34+
imports.add(library)
35+
}
36+
}
37+
}
38+
}
39+
40+
return imports.toList()
41+
}
42+
43+
override fun tokenize(line: String): List<String> {
44+
val importRegex = Regex("""^(.*import)\s[^\n]*""")
45+
val commentRegex = Regex("""^([^\n]*//)[^\n]*""")
46+
val packageRegex = Regex("""^(.*package)\s[^\n]*""")
47+
var newLine = importRegex.replace(line, "")
48+
newLine = commentRegex.replace(newLine, "")
49+
newLine = packageRegex.replace(newLine, "")
50+
return super.tokenize(newLine)
51+
}
52+
53+
override fun getLineLibraries(line: String,
54+
fileLibraries: List<String>): List<String> {
55+
56+
return super.getLineLibraries(line, fileLibraries, evaluator, LANGUAGE_NAME)
57+
}
58+
}

0 commit comments

Comments
 (0)