Skip to content
Open
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
108 changes: 108 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@

# Created by https://www.gitignore.io/api/macos,gradle,intellij+all

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Ruby plugin and RubyMine
/.rakeTasks

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij+all Patch ###
# Ignores the whole idea folder
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Gradle ###
.gradle
**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties


# End of https://www.gitignore.io/api/macos,gradle,intellij+all
72 changes: 72 additions & 0 deletions task1/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
group 'spbau'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0'
}
}


repositories {
mavenCentral()
}

ext.junit4Version = '4.12'
ext.junitVintageVersion = '4.12.0'
ext.junitPlatformVersion = '1.0.0'
ext.junitJupiterVersion = '5.0.0'
ext.log4jVersion = '2.6.2'

apply plugin: 'java'
apply plugin: 'org.junit.platform.gradle.plugin'
apply plugin: 'idea'

compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
options.compilerArgs += '-parameters'
}

junitPlatform {
filters {
engines {
}
tags {
exclude 'slow'
}
}
logManager 'org.apache.logging.log4j.jul.LogManager'


}

jar {
manifest {
attributes "Main-Class": "start.MainClass"
}

from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}

sourceCompatibility = 1.8

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'

testCompile("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")
compile group: 'commons-cli', name: 'commons-cli', version: '1.2'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5'
}

build.mustRunAfter(clean)
13 changes: 13 additions & 0 deletions task1/description/Description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
##Описание

Архитектура проекта выглядит следующий образом:
- Класс Лексер (Lexer) осуществляет разбиение входной строки на набор лексем. Делает это он последовательным двойным парсингом:
- Изначально строка разбивается на набор токенов вида: пайп "|", слово, содержащее присваивание и просто обычное слово
- Далее токены слов (с присваиванием и без) парсятся на более конкретные токены, такие как слово в двойной или одинарной кавычке, команда, операция присваивания и аргумент.
- В итоге внутри лексера содержится массив с готовым набором токенов, который Лексер может отдать с помощью соответствующего метода.
- Класс Interpolation осущетсвляет интерполирование, переданной ему строки значениями из доступного ему окружения переменных.
- Класс Preparater обьединяет токены, относящие к одной команде воедино, перед этим предварительно проинтерполировав токены с помощ класса Interpolation. В итоге он отдаёт цельные команды с выделенным методом и аргументами.
- Класс CommandManager последовательно выполняет полученный набор комманд. Проверяет какая команда и вызывает соответсвующую. Если ему комманда не извествна, то вызывает комманду из системы. В итоге выполнения всех комманд этот класс выводит результат в консоль.
- Класс Environment является таблицей используемых имён переменных
- Класс AbstractCommand является абстрактным классом для доступных комманд cli, от которого наследуются конкретные комманды.

Binary file added task1/description/UML.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions task1/description/whyIchooseApachCli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ответ очень прост: когда-то давно я уже пользовался этой библиотекой и поэтому знаю что к чему в ней. А новую изучать не вижу смысла, если и эта хорошо себя показывает.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Золотой Молоток". Примерно как "почему я программирую на Java? Потому что я всю жизнь программировал на Java, и отец мой программировал на Java, и дед мой программировал на Java, и никогда с ней проблем не было" :)

Binary file added task1/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions task1/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Fri Feb 23 15:25:15 MSK 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
172 changes: 172 additions & 0 deletions task1/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading