story_branch 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -4
  3. data/lib/story_branch.rb +4 -6
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94643738fef3522b3b25e155848a52e9bcf83ce5
4
- data.tar.gz: 84f349af0a2f0772e11233fcf0e259cb22272aed
3
+ metadata.gz: 1177647df695fb3f6484115ac9e97d45aea9a3df
4
+ data.tar.gz: 1cafb5c066769b0157314e08262be0affef543ab
5
5
  SHA512:
6
- metadata.gz: e4e18c541709a138b85234b37b42f07e03236b027fb889a58bb55afe370c27dea694c613cd81c2b1c029cda9d4949188eb7c0df1b55fb35d4311ff1099f773a4
7
- data.tar.gz: b7bf94918f1fb6b4c667f0b23d5b2185b81e47eef21e8fa98711bf38ec1cf45353ab1ed23884d0da4325af6317fd542ac9ccb9147f097efd31fe42bc3621846a
6
+ metadata.gz: 7194737e8a67fa453f6a025fd56c8628b2e75ec81de5c55e3a9746c2bdaaa983e965bea7571133d267ecfc7cfc9871f4ecc32453c49ff9b25ee84e2205fc2a42
7
+ data.tar.gz: 2c5d397bdf1c4184cd7317abd17d2078fac9826b2f7d58ba9f89f9695b3b49dbef75b6359692c490388932a05f23793e207d9ccae3f378cef84f9641b94fe7e1
data/README.md CHANGED
@@ -42,10 +42,32 @@ Install the gem:
42
42
 
43
43
  #### Settings
44
44
 
45
- You must have a `PIVOTAL_API_KEY` environment variable set
46
- to your Pivotal api key, plus either a `.story_branch` file or
47
- `PIVOTAL_PROJECT_ID` environment variable set. Note, values in
48
- `.story_branch` will override environment variable settings.
45
+ You can have your settings set either on a `.story_branch` file
46
+ or in environment variables.
47
+
48
+ The `.story_branch` files have priority over environment variables so if you set both,
49
+ the configuration within `.story_branch` will be the one used.
50
+ Also, the `.story_branch` file inside a project directory has priority over the global one.
51
+
52
+ The settings will be loaded firstly from local config file, if not found then from global
53
+ config file and ultimately from the environment variables. If none are found, an error
54
+ will be thrown.
55
+
56
+ This means that you can have a globally set api key and for each project using Pivotal Tracker
57
+ have a local config inside the project folder.
58
+ E.g.
59
+
60
+ ```
61
+ $ cat ~/.story_branch
62
+ api: your_API_key_that_you_get_from_pivotal_tracker
63
+
64
+ $ cat ~/your_project_dir/.story_branch
65
+ project: 123123
66
+ ```
67
+
68
+ In case you prefer to use environment variables, you can set
69
+ `PIVOTAL_API_KEY` to your pivotal tracker api key and set
70
+ `PIVOTAL_PROJECT_ID` to your project id.
49
71
 
50
72
  #### .story_branch file
51
73
 
data/lib/story_branch.rb CHANGED
@@ -103,7 +103,6 @@ module StoryBranch
103
103
  attr_accessor :p
104
104
 
105
105
  def initialize
106
- @pivotal_info = YAML.load_file config_file if config_file
107
106
  @p = PivotalUtils.new
108
107
  @p.api_key = config_value 'api', 'PIVOTAL_API_KEY'
109
108
  @p.project_id = config_value 'project', 'PIVOTAL_PROJECT_ID'
@@ -202,12 +201,11 @@ module StoryBranch
202
201
  end
203
202
  end
204
203
 
205
- def config_file
206
- PIVOTAL_CONFIG_FILES.select{|conf| File.exists? conf}.first
207
- end
208
-
209
204
  def config_value key, env
210
- value = @pivotal_info[key] if @pivotal_info and @pivotal_info[key]
205
+ PIVOTAL_CONFIG_FILES.each do |config_file|
206
+ pivotal_info = YAML.load_file config_file
207
+ return pivotal_info[key] if pivotal_info[key]
208
+ end
211
209
  value ||= env_required env
212
210
  value
213
211
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: story_branch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Milkins
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-05-12 00:00:00.000000000 Z
15
+ date: 2016-03-08 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: blanket_wrapper
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  requirements: []
144
144
  rubyforge_project:
145
- rubygems_version: 2.4.3
145
+ rubygems_version: 2.4.8
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: Story Branch - create git branches based on pivotal tracker stories