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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c794bae35d63f3f5bf5330b10f696153894f432
4
- data.tar.gz: 1b1865f34435ed59800f2e265e763b792e1bfaf8
3
+ metadata.gz: 3bdd0bcc368a78173689529072b5b24b3350989d
4
+ data.tar.gz: 681794b654461bfd78a24e716c40b0e83ad3e329
5
5
  SHA512:
6
- metadata.gz: 034fc85ad2cee27e985c158ae4c6d5d05b5a5df07d6e257b56d45a83d68308021af57039366610b5ef39e6a20b2f25836cabff413c343453f958cc38cf8439cb
7
- data.tar.gz: c487b56d69ed5cc735e8141590b063957685e504a131f84e0e11ee6c39ffed0d1bde568c1e7930caf363d4fc6b4c91b82336d7a324866d67e83317eb8406a618
6
+ metadata.gz: 0f61206b551a32072185815a0fecef2d8a8f56f7fa313aff9c5d644b710a298bc6d1cefabf8bb46ee7f54874524ec656450df64c38462b82f6c62abb6422c532
7
+ data.tar.gz: f501655ab78ef83f09b020cedbd9d8a1428f4996a1ba2b550bb0a0078c5c815161e9123a36f6abf5539d9d45f55ca7b1a24d6cfe698ae9049887e851f2fc8a35
data/.gitignore CHANGED
@@ -20,3 +20,4 @@ tmp
20
20
  *.o
21
21
  *.a
22
22
  mkmf.log
23
+ vendor/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Stuka
2
2
 
3
- TODO: Write a gem description
3
+ Dsl for managing processes in ruby
4
4
 
5
5
  ## Installation
6
6
 
data/bin/stuka ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'stuka'
5
+
6
+ Stuka::StukaCli.start
@@ -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,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'stuka'
@@ -0,0 +1,4 @@
1
+ task :build_processes do
2
+ puts "building processes..."
3
+
4
+ end
@@ -0,0 +1,7 @@
1
+
2
+ process "<%= name %> description" { |p|
3
+
4
+ p.name "<%= name %>"
5
+ p.attributes []
6
+
7
+ }
@@ -0,0 +1,8 @@
1
+
2
+ step "<%= name %> description" { |s|
3
+
4
+ s.name "<%= name %>"
5
+ s.namespace "<%= namespace %>"
6
+ s.attributes []
7
+
8
+ }
@@ -0,0 +1,9 @@
1
+
2
+ step "this is an example step" { |s|
3
+
4
+ s.name "my first step"
5
+ s.namespace "example"
6
+ s.attributes ["repo", "example_attribute"]
7
+ s.finishes ["success", "failure"]
8
+
9
+ }
@@ -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
+ }
@@ -0,0 +1,9 @@
1
+
2
+ step "this is an example step" { |s|
3
+
4
+ s.name "my second step"
5
+ s.namespace "example"
6
+ s.attributes ["repo", "example_attribute"]
7
+ s.finishes ["success", "failure"]
8
+
9
+ }
data/lib/stuka/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Stuka
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/stuka.rb CHANGED
@@ -1,5 +1,2 @@
1
- require "stuka/version"
2
-
3
- module Stuka
4
- # Your code goes here...
5
- end
1
+ require_relative "stuka/version"
2
+ require_relative "stuka/stuka_cli"
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.1
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-26 00:00:00.000000000 Z
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: ''