Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ buildConfig {
packageName = 'app'
buildConfigField 'int', 'VERSION_CODE', '1'
buildConfigField 'String', 'VERSION', '0.0.1'
buildConfigField 'String', 'PROFILE_URL', 'https://sourcerer.io/'
}

mainClassName = "app.MainKt"
Expand All @@ -37,7 +38,7 @@ repositories {
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "com.beust:jcommander:1.72"
compile 'com.google.protobuf:protobuf-java:3.0.0'
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/app/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Config (
var localRepos: MutableSet<LocalRepo> = mutableSetOf()
) {
fun addRepo(repo: LocalRepo) {
localRepos.remove(repo) // Fields may be updated.
localRepos.add(repo)
}

Expand Down
10 changes: 6 additions & 4 deletions src/main/kotlin/app/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package app

import app.model.LocalRepo
import app.model.Repo
import app.ui.ConsoleUi
import app.utils.CommandConfig
import app.utils.CommandAdd
Expand All @@ -13,6 +12,7 @@ import app.utils.CommandRemove
import app.utils.Options
import app.utils.PasswordHelper
import app.utils.RepoHelper
import app.utils.UiHelper
import com.beust.jcommander.JCommander

fun main(argv: Array<String>) {
Expand Down Expand Up @@ -61,7 +61,9 @@ fun startUi() {
fun doAdd(commandAdd: CommandAdd) {
val path = commandAdd.path
if (path != null && RepoHelper.isValidRepo(path)) {
Configurator.addLocalRepoPersistent(LocalRepo(path))
val localRepo = LocalRepo(path)
localRepo.hashAllContributors = commandAdd.hashAll
Configurator.addLocalRepoPersistent(localRepo)
Configurator.saveToFile()
println("Added git repository at $path.")
} else {
Expand Down Expand Up @@ -103,8 +105,8 @@ fun doRemove(commandRemove: CommandRemove) {

fun doSetup() {
if (!Configurator.isFirstLaunch()) {
println("Are you sure that you want to setup Sourcerer again? [y/n]")
if ((readLine() ?: "").toLowerCase() == "y") {
if (UiHelper.confirm("Are you sure that you want to setup Sourcerer "
+ "again?", defaultIsYes = false)) {
Configurator.resetAndSave()
}
}
Expand Down
Loading