scrum_lint 0.0.1 → 0.0.2

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
2
  SHA1:
3
- metadata.gz: 713f645a6fa0f2c33084d44f74a605ec0fe58266
4
- data.tar.gz: 2852c9b789f35bb7e89cfd811c94fa199eebadfd
3
+ metadata.gz: d61fb1e76e63f0d5ef49bbf8a5c10b0f454e43c6
4
+ data.tar.gz: a9e1a7fc6ba2935e5544d5d09caf87c19b9228f2
5
5
  SHA512:
6
- metadata.gz: 1cdc0fdb95cae70b269bd36e339bc8d8ac8a5b7105490a5a96e7286e64736ad1b2842f0c70b3b2a552aee2727f313b6a13b2f19d647ccc821e5250839e1089e7
7
- data.tar.gz: 5a4d08158dc6178d70ac68fa3d2368660a7f32f88e8366dd754aec5de66c4eebdf6110b2d4d3929a74265a5c8f7800f5b319b007c49ed4ba8127a40ca3c7ad02
6
+ metadata.gz: 38b38598927e3b68738978b3863465073c2c41ad272fdd414e24b7f7cf5f938c02a5d9415258df0eec27113bf45cbf1a47d78614b583bd681d3a3f6f57d3c9fe
7
+ data.tar.gz: 4a413679359d281a13aa5887992cfc034bf147d4b6ae403bd0cf8db0d3e4b975595924b25227c04c8f8856f7134131755cf5a7645c90e81a9ea2350ad41e6670
data/README.md CHANGED
@@ -12,9 +12,10 @@ gem install scrum_lint
12
12
 
13
13
  ## Usage
14
14
 
15
- ScrumLint expects the environment variables `TRELLO_DEVELOPER_PUBLIC_KEY` and
16
- `TRELLO_MEMBER_TOKEN` to be set in order to work. You can see how to acquire
17
- these tokens in the [Basic authorization section of the `ruby-trello`
15
+ ScrumLint expects a `.scrum-lint.yml` file in the current working directory
16
+ with at a minimum a `trello_developer_public_key` and `trello_member_token`.
17
+ You can see how to acquire these tokens in the ["Basic authorization" section
18
+ of the `ruby-trello`
18
19
  gem](https://github.com/jeremytregunna/ruby-trello#basic-authorization). Once
19
20
  you've set these, you can run the following command for a list of corrections
20
21
  to be made:
@@ -28,14 +29,14 @@ ensure it is up to date, and list out any violations.
28
29
 
29
30
  ## Linters
30
31
 
31
- ### Context
32
+ **Context**
32
33
 
33
- The Context linter checks that each card in task lists has a context listed at
34
+ The Context linter checks that each card in task lists has a context link at
34
35
  the beginning of it's description. This is expected to be a text label in the
35
36
  format:
36
37
 
37
38
  ```
38
- Context: https://trello.com/c/<some_card_hash>
39
+ Context: <link to a Trello card>
39
40
  ```
40
41
 
41
42
  ## Development
@@ -1,17 +1,63 @@
1
+ require 'yaml'
2
+ require 'erb'
3
+
1
4
  module ScrumLint
2
5
 
3
- module Configuration
4
- def self.new
5
- OpenStruct.new(
6
- board_name: 'Eng: Current',
7
- task_list_names: ['Planned', 'This Sprint', 'Doing', 'In Review'],
8
- done_list_matcher: /^Done.*$/,
9
- project_list_names: ['Active Projects'],
10
- ignored_list_names: %w(Emergent),
11
- trello_developer_public_key: ENV.fetch('TRELLO_DEVELOPER_PUBLIC_KEY'),
12
- trello_member_token: ENV.fetch('TRELLO_MEMBER_TOKEN'),
13
- )
6
+ class Configuration
7
+
8
+ DEFAULT_CONFIGURATION = {
9
+ board_name: 'Eng: Current',
10
+ task_list_names: ['Planned', 'This Sprint', 'Doing', 'In Review'],
11
+ done_list_matcher: /^Done.*$/,
12
+ project_list_names: ['Active Projects'],
13
+ ignored_list_names: %w(Emergent),
14
+ }.freeze
15
+
16
+ REQUIRED_CONFIGURATION_KEYS = [
17
+ :trello_developer_public_key,
18
+ :trello_member_token,
19
+ ].freeze
20
+
21
+ CONFIGURATION_KEYS =
22
+ (DEFAULT_CONFIGURATION.keys + REQUIRED_CONFIGURATION_KEYS).freeze
23
+
24
+ attr_accessor(*CONFIGURATION_KEYS)
25
+
26
+ def initialize
27
+ options = load_yaml_config.merge(DEFAULT_CONFIGURATION)
28
+
29
+ CONFIGURATION_KEYS.each do |key|
30
+ self.send("#{key}=", options.fetch(key))
31
+ options.delete(key)
32
+ end
33
+ raise "invalid options: #{options.keys}" if options.any?
14
34
  end
35
+
36
+ private
37
+
38
+ def load_yaml_config
39
+ unless File.exist?(config_file_path)
40
+ abort('Please add a ".scrum-lint.yml" file and try again')
41
+ end
42
+ symbolize_keys(YAML.safe_load(config_file_contents))
43
+ end
44
+
45
+ def config_file_contents
46
+ ERB.new(IO.read(config_file_path)).result
47
+ end
48
+
49
+ def config_file_path
50
+ './.scrum-lint.yml'
51
+ end
52
+
53
+ def symbolize_keys(hash)
54
+ hash.each_with_object({}) do |(key, value), result|
55
+ new_key = key.is_a?(String) ? key.to_sym : key
56
+ new_value = value.is_a?(Hash) ? symbolize_keys(value) : value
57
+ result[new_key] = new_value
58
+ end
59
+ end
60
+
15
61
  end
16
62
 
17
63
  end
@@ -3,6 +3,10 @@ module ScrumLint
3
3
  class Configurator
4
4
 
5
5
  def self.call
6
+ new.()
7
+ end
8
+
9
+ def call
6
10
  Trello.configure do |trello_config|
7
11
  trello_config.developer_public_key = trello_developer_public_key
8
12
  trello_config.member_token = trello_member_token
@@ -11,11 +15,11 @@ module ScrumLint
11
15
 
12
16
  private
13
17
 
14
- def self.trello_developer_public_key
18
+ def trello_developer_public_key
15
19
  ScrumLint.config.trello_developer_public_key
16
20
  end
17
21
 
18
- def self.trello_member_token
22
+ def trello_member_token
19
23
  ScrumLint.config.trello_member_token
20
24
  end
21
25
 
@@ -1,3 +1,3 @@
1
1
  module ScrumLint
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrum_lint
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
  - Robert Fletcher
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-12 00:00:00.000000000 Z
11
+ date: 2016-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-trello