stuka 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +1 -1
- data/bin/stuka +6 -0
- data/lib/stuka/commands/command.rb +32 -0
- data/lib/stuka/commands/concrete_commands/new_command.rb +30 -0
- data/lib/stuka/commands/concrete_commands/process_command.rb +23 -0
- data/lib/stuka/commands/concrete_commands/setup_command.rb +26 -0
- data/lib/stuka/commands/concrete_commands/step_command.rb +24 -0
- data/lib/stuka/stuka_cli.rb +17 -0
- data/lib/stuka/templates/configs/gemfile.tt +3 -0
- data/lib/stuka/templates/configs/tasks.tt +4 -0
- data/lib/stuka/templates/definitions/process.tt +7 -0
- data/lib/stuka/templates/definitions/step.tt +8 -0
- data/lib/stuka/templates/samples/my_first_step.tt +9 -0
- data/lib/stuka/templates/samples/my_process.tt +19 -0
- data/lib/stuka/templates/samples/my_second_step.tt +9 -0
- data/lib/stuka/version.rb +1 -1
- data/lib/stuka.rb +2 -5
- data/stuka.gemspec +2 -0
- metadata +32 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bdd0bcc368a78173689529072b5b24b3350989d
|
4
|
+
data.tar.gz: 681794b654461bfd78a24e716c40b0e83ad3e329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f61206b551a32072185815a0fecef2d8a8f56f7fa313aff9c5d644b710a298bc6d1cefabf8bb46ee7f54874524ec656450df64c38462b82f6c62abb6422c532
|
7
|
+
data.tar.gz: f501655ab78ef83f09b020cedbd9d8a1428f4996a1ba2b550bb0a0078c5c815161e9123a36f6abf5539d9d45f55ca7b1a24d6cfe698ae9049887e851f2fc8a35
|
data/.gitignore
CHANGED
data/README.md
CHANGED
data/bin/stuka
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module Stuka
|
4
|
+
|
5
|
+
class Command < Thor::Group
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
# root of project, from where we reference the templates
|
9
|
+
def self.source_root
|
10
|
+
File.dirname(__FILE__) + "/.."
|
11
|
+
end
|
12
|
+
|
13
|
+
# name refers to the class name with module. Stuka::Command in this case
|
14
|
+
def self.command_name
|
15
|
+
name.downcase[/\w+::(\w+)command/, 1]
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.alias
|
19
|
+
command_name
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.usage
|
23
|
+
command_name
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.description
|
27
|
+
"#{command_name} description"
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative "../command"
|
2
|
+
|
3
|
+
module Stuka
|
4
|
+
|
5
|
+
class NewCommand < Command
|
6
|
+
|
7
|
+
argument :name, :desc => "The name of the project"
|
8
|
+
|
9
|
+
def generate_gemfile
|
10
|
+
template('templates/configs/gemfile.tt', "#{name}/Gemfile")
|
11
|
+
end
|
12
|
+
|
13
|
+
def setup_project
|
14
|
+
template('templates/samples/my_first_step.tt', "#{name}/process_definition/steps/example/my_first_step.rb")
|
15
|
+
template('templates/samples/my_second_step.tt', "#{name}/process_definition/steps/example/my_second_step.rb")
|
16
|
+
template('templates/samples/my_process.tt', "#{name}/process_definition/processes/my_process.rb")
|
17
|
+
say("Stuka project is setup, don't forget to cd into #{name}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.description
|
21
|
+
"generates a project skeleton"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.usage
|
25
|
+
"new NAME"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative "../command"
|
2
|
+
|
3
|
+
module Stuka
|
4
|
+
|
5
|
+
class ProcessCommand < Command
|
6
|
+
|
7
|
+
argument :name, :desc => "The name of the process"
|
8
|
+
|
9
|
+
def generate_process
|
10
|
+
template('templates/definitions/process.tt', "process_definition/processes/#{name}.rb")
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.description
|
14
|
+
"generates a process stub"
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.usage
|
18
|
+
"process NAME"
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative "../command"
|
2
|
+
|
3
|
+
module Stuka
|
4
|
+
|
5
|
+
class SetupCommand < Command
|
6
|
+
|
7
|
+
def setup
|
8
|
+
processes_dir_exists = File.directory?("#{Dir.pwd}/process_definition/processes")
|
9
|
+
steps_dir_exists = File.directory?("#{Dir.pwd}/process_definition/steps")
|
10
|
+
|
11
|
+
if processes_dir_exists && steps_dir_exists
|
12
|
+
say("Stuka is already setup")
|
13
|
+
return
|
14
|
+
end
|
15
|
+
|
16
|
+
template('templates/samples/my_first_step.tt', "process_definition/steps/example/my_first_step.rb")
|
17
|
+
template('templates/samples/my_second_step.tt', "process_definition/steps/example/my_second_step.rb")
|
18
|
+
template('templates/samples/my_process.tt', "process_definition/processes/my_process.rb")
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.description
|
22
|
+
"generates necessary folders and a couple of sample files"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative "../command"
|
2
|
+
|
3
|
+
module Stuka
|
4
|
+
|
5
|
+
class StepCommand < Command
|
6
|
+
|
7
|
+
argument :namespace, :desc => "Namespace of the step"
|
8
|
+
argument :name, :desc => "Name of the step"
|
9
|
+
|
10
|
+
def generate_step
|
11
|
+
template('templates/definitions/step.tt', "process_definition/steps/#{namespace}/#{name}.rb")
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.description
|
15
|
+
"generates a step stub"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.usage
|
19
|
+
"step NAMESPACE NAME"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Stuka
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
Dir["#{File.dirname(__FILE__)}/commands/concrete_commands/*.rb"].each { |file| require_relative file }
|
5
|
+
|
6
|
+
class StukaCli < Thor
|
7
|
+
|
8
|
+
# Retrieve all classes from the Stuka module that end with Command except Stuka::Command abstract class
|
9
|
+
# Register all those classes so they are available in the terminal as commands.
|
10
|
+
# register(class_name, subcommand_alias, usage_list_string, description_string)
|
11
|
+
commands = Stuka.constants.select { |c| c.match(/\w+Command/) && Stuka.const_get(c).is_a?(Class) }
|
12
|
+
commands.each do |command|
|
13
|
+
commandClass = Stuka.const_get(command)
|
14
|
+
register(commandClass, commandClass.alias, commandClass.usage, commandClass.description)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
process "this is an example process" { |p|
|
3
|
+
|
4
|
+
p.name "my process"
|
5
|
+
p.attributes ["repo", "example_attribute"]
|
6
|
+
|
7
|
+
p.start_step "example:my_first_step"
|
8
|
+
|
9
|
+
p.step_transition "example:my_first_step" { |a|
|
10
|
+
a.success "example:my_second_step"
|
11
|
+
a.failure process_failure
|
12
|
+
}
|
13
|
+
|
14
|
+
p.step_transition "example:my_second_step" { |a|
|
15
|
+
a.success process_success
|
16
|
+
a.failure process_failure
|
17
|
+
}
|
18
|
+
|
19
|
+
}
|
data/lib/stuka/version.rb
CHANGED
data/lib/stuka.rb
CHANGED
data/stuka.gemspec
CHANGED
@@ -6,6 +6,7 @@ require 'stuka/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "stuka"
|
8
8
|
spec.version = Stuka::VERSION
|
9
|
+
spec.executables << 'stuka'
|
9
10
|
spec.authors = ["David Sljukic"]
|
10
11
|
spec.email = ["david.sljukic@gmail.com"]
|
11
12
|
spec.summary = %q{Stuka is a dsl for managing business processes}
|
@@ -20,4 +21,5 @@ Gem::Specification.new do |spec|
|
|
20
21
|
|
21
22
|
spec.add_development_dependency "bundler", "~> 1.6"
|
22
23
|
spec.add_development_dependency "rake"
|
24
|
+
spec.add_runtime_dependency "thor"
|
23
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stuka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Sljukic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,10 +38,25 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Stuka is a dsl for managing business processes
|
42
56
|
email:
|
43
57
|
- david.sljukic@gmail.com
|
44
|
-
executables:
|
58
|
+
executables:
|
59
|
+
- stuka
|
45
60
|
extensions: []
|
46
61
|
extra_rdoc_files: []
|
47
62
|
files:
|
@@ -50,7 +65,21 @@ files:
|
|
50
65
|
- LICENSE.txt
|
51
66
|
- README.md
|
52
67
|
- Rakefile
|
68
|
+
- bin/stuka
|
53
69
|
- lib/stuka.rb
|
70
|
+
- lib/stuka/commands/command.rb
|
71
|
+
- lib/stuka/commands/concrete_commands/new_command.rb
|
72
|
+
- lib/stuka/commands/concrete_commands/process_command.rb
|
73
|
+
- lib/stuka/commands/concrete_commands/setup_command.rb
|
74
|
+
- lib/stuka/commands/concrete_commands/step_command.rb
|
75
|
+
- lib/stuka/stuka_cli.rb
|
76
|
+
- lib/stuka/templates/configs/gemfile.tt
|
77
|
+
- lib/stuka/templates/configs/tasks.tt
|
78
|
+
- lib/stuka/templates/definitions/process.tt
|
79
|
+
- lib/stuka/templates/definitions/step.tt
|
80
|
+
- lib/stuka/templates/samples/my_first_step.tt
|
81
|
+
- lib/stuka/templates/samples/my_process.tt
|
82
|
+
- lib/stuka/templates/samples/my_second_step.tt
|
54
83
|
- lib/stuka/version.rb
|
55
84
|
- stuka.gemspec
|
56
85
|
homepage: ''
|