job_spec 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3441a2fabbdaac81b867f6b54a9839be629f280a
4
+ data.tar.gz: 952a87d62a7c4771e32b1b55a4ebcdede38de96c
5
+ SHA512:
6
+ metadata.gz: 1048289aa27457a9908c9356707bcb2563dd067c037b3e26c0005b35d455e8f8ae762dfd82caf02a0faec7612cb59bb82fc9c161ca8b88719d9c3120baf4494b
7
+ data.tar.gz: 4fb1bf8b6cff0db7fb5658125dcd8919c7fcc08160f09492930cb1eab6c4abc66db26002cc1f3bad112fffd15c8deb86a3ba0e3fba4f500100c9458568b6e478
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ pkg
2
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format doc
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # JobSpec
2
+
3
+ A ruby gem for defining job specifications in a nice DSL that enables composition of expectations between roles.
4
+
5
+ ## Installing
6
+
7
+ To use from the command line:
8
+
9
+ ```
10
+ gem install job_spec
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Create a job specification for a role:
16
+
17
+ ``` ruby
18
+ JobSpec::Role.definition "Engineer" do
19
+ expected "to be cool"
20
+ end
21
+ ```
22
+
23
+ Save that into a file `roles/engineer.rb`. Now from the command line in the directory that contains the `roles/` directory:
24
+
25
+ ```
26
+ jobspec build roles
27
+ ```
28
+
29
+ And you will see your job roles printed out.
30
+
31
+ ## Examples
32
+
33
+ See the [`example/`](example) directory and also the RSpec examples in [`spec/`](spec).
34
+
35
+ ## License
36
+
37
+ MIT
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'bundler/setup'
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new(:default)
data/bin/jobspec ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'job_spec/cli'
5
+
6
+ JobSpec::CLI.start(ARGV)
data/job_spec.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ LIB = File.expand_path('../lib', __FILE__)
2
+ require File.join(LIB, 'job_spec/version')
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = 'job_spec'
6
+ spec.version = JobSpec::VERSION
7
+ spec.authors = ['Luke Morton']
8
+ spec.email = ['luke@madetech.com']
9
+
10
+ spec.summary = %q{Define job specs in ruby and publish to markdown}
11
+ spec.homepage = 'https://github.com/madetech/job_spec'
12
+ spec.license = 'MIT'
13
+
14
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(example|spec)/}) }
15
+ spec.executables = ['jobspec']
16
+ spec.require_paths = ['lib']
17
+
18
+ spec.add_dependency 'bundler'
19
+ spec.add_dependency 'thor'
20
+ spec.add_development_dependency 'rake'
21
+ spec.add_development_dependency 'rspec'
22
+ end
@@ -0,0 +1,21 @@
1
+ require 'thor'
2
+ require 'job_spec'
3
+
4
+ module JobSpec
5
+ class CLI < Thor
6
+ desc 'build DIR', 'build roles in DIR'
7
+ def build(path = '.')
8
+ print "Building roles in #{path}... "
9
+ Dir[File.join(Dir.pwd, path, '**/*.rb')].each { |f| require f }
10
+ puts 'done.'
11
+ p Role.definitions
12
+ end
13
+
14
+ map %w(--version -v) => :version
15
+
16
+ desc '--version', 'get jobspec version'
17
+ def version
18
+ puts "jobspec v#{JobSpec::VERSION}"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module JobSpec
2
+ VERSION = '0.1.0'
3
+ end
data/lib/job_spec.rb ADDED
@@ -0,0 +1,45 @@
1
+ module JobSpec
2
+ class Role
3
+ def self.definition(name, &block)
4
+ @definitions ||= []
5
+ @definitions << new(name, &block)
6
+ end
7
+
8
+ def self.definitions
9
+ @definitions
10
+ end
11
+
12
+ def initialize(name, &block)
13
+ @name = name
14
+ @expectations = []
15
+ instance_eval(&block) if block_given?
16
+ end
17
+
18
+ def salary(range = nil)
19
+ @salary = @salary || range
20
+ end
21
+
22
+ def include(role_expectations)
23
+ @expectations.concat(role_expectations.to_a)
24
+ end
25
+
26
+ def expected(expectation)
27
+ @expectations << expectation
28
+ end
29
+
30
+ def to_a
31
+ @expectations
32
+ end
33
+
34
+ class Expectations
35
+ def self.expected(expectation)
36
+ @role ||= Role.new(self.class.name)
37
+ @role.expected(expectation)
38
+ end
39
+
40
+ def self.to_a
41
+ @role.to_a
42
+ end
43
+ end
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: job_spec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Luke Morton
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-12-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
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: thor
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: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
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: rspec
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
+ description:
70
+ email:
71
+ - luke@madetech.com
72
+ executables:
73
+ - jobspec
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - Gemfile
80
+ - README.md
81
+ - Rakefile
82
+ - bin/jobspec
83
+ - job_spec.gemspec
84
+ - lib/job_spec.rb
85
+ - lib/job_spec/cli.rb
86
+ - lib/job_spec/version.rb
87
+ homepage: https://github.com/madetech/job_spec
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.6.13
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Define job specs in ruby and publish to markdown
111
+ test_files: []