job_spec 0.2.5 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: baf6c46db69ad8de79584def5d8381f7bfbb78e0
4
- data.tar.gz: 5c6fe728e4ff922858b94fb05f5a7340fc1f0cd4
2
+ SHA256:
3
+ metadata.gz: 245a315b2ac01afe6198c8a94ca548d29f3f9ea2bfc75c4fb2ed965dfff25e17
4
+ data.tar.gz: b80f2205ba9a3b6dcf0cab71fb3253cd5c2629c4afdd43d7c07286d90c5fcd22
5
5
  SHA512:
6
- metadata.gz: f30cea6a08168757f14b5bc58be6413adc978c3ce5d69ced30c04dc6c3f1a1fd15ea4ef2c4aa74239ff8f27e5835120063aac20584b3afbf44a37472e0fa1027
7
- data.tar.gz: 4fdb2cbb3b5e174f9fb796fd1c8853f3e084cd37c70ed980c72797a9d41d944c7374b77281d51a7047a4b07f72b6368a1063be30872d0cbec705032ef57da466
6
+ metadata.gz: e69e12a3600e616f3c787beb73d2ca7599fd26ee2f7ae8960b289b9e913583a41a615b77696aedbf75b46bd843f64c355fea1046f1d90b44971a7dac1e324136
7
+ data.tar.gz: 63fe1f1ea5c04ff1a40c79b5f89ea4cab76cc0e067c863f7aab7df41aab416b97c41a41e61dc213ff9f78f03e8f3fb80d324124f3f24e5e601f0b40d56245a14
@@ -0,0 +1,15 @@
1
+ # Engineer
2
+
3
+ ## Core Expectations
4
+
5
+ ### To engineer
6
+
7
+ ## Expectations
8
+
9
+ ### To be cool
10
+
11
+ Because it that is good
12
+
13
+ ### To really enjoy work
14
+
15
+ really really
@@ -0,0 +1,7 @@
1
+ # Senior Engineer
2
+
3
+ ## Expectations
4
+
5
+ ### To really enjoy work
6
+
7
+ really really
data/job_spec.gemspec CHANGED
@@ -4,8 +4,8 @@ require File.join(LIB, 'job_spec/version')
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'job_spec'
6
6
  spec.version = JobSpec::VERSION
7
- spec.authors = ['Luke Morton']
8
- spec.email = ['luke@madetech.com']
7
+ spec.authors = ['Luke Morton', 'Craig J. Bass']
8
+ spec.email = ['luke@madetech.com', 'craig@madetech.com']
9
9
 
10
10
  spec.summary = %q{Define job specs in ruby and publish to markdown}
11
11
  spec.homepage = 'https://github.com/madetech/job_spec'
@@ -0,0 +1,54 @@
1
+ module JobSpec
2
+ class AdhocExpectations
3
+ def self.clear!
4
+ @expectations = nil
5
+ end
6
+
7
+ def self.define(expectation, &block)
8
+ @expectations ||= []
9
+ @expectations << new(expectation, &block)
10
+ end
11
+
12
+ def self.roles
13
+ roles = {}
14
+ @expectations.each do |expectation|
15
+ expectation.to_a.each do |role_expectation|
16
+ roles[role_expectation[:role]] ||= {
17
+ name: role_expectation[:role],
18
+ expectations: []
19
+ }
20
+
21
+ roles[role_expectation[:role]][:expectations] << {
22
+ expectation: role_expectation[:expectation],
23
+ description: role_expectation[:description]
24
+ }
25
+ end
26
+ end
27
+ roles.values
28
+ end
29
+
30
+ def initialize(expectation, &block)
31
+ @expectation = expectation
32
+ @block = block
33
+ instance_eval(&block) unless block.nil?
34
+ end
35
+
36
+ def description(description)
37
+ @description = description
38
+ end
39
+
40
+ def roles(*roles)
41
+ @roles = roles
42
+ end
43
+
44
+ def to_a
45
+ @roles.map do |role|
46
+ {
47
+ role: role,
48
+ expectation: @expectation,
49
+ description: @description
50
+ }
51
+ end
52
+ end
53
+ end
54
+ end
data/lib/job_spec/cli.rb CHANGED
@@ -13,6 +13,7 @@ module JobSpec
13
13
  end
14
14
 
15
15
  FileUtils.mkdir_p(path_relative_to_pwd(options[:out]))
16
+ JobSpec::Role.add_expectations(JobSpec::AdhocExpectations.roles)
16
17
  Role.definitions.each do |role|
17
18
  puts "Saving #{role.name} to #{safe_role_out_path(role)}..."
18
19
  File.write(safe_role_out_path(role), RenderAsMarkdown.new(role).render)
data/lib/job_spec/role.rb CHANGED
@@ -1,12 +1,25 @@
1
1
  module JobSpec
2
2
  class Role
3
3
  def self.definition(name, &block)
4
- @definitions ||= []
5
- @definitions << new(name, &block)
4
+ @definitions ||= {}
5
+ @definitions[name] = new(name, &block)
6
6
  end
7
7
 
8
8
  def self.definitions
9
- @definitions
9
+ @definitions.values
10
+ end
11
+
12
+ def self.add_expectations(role_expectations)
13
+ expectation = role_expectations.first[:expectations].first
14
+
15
+ role_expectations.each do |role_expectation|
16
+ role = @definitions[role_expectation[:name]]
17
+ role_expectation[:expectations].each do |e|
18
+ role.expected(e[:expectation], e[:description])
19
+ end
20
+ end
21
+
22
+ nil
10
23
  end
11
24
 
12
25
  def initialize(name, &block)
@@ -1,3 +1,3 @@
1
1
  module JobSpec
2
- VERSION = '0.2.5'
2
+ VERSION = '0.3.0'
3
3
  end
data/lib/job_spec.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  require 'job_spec/role'
2
+ require 'job_spec/adhoc_expectations'
2
3
  require 'job_spec/render_as_markdown'
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: job_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Morton
8
+ - Craig J. Bass
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2017-12-23 00:00:00.000000000 Z
12
+ date: 2018-12-21 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -69,6 +70,7 @@ dependencies:
69
70
  description:
70
71
  email:
71
72
  - luke@madetech.com
73
+ - craig@madetech.com
72
74
  executables:
73
75
  - jobspec
74
76
  extensions: []
@@ -80,8 +82,11 @@ files:
80
82
  - README.md
81
83
  - Rakefile
82
84
  - bin/jobspec
85
+ - example_out/engineer.md
86
+ - example_out/senior_engineer.md
83
87
  - job_spec.gemspec
84
88
  - lib/job_spec.rb
89
+ - lib/job_spec/adhoc_expectations.rb
85
90
  - lib/job_spec/cli.rb
86
91
  - lib/job_spec/render_as_markdown.rb
87
92
  - lib/job_spec/role.rb
@@ -106,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
111
  version: '0'
107
112
  requirements: []
108
113
  rubyforge_project:
109
- rubygems_version: 2.6.13
114
+ rubygems_version: 2.7.3
110
115
  signing_key:
111
116
  specification_version: 4
112
117
  summary: Define job specs in ruby and publish to markdown