gaston 0.3.0 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +30 -19
- data/lib/gaston.rb +3 -0
- data/lib/gaston/generators/gaston/config_generator.rb +16 -0
- data/lib/gaston/generators/templates/_gaston.rb +5 -0
- data/lib/gaston/generators/templates/gaston/.gitkeep +0 -0
- data/lib/gaston/version.rb +1 -1
- metadata +10 -11
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 448908b2f49f029a5590af530a114fe3cb68fb44
|
4
|
+
data.tar.gz: f958ef1aacd78fd6c977327fffbd384bf9f082e2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 180fff0d9bcb83766a71520174c3f23819f968f9dc99e971bf5b9369dd5c5bc592608af4bb534368307703817da5a1a804252883f14b2227630444a938fae823
|
7
|
+
data.tar.gz: 755f344be0866784bc3ec9fe04c5c75007c814ab1cde44256643c0e73b0c65f567367ea3b44be1f8f6fc535e17fe4a7229a6e2f0be49613df05dcba1ed827eb3
|
data/README.md
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
GASTON
|
2
|
-
======
|
1
|
+
# GASTON
|
3
2
|
|
4
|
-
Gaston is a dead simple Ruby config store. Write your config in yaml files, and
|
3
|
+
Gaston is a dead simple Ruby config store. Write your config in yaml files, and
|
4
|
+
retrieve it through one Gaston.
|
5
5
|
|
6
|
-
Installation
|
7
|
-
------------
|
6
|
+
## Installation
|
8
7
|
|
9
8
|
Ruby 1.9.2 is required.
|
10
9
|
|
@@ -18,6 +17,25 @@ With bundler, add it to your `Gemfile`:
|
|
18
17
|
gem "gaston"
|
19
18
|
```
|
20
19
|
|
20
|
+
Within a rails project, run the following command:
|
21
|
+
|
22
|
+
``` bash
|
23
|
+
rails g gaston:config
|
24
|
+
```
|
25
|
+
|
26
|
+
Otherwise, create an initializer. You can define an environment with the `env`
|
27
|
+
method, and specify config files with the `files` method. Default `env` is
|
28
|
+
`:development`.
|
29
|
+
|
30
|
+
``` ruby
|
31
|
+
Gaston.configure do |gaston|
|
32
|
+
gaston.env = Rails.env
|
33
|
+
gaston.files = Dir[Rails.root.join("config/gaston/**/*.yml")]
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
21
39
|
Always specify environment in yaml :
|
22
40
|
|
23
41
|
Environment values are merged on `:gaston` values. `:gaston` is optional.
|
@@ -38,14 +56,6 @@ You can use erb inside values.
|
|
38
56
|
|
39
57
|
Since verion `0.2.0`, gaston also accept json files.
|
40
58
|
|
41
|
-
Create an initializer. You can define an environment with the `env` method, and specify config files with the `files` method. Default `env` is `:development`.
|
42
|
-
|
43
|
-
``` ruby
|
44
|
-
Gaston.configure do |gaston|
|
45
|
-
gaston.env = Rails.env
|
46
|
-
gaston.files = Dir[Rails.root.join("config/gaston/**/*.yml")]
|
47
|
-
end
|
48
|
-
```
|
49
59
|
|
50
60
|
Querying a config key :
|
51
61
|
|
@@ -54,17 +64,18 @@ Gaston.api.state # => 'awesome'
|
|
54
64
|
Gaston.api.key # => 'api_key'
|
55
65
|
```
|
56
66
|
|
57
|
-
Note on Patches/Pull Requests
|
58
|
-
-----------------------------
|
67
|
+
## Note on Patches/Pull Requests
|
59
68
|
|
60
69
|
* Fork the project.
|
61
70
|
* Make your feature addition or bug fix.
|
62
|
-
* Add tests for it. This is important so I don't break it in a future version
|
63
|
-
|
71
|
+
* Add tests for it. This is important so I don't break it in a future version
|
72
|
+
unintentionally.
|
73
|
+
* Commit, do not mess with rakefile, version, or history. (if you want to have
|
74
|
+
your own version, that is fine but bump version in a commit by itself in another
|
75
|
+
branch so I can ignore when I pull)
|
64
76
|
* Send me a pull request. Bonus points for topic branches.
|
65
77
|
|
66
78
|
|
67
|
-
Copyright
|
68
|
-
---------
|
79
|
+
## Copyright
|
69
80
|
|
70
81
|
MIT. See LICENSE for further details.
|
data/lib/gaston.rb
CHANGED
@@ -7,6 +7,9 @@ class Gaston
|
|
7
7
|
require 'gaston/configuration'
|
8
8
|
require 'gaston/store'
|
9
9
|
require 'gaston/parse'
|
10
|
+
if defined?(Rails) && defined?(Rails::Generators)
|
11
|
+
require 'gaston/generators/gaston/config_generator'
|
12
|
+
end
|
10
13
|
|
11
14
|
# Parse yml config files, merge them, and store into
|
12
15
|
# gaston::Store
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class Gaston
|
4
|
+
module Generators
|
5
|
+
class ConfigGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path("../../templates", __FILE__)
|
7
|
+
|
8
|
+
desc "Creates a Gaston initializer"
|
9
|
+
|
10
|
+
def copy_initializer
|
11
|
+
directory "gaston", "config/gaston"
|
12
|
+
template "_gaston.rb", "config/initializers/_gaston.rb"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
File without changes
|
data/lib/gaston/version.rb
CHANGED
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gaston
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- chatgris
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-04-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -37,31 +34,33 @@ files:
|
|
37
34
|
- README.md
|
38
35
|
- lib/gaston.rb
|
39
36
|
- lib/gaston/configuration.rb
|
37
|
+
- lib/gaston/generators/gaston/config_generator.rb
|
38
|
+
- lib/gaston/generators/templates/_gaston.rb
|
39
|
+
- lib/gaston/generators/templates/gaston/.gitkeep
|
40
40
|
- lib/gaston/parse.rb
|
41
41
|
- lib/gaston/store.rb
|
42
42
|
- lib/gaston/version.rb
|
43
43
|
homepage: http://chatgris.github.com/Gaston
|
44
44
|
licenses: []
|
45
|
+
metadata: {}
|
45
46
|
post_install_message:
|
46
47
|
rdoc_options: []
|
47
48
|
require_paths:
|
48
49
|
- lib
|
49
50
|
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
56
|
requirements:
|
58
|
-
- -
|
57
|
+
- - '>='
|
59
58
|
- !ruby/object:Gem::Version
|
60
59
|
version: '0'
|
61
60
|
requirements: []
|
62
61
|
rubyforge_project:
|
63
|
-
rubygems_version:
|
62
|
+
rubygems_version: 2.0.0
|
64
63
|
signing_key:
|
65
|
-
specification_version:
|
64
|
+
specification_version: 4
|
66
65
|
summary: Dead simple Ruby config store.
|
67
66
|
test_files: []
|