sem 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +103 -0
  5. data/Gemfile +6 -0
  6. data/README.md +27 -0
  7. data/Rakefile +10 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +8 -0
  10. data/exe/sem +5 -0
  11. data/guides.md +168 -0
  12. data/ids.md +74 -0
  13. data/lib/sem.rb +53 -0
  14. data/lib/sem/api.rb +14 -0
  15. data/lib/sem/api/base.rb +17 -0
  16. data/lib/sem/api/env_vars.rb +20 -0
  17. data/lib/sem/api/files.rb +19 -0
  18. data/lib/sem/api/orgs.rb +54 -0
  19. data/lib/sem/api/projects.rb +33 -0
  20. data/lib/sem/api/shared_configs.rb +75 -0
  21. data/lib/sem/api/teams.rb +54 -0
  22. data/lib/sem/api/traits.rb +9 -0
  23. data/lib/sem/api/traits/associated_with_org.rb +13 -0
  24. data/lib/sem/api/traits/associated_with_shared_config.rb +29 -0
  25. data/lib/sem/api/traits/associated_with_team.rb +29 -0
  26. data/lib/sem/api/users.rb +26 -0
  27. data/lib/sem/api/users_with_permissions.rb +53 -0
  28. data/lib/sem/cli.rb +20 -0
  29. data/lib/sem/cli/orgs.rb +45 -0
  30. data/lib/sem/cli/projects.rb +17 -0
  31. data/lib/sem/cli/shared_configs.rb +97 -0
  32. data/lib/sem/cli/teams.rb +126 -0
  33. data/lib/sem/errors.rb +8 -0
  34. data/lib/sem/version.rb +3 -0
  35. data/lib/sem/views.rb +7 -0
  36. data/lib/sem/views/base.rb +7 -0
  37. data/lib/sem/views/env_vars.rb +13 -0
  38. data/lib/sem/views/files.rb +13 -0
  39. data/lib/sem/views/orgs.rb +22 -0
  40. data/lib/sem/views/projects.rb +22 -0
  41. data/lib/sem/views/shared_configs.rb +24 -0
  42. data/lib/sem/views/teams.rb +24 -0
  43. data/lib/sem/views/users.rb +13 -0
  44. data/lib/sem/views/users_with_permissions.rb +13 -0
  45. data/sem.gemspec +33 -0
  46. metadata +201 -0
@@ -0,0 +1,22 @@
1
+ class Sem::Views::Projects < Sem::Views::Base
2
+
3
+ def self.list(projects)
4
+ header = ["ID", "NAME"]
5
+
6
+ body = projects.map do |project|
7
+ [project[:id], project[:name]]
8
+ end
9
+
10
+ print_table([header, *body])
11
+ end
12
+
13
+ def self.info(org)
14
+ print_table [
15
+ ["ID", org[:id]],
16
+ ["Name", org[:name]],
17
+ ["Created", org[:created_at]],
18
+ ["Updated", org[:updated_at]]
19
+ ]
20
+ end
21
+
22
+ end
@@ -0,0 +1,24 @@
1
+ class Sem::Views::SharedConfigs < Sem::Views::Base
2
+
3
+ def self.list(configs)
4
+ header = ["ID", "NAME", "CONFIG FILES", "ENV VARS"]
5
+
6
+ body = configs.map do |config|
7
+ [config[:id], config[:name], config[:config_files], config[:env_vars]]
8
+ end
9
+
10
+ print_table [header, *body]
11
+ end
12
+
13
+ def self.info(config)
14
+ print_table [
15
+ ["ID", config[:id]],
16
+ ["Name", config[:name]],
17
+ ["Config Files", config[:config_files].to_s],
18
+ ["Environment Variables", config[:env_vars].to_s],
19
+ ["Created", config[:created_at]],
20
+ ["Updated", config[:updated_at]]
21
+ ]
22
+ end
23
+
24
+ end
@@ -0,0 +1,24 @@
1
+ class Sem::Views::Teams < Sem::Views::Base
2
+
3
+ def self.list(teams)
4
+ header = ["ID", "NAME", "PERMISSION", "MEMBERS"]
5
+
6
+ body = teams.map do |team|
7
+ [team[:id], team[:name], team[:permission], "#{team[:members]} members"]
8
+ end
9
+
10
+ print_table [header, *body]
11
+ end
12
+
13
+ def self.info(team)
14
+ print_table [
15
+ ["ID", team[:id]],
16
+ ["Name", team[:name]],
17
+ ["Permission", team[:permission]],
18
+ ["Members", "#{team[:members]} members"],
19
+ ["Created", team[:created_at]],
20
+ ["Updated", team[:updated_at]]
21
+ ]
22
+ end
23
+
24
+ end
@@ -0,0 +1,13 @@
1
+ class Sem::Views::Users < Sem::Views::Base
2
+
3
+ def self.list(users)
4
+ header = ["NAME"]
5
+
6
+ body = users.map do |user|
7
+ [user[:id]]
8
+ end
9
+
10
+ print_table [header, *body]
11
+ end
12
+
13
+ end
@@ -0,0 +1,13 @@
1
+ class Sem::Views::UsersWithPermissions < Sem::Views::Base
2
+
3
+ def self.list(users)
4
+ header = ["NAME", "PERMISSION"]
5
+
6
+ body = users.map do |user|
7
+ [user[:id], user[:permission]]
8
+ end
9
+
10
+ print_table [header, *body]
11
+ end
12
+
13
+ end
data/sem.gemspec ADDED
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sem/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sem"
8
+ spec.version = Sem::VERSION
9
+ spec.authors = ["Igor Šarčević"]
10
+ spec.email = ["igor@renderedtext.com"]
11
+
12
+ spec.summary = %q{Semaphore CLI}
13
+ spec.description = %q{Semaphore CLI}
14
+ spec.homepage = "https://github.com/renderedtext/cli"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "semaphore_client", "~> 2.0.5"
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.14"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ spec.add_development_dependency "rubocop", "~> 0.47.1"
30
+ spec.add_development_dependency "rubocop-rspec", "~> 1.13.0"
31
+ spec.add_development_dependency "simplecov", "~> 0.13"
32
+ spec.add_development_dependency "byebug"
33
+ end
metadata ADDED
@@ -0,0 +1,201 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Igor Šarčević
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-08-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: semaphore_client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.14'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.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.47.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.47.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.13.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.13.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.13'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.13'
111
+ - !ruby/object:Gem::Dependency
112
+ name: byebug
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: Semaphore CLI
126
+ email:
127
+ - igor@renderedtext.com
128
+ executables:
129
+ - sem
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - ".gitignore"
134
+ - ".rspec"
135
+ - ".rubocop.yml"
136
+ - Gemfile
137
+ - README.md
138
+ - Rakefile
139
+ - bin/console
140
+ - bin/setup
141
+ - exe/sem
142
+ - guides.md
143
+ - ids.md
144
+ - lib/sem.rb
145
+ - lib/sem/api.rb
146
+ - lib/sem/api/base.rb
147
+ - lib/sem/api/env_vars.rb
148
+ - lib/sem/api/files.rb
149
+ - lib/sem/api/orgs.rb
150
+ - lib/sem/api/projects.rb
151
+ - lib/sem/api/shared_configs.rb
152
+ - lib/sem/api/teams.rb
153
+ - lib/sem/api/traits.rb
154
+ - lib/sem/api/traits/associated_with_org.rb
155
+ - lib/sem/api/traits/associated_with_shared_config.rb
156
+ - lib/sem/api/traits/associated_with_team.rb
157
+ - lib/sem/api/users.rb
158
+ - lib/sem/api/users_with_permissions.rb
159
+ - lib/sem/cli.rb
160
+ - lib/sem/cli/orgs.rb
161
+ - lib/sem/cli/projects.rb
162
+ - lib/sem/cli/shared_configs.rb
163
+ - lib/sem/cli/teams.rb
164
+ - lib/sem/errors.rb
165
+ - lib/sem/version.rb
166
+ - lib/sem/views.rb
167
+ - lib/sem/views/base.rb
168
+ - lib/sem/views/env_vars.rb
169
+ - lib/sem/views/files.rb
170
+ - lib/sem/views/orgs.rb
171
+ - lib/sem/views/projects.rb
172
+ - lib/sem/views/shared_configs.rb
173
+ - lib/sem/views/teams.rb
174
+ - lib/sem/views/users.rb
175
+ - lib/sem/views/users_with_permissions.rb
176
+ - sem.gemspec
177
+ homepage: https://github.com/renderedtext/cli
178
+ licenses:
179
+ - MIT
180
+ metadata: {}
181
+ post_install_message:
182
+ rdoc_options: []
183
+ require_paths:
184
+ - lib
185
+ required_ruby_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ required_rubygems_version: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ requirements: []
196
+ rubyforge_project:
197
+ rubygems_version: 2.5.2
198
+ signing_key:
199
+ specification_version: 4
200
+ summary: Semaphore CLI
201
+ test_files: []