Skip to content

Commit d209929

Browse files
committed
Enable markdownlint for checking documentation style consistency
1 parent 9f0f155 commit d209929

File tree

6 files changed

+74
-50
lines changed

6 files changed

+74
-50
lines changed

.mdlrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
git_recurse true
2+
style ".mdlstyle.rb"

.mdlstyle.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
all
2+
rule 'MD013', :line_length => 120

CHANGELOG.md

+28-24
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
1-
# 1.1.0
1+
# Changelog
2+
3+
## 1.1.0
24

35
* Add ability to specify knockout_prefix option for deep_merge
46
* Minor code and documentation refactoring and cleanup
57

6-
# 1.0.0
8+
## 1.0.0
79

810
* `RailsConfig` is now officially renamed to `Config`
9-
* Fixed array descent when converting to hash ([#89](https://github.com/railsconfig/config/pull/89))
10-
* Catch OpenStruct reserved keywords ([#95](https://github.com/railsconfig/config/pull/95) thanks @dudo)
11-
* Allows loading before app configuration process ([#107](https://github.com/railsconfig/config/pull/107) thanks @Antiarchitect)
12-
* `deep_merge` is now properly managed via gemspec ([#110](https://github.com/railsconfig/config/pull/110))
13-
* Added `prepend_source!` ([#102](https://github.com/railsconfig/config/pull/102))
11+
* Fixed array descent when converting to hash ([##89](https://github.com/railsconfig/config/pull/89))
12+
* Catch OpenStruct reserved keywords ([##95](https://github.com/railsconfig/config/pull/95) thanks @dudo)
13+
* Allows loading before app configuration process ([##107](https://github.com/railsconfig/config/pull/107) thanks @Antiarchitect)
14+
* `deep_merge` is now properly managed via gemspec ([##110](https://github.com/railsconfig/config/pull/110))
15+
* Added `prepend_source!` ([##102](https://github.com/railsconfig/config/pull/102))
16+
17+
## 0.99
1418

15-
# 0.99
1619
* Released deprecated gem migrating to the new name
1720

18-
# 0.5.0.beta1
21+
## 0.5.0.beta1
22+
23+
* Ability to use in Settings file keywords reserved for OpenStruct: select, collect ([##95](https://github.com/railsjedi/config/issues/95))
24+
* Made config work without Rails as a hard dependency ([##86](https://github.com/railsjedi/config/issues/86), [##88](https://github.com/railsjedi/config/issues/88))
25+
* Fix generate error when .gitignore is missing ([##85](https://github.com/railsjedi/config/issues/85))
26+
* Fix deprecation warning on File.exists? ([##81](https://github.com/railsjedi/config/issues/81))
27+
* Add a shortcut method for setting files ([##67](https://github.com/railsjedi/config/issues/67))
28+
* Improve YAMLSource load error message by outputting offending file path ([##88](https://github.com/railsjedi/config/issues/88))
1929

20-
* Ability to use in Settings file keywords reserved for OpenStruct: select, collect ([#95](https://github.com/railsjedi/config/issues/95))
21-
* Made config work without Rails as a hard dependency ([#86](https://github.com/railsjedi/config/issues/86), [#88](https://github.com/railsjedi/config/issues/88))
22-
* Fix generate error when .gitignore is missing ([#85](https://github.com/railsjedi/config/issues/85))
23-
* Fix deprecation warning on File.exists? ([#81](https://github.com/railsjedi/config/issues/81))
24-
* Add a shortcut method for setting files ([#67](https://github.com/railsjedi/config/issues/67))
25-
* Improve YAMLSource load error message by outputting offending file path ([#88](https://github.com/railsjedi/config/issues/88))
30+
## 0.4.2
2631

27-
# 0.4.2
28-
* Ability to specify the app name when calling the Heroku rake task ([#75](https://github.com/railsjedi/config/issues/75))
32+
* Ability to specify the app name when calling the Heroku rake task ([##75](https://github.com/railsjedi/config/issues/75))
2933

30-
# 0.4.1
34+
## 0.4.1
3135

32-
* Fixed compatibility with Rails 4.1 ([#72](https://github.com/railsjedi/config/issues/72))
36+
* Fixed compatibility with Rails 4.1 ([##72](https://github.com/railsjedi/config/issues/72))
3337
* Testing suite verifies compatibility with Rails 3.2, 4.0 and 4.1
3438

35-
# 0.4.0
39+
## 0.4.0
3640

37-
* Compatibility with Heroku ([#64](https://github.com/railsjedi/config/issues/64))
41+
* Compatibility with Heroku ([##64](https://github.com/railsjedi/config/issues/64))
3842

39-
# 0.3.4
43+
## 0.3.4
4044

41-
* Expose Settings in application.rb, so you don't have to duplicate configuration for each environment file ([#59](https://github.com/railsjedi/config/issues/59))
42-
* Adding support for Rails 4.1.0.rc ([#70](https://github.com/railsjedi/config/issues/70))
45+
* Expose Settings in application.rb, so you don't have to duplicate configuration for each environment file ([##59](https://github.com/railsjedi/config/issues/59))
46+
* Adding support for Rails 4.1.0.rc ([##70](https://github.com/railsjedi/config/issues/70))
4347

4448

4549

LICENSE.md

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222

23-
2423
Third-party materials and licenses:
2524

2625
* Config contains Deep Merge (deep_merge.rb) which is governed by the MIT license

README.md

+39-25
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,22 @@ Config helps you easily manage environment specific settings in an easy and usab
1212

1313
## Features
1414

15-
- simple YAML config files
16-
- config files support ERB
17-
- config files support inheritance and multiple environments
18-
- access config information via convenient object member notation
19-
- support for multi-level settings (`Settings.group.subgroup.setting`)
20-
- local developer settings ignored when committing the code
15+
* simple YAML config files
16+
* config files support ERB
17+
* config files support inheritance and multiple environments
18+
* access config information via convenient object member notation
19+
* support for multi-level settings (`Settings.group.subgroup.setting`)
20+
* local developer settings ignored when committing the code
2121

2222
## Compatibility
2323

24-
- Ruby `2.x`
25-
- Rails `>= 3.1` and `4`
26-
- Padrino
27-
- Sinatra
24+
* Ruby `2.x`
25+
* Rails `>= 3.1` and `4`
26+
* Padrino
27+
* Sinatra
2828

2929
For older versions of Rails or Ruby use [AppConfig](http://github.com/fredwu/app_config).
3030

31-
3231
## Installing
3332

3433
### Installing on Rails 3 or 4
@@ -75,22 +74,25 @@ register Config
7574

7675
### Installing on Sinatra
7776

78-
Add the gem to your `Gemfile` and run `bundle install` to install it. Afterwards in need to register `Config` in your app and give it a root so it can find the config files.
77+
Add the gem to your `Gemfile` and run `bundle install` to install it. Afterwards in need to register `Config` in your
78+
app and give it a root so it can find the config files.
7979

8080
```ruby
8181
set :root, File.dirname(__FILE__)
8282
register Config
8383
```
8484

85-
It's also possible to initialize `Config` manually within your configure block if you want to just give it some yml paths to load from.
85+
It's also possible to initialize `Config` manually within your configure block if you want to just give it some yml
86+
paths to load from.
8687

8788
```ruby
8889
Config.load_and_set_settings("/path/to/yaml1", "/path/to/yaml2", ...)
8990
```
9091

9192
## Accessing the Settings object
9293

93-
After installing the gem, `Settings` object will become available globally and by default will be compiled from the files listed below. Settings defined in files that are lower in the list override settings higher.
94+
After installing the gem, `Settings` object will become available globally and by default will be compiled from the
95+
files listed below. Settings defined in files that are lower in the list override settings higher.
9496

9597
config/settings.yml
9698
config/settings/#{environment}.yml
@@ -142,7 +144,8 @@ Settings.reload_from_files(
142144

143145
### Environment specific config files
144146

145-
You can have environment specific config files. Environment specific config entries take precedence over common config entries.
147+
You can have environment specific config files. Environment specific config entries take precedence over common config
148+
entries.
146149

147150
Example development environment config file:
148151

@@ -185,29 +188,33 @@ Settings.prepend_source!("/path/to/source.yml")
185188
Settings.reload!
186189
```
187190

188-
This will do the same as `add_source`, but the given YML file will be loaded first (instead of last) and its settings will be overwritten by any other configuration file.
189-
This is especially useful if you want to define defaults.
191+
This will do the same as `add_source`, but the given YML file will be loaded first (instead of last) and its settings
192+
will be overwritten by any other configuration file. This is especially useful if you want to define defaults.
190193

191-
One thing I like to do for my Rails projects is provide a local.yml config file that is .gitignored (so its independent per developer). Then I create a new initializer in `config/initializers/add_local_config.rb` with the contents
194+
One thing I like to do for my Rails projects is provide a local.yml config file that is .gitignored (so its independent
195+
per developer). Then I create a new initializer in `config/initializers/add_local_config.rb` with the contents
192196

193197
```ruby
194198
Settings.add_source!("#{Rails.root}/config/settings/local.yml")
195199
Settings.reload!
196200
```
197201

198-
> Note: this is an example usage, it is easier to just use the default local files `settings.local.yml, settings/#{Rails.env}.local.yml and environments/#{Rails.env}.local.yml` for your developer specific settings.
202+
> Note: this is an example usage, it is easier to just use the default local files `settings.local.yml,
203+
settings/#{Rails.env}.local.yml and environments/#{Rails.env}.local.yml` for your developer specific settings.
199204

200205
## Embedded Ruby (ERB)
201206

202207
Embedded Ruby is allowed in the configuration files. Consider the two following config files.
203208

204209
* ```#{Rails.root}/config/settings.yml```
210+
205211
```yaml
206212
size: 1
207213
server: google.com
208214
```
209215
210216
* ```#{Rails.root}/config/environments/development.yml```
217+
211218
```yaml
212219
size: 2
213220
computed: <%= 1 + 2 + 3 %>
@@ -263,10 +270,10 @@ Inheritance customization (check [Deep Merge](https://github.com/danielsdeleo/de
263270

264271
* `knockout_prefix` - ability to remove elements of the array set in earlier loaded settings file. Default: `nil`
265272

266-
267273
## Working with Heroku
268274

269-
Heroku uses ENV object to store sensitive settings which are like the local files described above. You cannot upload such files to Heroku because it's ephemeral filesystem gets recreated from the git sources on each instance refresh.
275+
Heroku uses ENV object to store sensitive settings which are like the local files described above. You cannot upload
276+
such files to Heroku because it's ephemeral filesystem gets recreated from the git sources on each instance refresh.
270277

271278
To use config with Heroku just set the `use_env` var to `true` in your `config/initializers/config.rb` file. Eg:
272279

@@ -277,7 +284,8 @@ Config.setup do |config|
277284
end
278285
```
279286

280-
Now config would read values from the ENV object to the settings. For the example above it would look for keys starting with 'AppSettings'. Eg:
287+
Now config would read values from the ENV object to the settings. For the example above it would look for keys starting
288+
with 'AppSettings'. Eg:
281289

282290
```ruby
283291
ENV['AppSettings.section.size'] = 1
@@ -293,13 +301,19 @@ To upload your local values to Heroku you could ran `bundle exec rake config:her
293301
Bootstrap
294302

295303
```bash
296-
$ appraisal install
304+
appraisal install
305+
```
306+
307+
Run the test suite:
308+
309+
```bash
310+
appraisal rspec
297311
```
298312

299-
Running the test suite
313+
If you modified any of the documentation files verify their format:
300314

301315
```bash
302-
$ appraisal rspec
316+
mdl --style .mdlstyle.rb *.md
303317
```
304318

305319
## Authors

config.gemspec

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ Gem::Specification.new do |s|
3939
s.add_development_dependency "rspec-rails", "~> 3.4.2"
4040
s.add_development_dependency "test-unit", "~> 3.1.7"
4141
s.add_development_dependency "sqlite3"
42+
43+
# Static code analysis
44+
s.add_development_dependency "mdl"
4245
s.add_development_dependency "rubocop"
4346

4447
if ENV['TRAVIS']

0 commit comments

Comments
 (0)