Skip to content

Commit

Permalink
Replace pg-tools with pg-verify as to please rubygems
Browse files Browse the repository at this point in the history
  • Loading branch information
Arian Weber authored and Arian Weber committed Feb 12, 2024
1 parent ff9dcb6 commit d2568c2
Show file tree
Hide file tree
Showing 79 changed files with 169 additions and 169 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source "https://rubygems.org"

# Specify your gem's dependencies in pg-tools.gemspec
# Specify your gem's dependencies in pg-verify.gemspec
gemspec

gem "rake", "~> 13.0"
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
pg-tools (0.1.0)
pg-verify (0.1.0)
config (~> 4.2.1)
ebnf (~> 2.3.4)
plantuml_builder (~> 0.3.0)
Expand Down Expand Up @@ -90,7 +90,7 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
pg-tools!
pg-verify!
rake (~> 13.0)
rspec (~> 3.0)

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# PgTools
# PgVerify

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pg-tools`. To experiment with that code, run `bin/console` for an interactive prompt.
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pg-verify`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

## Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add pg-tools
$ bundle add pg-verify

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install pg-tools
$ gem install pg-verify

## Usage

Expand All @@ -26,4 +26,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pg-tools.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pg-verify.
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_ruby_version(version)

# Generate docker file
dockerfile_path = File.join(".pg-work", "Dockerfile")
image_name = "pg-tools-test"
image_name = "pg-verify-test"
dockerfile = [ "FROM ruby:#{version}" ]
File.write(dockerfile_path, dockerfile.join("\n"))
sh "docker build --file #{dockerfile_path} --tag #{image_name} ."
Expand All @@ -40,13 +40,13 @@ def test_ruby_version(version)
test_cmd << "bundle exec rspec"
test_cmd << "bundle exec rake build"
test_cmd << "gem install pkg/*"
test_cmd << "pg-tools --help"
test_cmd << "pg-tools doctor"
test_cmd << "pg-verify --help"
test_cmd << "pg-verify doctor"
test_cmd = test_cmd.join(" && ")

docker_run = [ "docker run" ]
docker_run << "--rm"
docker_run << "--name pg-tools-container"
docker_run << "--name pg-verify-container"
docker_run << "--mount type=bind,source='#{Dir.pwd}',target=/app"
docker_run << "--workdir /app"
docker_run << image_name
Expand Down
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# frozen_string_literal: true

require "bundler/setup"
require "pg-tools"
require "pg-verify"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand Down
6 changes: 3 additions & 3 deletions bin/pg-verify.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require "bundler/setup"
require 'pg-tools'
require 'pg-verify'

module PgTools
module PgVerify

class PgToolsCLI
class PgVerifyCLI

def run()
begin
Expand Down
4 changes: 2 additions & 2 deletions data/config/pg-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ puml:

# Configuration for the Ruby DSL
ruby_dsl:
# Default model definition script file when pg-tools is invoked without arguments
# Default model definition script file when pg-verify is invoked without arguments
default_script_name: "program-graph.rb"

# Enable/Disable colored printing all together
use_colors: true
# Enable/Disable colored printing when the output of pg-tools
# Enable/Disable colored printing when the output of pg-verify
# is not piped into a TTY directly.
use_colors_in_pipe: false
# Print full stack traces on any error.
Expand Down
8 changes: 4 additions & 4 deletions data/project-template/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Welcome to your project 🎉

PG tools is a CLI application which allows you to develop program graph models
PG verify is a CLI application which allows you to develop program graph models
and verify characteristics of those models.

To get started you can run `pg-tools doctor` to verify your installation and guide
To get started you can run `pg-verify doctor` to verify your installation and guide
you through the steps needed to install external addons like the NuSMV model checker.

You can always run `pg-tools help` to get a list of available commands.
For example try running `pg-tools show png` to render a PNG image of your program graph
You can always run `pg-verify help` to get a list of available commands.
For example try running `pg-verify show png` to render a PNG image of your program graph
and save that to your working directory.

## Project files
Expand Down
4 changes: 2 additions & 2 deletions devpg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

# Simple wrapper to run pg-tools during development.
# Simple wrapper to run pg-verify during development.

ruby -Ilib ./exe/pg-tools "$@"
ruby -Ilib ./exe/pg-verify "$@"
18 changes: 9 additions & 9 deletions doc/expose/expose.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PG-Tools
# pg-verify

PG-Tools ist ein textbasiertes CLI-Programm zur Entwicklung und Einbindung von
pg-verify ist ein textbasiertes CLI-Programm zur Entwicklung und Einbindung von
Programmgraphen im Kontext der formalen Sicherheitsanalyse.

Ziel ist es, ein anwenderfreundliches, robustes und zukunftssicheres System zu entwickeln,
Expand All @@ -26,7 +26,7 @@ Das folgende Bild zeigt also nur ein Beispiel.

Links im Bild sieht man die Definition eines Programmgraphen über die
Ruby DSL. Rechts sieht man die generierte Grafik. Die Grafik wird aktualisiert sobald
man `pg-tools show` ausführt, so wie unten abgebildet.
man `pg-verify show` ausführt, so wie unten abgebildet.

### Das Weidezaun-Beispiel in der Ruby DSL

Expand Down Expand Up @@ -101,7 +101,7 @@ Und hier die generierte Grafik:
![alt text](./validity.png)

Oben im Bild ist die Definition von Spezifikationen zur Validitätsprüfung dargestellt.
Führt man `pg-tools test` aus, erhält man die unten dargestellte Ausgabe.
Führt man `pg-verify test` aus, erhält man die unten dargestellte Ausgabe.
(Das Feature ist noch nicht implementiert. Tatsächlich wären hier einige Tests fehlgeschlagen.)
Die Syntax ist vom beliebten Test-Framework [Rspec](https://rspec.info/) inspiriert.
Im Fehlerfall würde der Ablauf ausgegeben, der die Formel verletzt.
Expand Down Expand Up @@ -137,7 +137,7 @@ specify "The train" do
end
end

# Definition einer Gefährdung für die DCCA. Ausführbar mit: 'pg-tools dcca'
# Definition einer Gefährdung für die DCCA. Ausführbar mit: 'pg-verify dcca'
hazard "Train on unsecured railroad crossing" \
=> :"Barrier.angle > #{barrier_closed_angle} && Train.position >= #{train_pos_gep} && Train.position <= #{tain_pos_sp}"
```
Expand Down Expand Up @@ -259,7 +259,7 @@ Language Servers ermöglichen es, effizient Sprach-Features zu implementieren. D
- Fehler-Überprüfung und -diagnose
- Springen zur Definition einer Funktion

Wir möchten versuchen, pg-tools in einen Language Server zu integrieren. Allerdings wissen wir mangels eigener Erfahrung nicht, ob das mit angemessenem Aufwand möglich ist und können deshalb nicht versprechen, dass dieses Fearture am Ende im Produkt enthalten sein wird.
Wir möchten versuchen, pg-verify in einen Language Server zu integrieren. Allerdings wissen wir mangels eigener Erfahrung nicht, ob das mit angemessenem Aufwand möglich ist und können deshalb nicht versprechen, dass dieses Fearture am Ende im Produkt enthalten sein wird.

Durch diese Integration möchten wir den Entwickler:innen ermöglichen:
- Sich auf die Modellierung der Graphen zu konzentrieren, anstatt wieder und wieder die gleiche Variable auszuschreiben
Expand Down Expand Up @@ -290,8 +290,8 @@ Im Folgenden haben wir einige Ideen für Features aufgelistet:
- Integriertes Test-Framework zur Validitätsprüfung
- Deklarative Syntax zur Verwendung der "LTL-Pattern" aus der Vorlesung
- Automatische DCCA
- Installation über ein Kommando (`gem install pg-tools`)
- Einfache Einarbeitung (mit Kommando `pg-tools init`)
- Installation über ein Kommando (`gem install pg-verify`)
- Einfache Einarbeitung (mit Kommando `pg-verify init`)
- Hier wird ein Beispielprojekt angelegt um die Projektstruktur vorzugeben
- Ansprechende Dokumentation
- Konfigurationsmöglichkeiten
Expand Down Expand Up @@ -349,7 +349,7 @@ auf verschiednen Systemen sichergestellt werden.
CLI-Programme können einfach in Arbeitsabläufe eingebunden werden.
Beispielsweise wäre es möglich, Tests für Modelle zu schreiben, die mittels "continuous integration"
für jeden Pull Request auf GitHub ausgeführt werden.
(Das `pg-tools init` Kommando könnte eine solche CI Pipeline automatisch definieren)
(Das `pg-verify init` Kommando könnte eine solche CI Pipeline automatisch definieren)

## Zielgruppe

Expand Down
4 changes: 2 additions & 2 deletions exe/pg-verify
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
require_relative '../bin/pg-tools.rb'
require_relative '../bin/pg-verify.rb'

PgTools::PgToolsCLI.new.run()
PgVerify::PgVerifyCLI.new.run()
32 changes: 16 additions & 16 deletions lib/pg-verify.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# frozen_string_literal: true

require_relative "pg-tools/version"
require_relative "pg-tools/core/core.rb"
require_relative "pg-tools/shell/shell.rb"
require_relative "pg-tools/doctor/doctor.rb"
require_relative "pg-tools/model/model.rb"
require_relative "pg-tools/interpret/interpret.rb"
require_relative "pg-tools/cli/cli.rb"
require_relative "pg-tools/transform/transform.rb"
require_relative "pg-tools/nusmv/nusmv.rb"
require_relative "pg-tools/puml/puml.rb"
require_relative "pg-tools/simulation/simulation.rb"
require_relative "pg-verify/version"
require_relative "pg-verify/core/core.rb"
require_relative "pg-verify/shell/shell.rb"
require_relative "pg-verify/doctor/doctor.rb"
require_relative "pg-verify/model/model.rb"
require_relative "pg-verify/interpret/interpret.rb"
require_relative "pg-verify/cli/cli.rb"
require_relative "pg-verify/transform/transform.rb"
require_relative "pg-verify/nusmv/nusmv.rb"
require_relative "pg-verify/puml/puml.rb"
require_relative "pg-verify/simulation/simulation.rb"
require 'config'
require 'fileutils'
require 'open3'

module PgTools
module PgVerify

def self.init()
config_paths = []
config_paths << File.expand_path('data/config/pg-tools.yml', self.root)
config_paths << File.expand_path('.pg-tools.yml', Dir.home)
config_paths << File.expand_path('.pg-tools.yml', Dir.pwd)
config_paths << File.expand_path('data/config/pg-verify.yml', self.root)
config_paths << File.expand_path('.pg-verify.yml', Dir.home)
config_paths << File.expand_path('.pg-verify.yml', Dir.pwd)
config_paths.select! { |path| File.file?(path) }
Config.load_and_set_settings(*config_paths)

Expand All @@ -44,4 +44,4 @@ def self.tmp_file(relative_path)

end

PgTools.init()
PgVerify.init()
10 changes: 5 additions & 5 deletions lib/pg-verify/cli/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'thor'
require 'plantuml_builder'

module PgTools
module PgVerify
module Cli

class ShowCommand < Thor
Expand Down Expand Up @@ -180,7 +180,7 @@ def simulate()

end

desc "init", "Initialize a new pg-tools project"
desc "init", "Initialize a new pg-verify project"
method_option :directory, :type => :string
def init()

Expand All @@ -194,7 +194,7 @@ def init()
FileUtils.mkdir_p(target)

# Copy files to target
template_dir = File.join(PgTools.root, "data", "project-template")
template_dir = File.join(PgVerify.root, "data", "project-template")
files = Dir.glob(File.join(template_dir, '**', '*'), File::FNM_DOTMATCH).select { |f| File.file?(f) }
files.each { |f|
target_file = File.join(target, f.sub(template_dir, ""))
Expand All @@ -204,7 +204,7 @@ def init()
}
# Copy the actual default config into the project as that
# will contain all keys and should be commented
FileUtils.cp(File.join(PgTools.root, "data", "config", "pg-tools.yml"), File.join(target, ".pg-tools.yml"))
FileUtils.cp(File.join(PgVerify.root, "data", "config", "pg-verify.yml"), File.join(target, ".pg-verify.yml"))

# Initialize git project
Dir.chdir(target) {
Expand All @@ -215,7 +215,7 @@ def init()

puts "Successfully initialized project at #{target.c_file}!"
puts "You can read the #{'README.md'.c_file} to get started."
puts "Run #{'pg-tools doctor'.c_blue} and follow the instructions to set up your environment!"
puts "Run #{'pg-verify doctor'.c_blue} and follow the instructions to set up your environment!"
end

desc "doctor", "Check for common problems"
Expand Down
4 changes: 2 additions & 2 deletions lib/pg-verify/core/cmd_runner.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module PgTools
module PgVerify

module Core

Expand Down Expand Up @@ -131,7 +131,7 @@ def self.command_exists?(command)
!run_or_return("command -v '#{command}'", nil).nil?
end

class CMDRunnerError < PgTools::Core::Error
class CMDRunnerError < PgVerify::Core::Error
def initialize(cmd, output, err, delta_seconds)
@cmd, @output, @err, @delta_seconds = cmd, output, err, delta_seconds
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pg-verify/core/core.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module PgTools
module PgVerify

module Core

Expand Down
6 changes: 3 additions & 3 deletions lib/pg-verify/core/extensions/string_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ def grep(str, e)
end

def display_length()
str = PgTools::Colorizer.uncolorize(self)
str = PgVerify::Colorizer.uncolorize(self)
str.length() + ( str.count("\t") * 4 )
end

def line_combine(other, separator: " ")
PgTools::StringUtil.line_combine(self, other, separator: separator)
PgVerify::StringUtil.line_combine(self, other, separator: separator)
end

def indented(num: 1, str: " " * 4)
PgTools::StringUtil.indented(self, num_indents: num, indent_string: str)
PgVerify::StringUtil.indented(self, num_indents: num, indent_string: str)
end

def remove_before(substring)
Expand Down
4 changes: 2 additions & 2 deletions lib/pg-verify/core/shell/colorizer.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rainbow"

module PgTools
module PgVerify

# A Module for easy coloration of strings with theme support.
# After #attach is called strings can be colored using one of any c_ or bg_ methods
Expand Down Expand Up @@ -128,7 +128,7 @@ def self.attach(theme, use_colors: true)
use_colors = Settings.use_colors
use_colors &&= Settings.use_colors_in_pipe if !$stdout.isatty
Rainbow.enabled = use_colors
String.class_eval { include PgTools::Colorizer }
String.class_eval { include PgVerify::Colorizer }
end

end
Expand Down
2 changes: 1 addition & 1 deletion lib/pg-verify/core/util.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module PgTools
module PgVerify


module TimeUtil
Expand Down
Loading

0 comments on commit d2568c2

Please sign in to comment.