semaph 0.1.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +18 -0
- data/.semaphore/semaphore.yml +23 -0
- data/.tool-versions +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +55 -0
- data/README.md +85 -11
- data/Rakefile +4 -1
- data/exe/semaph +5 -0
- data/lib/semaph.rb +17 -1
- data/lib/semaph/api.rb +94 -0
- data/lib/semaph/commands.rb +63 -0
- data/lib/semaph/commands/reload_command.rb +17 -0
- data/lib/semaph/commands/rerun_workflow_command.rb +16 -0
- data/lib/semaph/commands/stop_workflow_command.rb +16 -0
- data/lib/semaph/commands/visit_url_command.rb +16 -0
- data/lib/semaph/formatting.rb +9 -0
- data/lib/semaph/model/job.rb +101 -0
- data/lib/semaph/model/job_collection.rb +47 -0
- data/lib/semaph/model/pipeline.rb +48 -0
- data/lib/semaph/model/pipeline_collection.rb +20 -0
- data/lib/semaph/model/project.rb +34 -0
- data/lib/semaph/model/project_collection.rb +19 -0
- data/lib/semaph/model/workflow.rb +48 -0
- data/lib/semaph/model/workflow_collection.rb +19 -0
- data/lib/semaph/shells/organisation/organisation_shell.rb +33 -0
- data/lib/semaph/shells/organisation/projects_list_command.rb +21 -0
- data/lib/semaph/shells/organisation/projects_select_command.rb +26 -0
- data/lib/semaph/shells/organisations/organisations_list_command.rb +20 -0
- data/lib/semaph/shells/organisations/organisations_select_command.rb +25 -0
- data/lib/semaph/shells/organisations/organisations_shell.rb +24 -0
- data/lib/semaph/shells/pipeline/job_log_command.rb +44 -0
- data/lib/semaph/shells/pipeline/job_log_grep_command.rb +28 -0
- data/lib/semaph/shells/pipeline/jobs_list_command.rb +21 -0
- data/lib/semaph/shells/pipeline/jobs_poll_command.rb +62 -0
- data/lib/semaph/shells/pipeline/pipeline_shell.rb +45 -0
- data/lib/semaph/shells/project/project_shell.rb +61 -0
- data/lib/semaph/shells/project/workflows_list_command.rb +24 -0
- data/lib/semaph/shells/project/workflows_select_command.rb +31 -0
- data/lib/semaph/shells/workflow/pipelines_list_command.rb +21 -0
- data/lib/semaph/shells/workflow/pipelines_select_command.rb +30 -0
- data/lib/semaph/shells/workflow/workflow_shell.rb +35 -0
- data/lib/semaph/version.rb +1 -1
- data/semaph.gemspec +12 -7
- metadata +115 -7
@@ -0,0 +1,21 @@
|
|
1
|
+
module Semaph
|
2
|
+
module Shells
|
3
|
+
module Workflow
|
4
|
+
class PipelinesListCommand
|
5
|
+
attr_reader :usage, :help
|
6
|
+
|
7
|
+
def initialize(pipeline_collection)
|
8
|
+
@pipeline_collection = pipeline_collection
|
9
|
+
@help = "list pipelines"
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute(_whatever)
|
13
|
+
@pipeline_collection.reload
|
14
|
+
@pipeline_collection.all.each_with_index do |pipeline, index|
|
15
|
+
puts "#{index + 1} #{pipeline.description}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "semaph/shells/pipeline/pipeline_shell"
|
2
|
+
|
3
|
+
module Semaph
|
4
|
+
module Shells
|
5
|
+
module Workflow
|
6
|
+
class PipelinesSelectCommand
|
7
|
+
attr_reader :usage, :help
|
8
|
+
|
9
|
+
def initialize(pipeline_collection)
|
10
|
+
@pipeline_collection = pipeline_collection
|
11
|
+
@usage = "<pipeline index>"
|
12
|
+
@help = "choose pipeline by index"
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute(index_string)
|
16
|
+
index = index_string.to_i - 1
|
17
|
+
|
18
|
+
pipeline = @pipeline_collection.all[index]
|
19
|
+
|
20
|
+
unless pipeline
|
21
|
+
puts "There is no pipeline at position #{index}"
|
22
|
+
return
|
23
|
+
end
|
24
|
+
|
25
|
+
::Semaph::Shells::Pipeline::PipelineShell.new(pipeline).push
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "semaph/commands"
|
2
|
+
require "semaph/shells/workflow/pipelines_list_command"
|
3
|
+
require "semaph/shells/workflow/pipelines_select_command"
|
4
|
+
require "shell_shock/context"
|
5
|
+
|
6
|
+
module Semaph
|
7
|
+
module Shells
|
8
|
+
module Workflow
|
9
|
+
class WorkflowShell
|
10
|
+
attr_reader :workflow
|
11
|
+
|
12
|
+
include ShellShock::Context
|
13
|
+
|
14
|
+
def initialize(workflow)
|
15
|
+
@workflow = workflow
|
16
|
+
project = @workflow.project
|
17
|
+
@prompt = "🏗 #{project.client.name} #{project.name} #{workflow.id} > "
|
18
|
+
add_commands
|
19
|
+
@list_command.execute("")
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def add_commands
|
25
|
+
pipeline_collection = @workflow.pipeline_collection
|
26
|
+
@list_command = PipelinesListCommand.new(pipeline_collection)
|
27
|
+
add_command @list_command, "list-pipelines", "ls"
|
28
|
+
add_command PipelinesSelectCommand.new(pipeline_collection), "select-pipeline", "cd"
|
29
|
+
add_command ::Semaph::Commands::ReloadCommand.new, "reload" if ENV["SEMAPH_RELOAD"]
|
30
|
+
::Semaph::Commands.workflow_commands(self, workflow)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/semaph/version.rb
CHANGED
data/semaph.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "lib/semaph/version"
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "semaph"
|
@@ -6,8 +6,8 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.authors = ["Mark Ryall"]
|
7
7
|
spec.email = ["mark@ryall.name"]
|
8
8
|
|
9
|
-
spec.summary =
|
10
|
-
spec.description =
|
9
|
+
spec.summary = "client for semaphore 2"
|
10
|
+
spec.description = "api client and shell for api"
|
11
11
|
spec.homepage = "http://github.com/markryall/semaph"
|
12
12
|
spec.license = "MIT"
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
@@ -16,12 +16,17 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.metadata["source_code_uri"] = spec.homepage
|
17
17
|
spec.metadata["changelog_uri"] = spec.homepage
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
22
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
20
|
+
f.match(%r{^(test|spec|features)/})
|
23
21
|
end
|
24
22
|
spec.bindir = "exe"
|
25
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
24
|
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_dependency "faraday"
|
27
|
+
spec.add_dependency "rainbow"
|
28
|
+
spec.add_dependency "shell_shock"
|
29
|
+
|
30
|
+
spec.add_development_dependency "pry"
|
31
|
+
spec.add_development_dependency "rubocop"
|
27
32
|
end
|
metadata
CHANGED
@@ -1,32 +1,140 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semaph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Ryall
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05
|
12
|
-
dependencies:
|
11
|
+
date: 2020-06-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rainbow
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: shell_shock
|
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'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
13
83
|
description: api client and shell for api
|
14
84
|
email:
|
15
85
|
- mark@ryall.name
|
16
|
-
executables:
|
86
|
+
executables:
|
87
|
+
- semaph
|
17
88
|
extensions: []
|
18
89
|
extra_rdoc_files: []
|
19
90
|
files:
|
20
91
|
- ".gitignore"
|
92
|
+
- ".rubocop.yml"
|
93
|
+
- ".semaphore/semaphore.yml"
|
94
|
+
- ".tool-versions"
|
21
95
|
- ".travis.yml"
|
22
96
|
- CODE_OF_CONDUCT.md
|
23
97
|
- Gemfile
|
98
|
+
- Gemfile.lock
|
24
99
|
- LICENSE.txt
|
25
100
|
- README.md
|
26
101
|
- Rakefile
|
27
102
|
- bin/console
|
28
103
|
- bin/setup
|
104
|
+
- exe/semaph
|
29
105
|
- lib/semaph.rb
|
106
|
+
- lib/semaph/api.rb
|
107
|
+
- lib/semaph/commands.rb
|
108
|
+
- lib/semaph/commands/reload_command.rb
|
109
|
+
- lib/semaph/commands/rerun_workflow_command.rb
|
110
|
+
- lib/semaph/commands/stop_workflow_command.rb
|
111
|
+
- lib/semaph/commands/visit_url_command.rb
|
112
|
+
- lib/semaph/formatting.rb
|
113
|
+
- lib/semaph/model/job.rb
|
114
|
+
- lib/semaph/model/job_collection.rb
|
115
|
+
- lib/semaph/model/pipeline.rb
|
116
|
+
- lib/semaph/model/pipeline_collection.rb
|
117
|
+
- lib/semaph/model/project.rb
|
118
|
+
- lib/semaph/model/project_collection.rb
|
119
|
+
- lib/semaph/model/workflow.rb
|
120
|
+
- lib/semaph/model/workflow_collection.rb
|
121
|
+
- lib/semaph/shells/organisation/organisation_shell.rb
|
122
|
+
- lib/semaph/shells/organisation/projects_list_command.rb
|
123
|
+
- lib/semaph/shells/organisation/projects_select_command.rb
|
124
|
+
- lib/semaph/shells/organisations/organisations_list_command.rb
|
125
|
+
- lib/semaph/shells/organisations/organisations_select_command.rb
|
126
|
+
- lib/semaph/shells/organisations/organisations_shell.rb
|
127
|
+
- lib/semaph/shells/pipeline/job_log_command.rb
|
128
|
+
- lib/semaph/shells/pipeline/job_log_grep_command.rb
|
129
|
+
- lib/semaph/shells/pipeline/jobs_list_command.rb
|
130
|
+
- lib/semaph/shells/pipeline/jobs_poll_command.rb
|
131
|
+
- lib/semaph/shells/pipeline/pipeline_shell.rb
|
132
|
+
- lib/semaph/shells/project/project_shell.rb
|
133
|
+
- lib/semaph/shells/project/workflows_list_command.rb
|
134
|
+
- lib/semaph/shells/project/workflows_select_command.rb
|
135
|
+
- lib/semaph/shells/workflow/pipelines_list_command.rb
|
136
|
+
- lib/semaph/shells/workflow/pipelines_select_command.rb
|
137
|
+
- lib/semaph/shells/workflow/workflow_shell.rb
|
30
138
|
- lib/semaph/version.rb
|
31
139
|
- semaph.gemspec
|
32
140
|
homepage: http://github.com/markryall/semaph
|
@@ -36,7 +144,7 @@ metadata:
|
|
36
144
|
homepage_uri: http://github.com/markryall/semaph
|
37
145
|
source_code_uri: http://github.com/markryall/semaph
|
38
146
|
changelog_uri: http://github.com/markryall/semaph
|
39
|
-
post_install_message:
|
147
|
+
post_install_message:
|
40
148
|
rdoc_options: []
|
41
149
|
require_paths:
|
42
150
|
- lib
|
@@ -52,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
160
|
version: '0'
|
53
161
|
requirements: []
|
54
162
|
rubygems_version: 3.1.2
|
55
|
-
signing_key:
|
163
|
+
signing_key:
|
56
164
|
specification_version: 4
|
57
165
|
summary: client for semaphore 2
|
58
166
|
test_files: []
|