fig_magic 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +3 -0
- data/README.md +37 -11
- data/lib/fig_magic/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf044e9dc6a0ce8bd0a41ff6e0a232e2613f8dd0
|
4
|
+
data.tar.gz: fd8981061fd4be2f898faf21defc21811b3b04f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60580d5c8822b2540e62cbec36bd9b7ee7c5fa330ca6947d750e730ce9e2d7c69a6afc012bf894aa30492ab74700d43b92bc5b76fa385dee345577fec1b75ec8
|
7
|
+
data.tar.gz: 0b7875cc837a6cc28026657be73a328880f2ddcda108db8b6cbe3e7c19de8ca2b76c72fa9509d42805e4de02e0abcabe34f7fce2a1ed5843a8a1222d223314b6
|
data/ChangeLog
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
# fig_magic
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
and tests. The data is stored in yaml files.
|
3
|
+
Jeff Morgan (@cheezy) made 2 very awesome gems called DataMagic & FigNewtown. I love them both, but I feel dirty having to do 2 initializations in my projects. initializing both for the same location & file. hate having to initialize
|
4
|
+
By combining the 2 gems into a single package, you can have all the functions of each gem, but only one file page set + file load. Moreover, you can use a single namespace for
|
5
|
+
both direct hash calls & hash of hashes calls.
|
7
6
|
|
8
7
|
## Using
|
9
8
|
|
@@ -13,7 +12,7 @@ In order to use _fig_magic_ you will have to inform the gem where it can find th
|
|
13
12
|
FigMagic.yml_directory = 'data/yml'
|
14
13
|
````
|
15
14
|
|
16
|
-
If you do not specify a directory the gem will default to using a directory named _config
|
15
|
+
If you do not specify a directory the gem will default to using a directory named _config/.
|
17
16
|
|
18
17
|
After setting the directory you must load a file. This can be accomplished by calling the _load_ method.
|
19
18
|
|
@@ -23,9 +22,36 @@ FigMagic.load 'filename.yml'
|
|
23
22
|
|
24
23
|
If you do not specify a filename the gem will attempt to use a file named _default.yml_. If you are using this for testing you will more than likely want to call load before each test to load the proper data for the specific test, or use the namespaced keys method, detailed below.
|
25
24
|
|
26
|
-
Another option is to set an environment variable
|
25
|
+
Another option is to set an environment variable FIG_MAGIC_FILE. When this is set it will be used instead of the _default.yml_ file.
|
26
|
+
|
27
|
+
|
28
|
+
Next we simply begin calling methods on the FigMagic module that match our keys. Let's assume the system_test.yml file contains the following entries:
|
29
|
+
|
30
|
+
base_url: http://system_test.mycompany.com
|
31
|
+
database_user: cheezy
|
32
|
+
database_password: secret
|
33
|
+
|
34
|
+
|
35
|
+
In our code we can call methods that match the keys. Here is an example PageObject where we are using the `base_url` entry:
|
36
|
+
|
37
|
+
````ruby
|
38
|
+
class MyPage
|
39
|
+
include PageObject
|
40
|
+
|
41
|
+
page_url "#{FigMagic.base_url}/my_page.html"
|
42
|
+
end
|
43
|
+
````
|
44
|
+
|
45
|
+
We can also supply default values which will be returned if the property does not exist:
|
46
|
+
````ruby
|
47
|
+
class MyPage
|
48
|
+
include PageObject
|
49
|
+
|
50
|
+
page_url "#{FigMagic.base_url("http://cheezyworld.com")}/my_page.html"
|
51
|
+
end
|
52
|
+
````
|
27
53
|
|
28
|
-
|
54
|
+
If you have more complex data then you can utilize the `data_for` method that will return the data for a specific key. The most common way to use this is to include the _FigMagic_ module in a [page-object](https://github.com/cheezy/page-object) and then populate a page with the data. Here's an example:
|
29
55
|
|
30
56
|
````ruby
|
31
57
|
class MyPage
|
@@ -120,15 +146,15 @@ FigMagic.add_translator MyData # this line must go in the same file as the modul
|
|
120
146
|
|
121
147
|
## Documentation
|
122
148
|
|
123
|
-
The rdocs for this project can be found at [rubydoc.info](http://rubydoc.info/github/
|
149
|
+
The rdocs for this project can be found at [rubydoc.info](http://rubydoc.info/github/tk8817/fig_magic/master/frames).
|
124
150
|
|
125
|
-
To see the changes from release to release please look at the [ChangeLog](https://raw.github.com/
|
151
|
+
To see the changes from release to release please look at the [ChangeLog](https://raw.github.com/tk8817/fig_magic/master/ChangeLog)
|
126
152
|
|
127
153
|
|
128
154
|
|
129
155
|
## Known Issues
|
130
156
|
|
131
|
-
See [http://github.com/cheezy/fig_magic/issues](http://github.com/
|
157
|
+
See [http://github.com/cheezy/fig_magic/issues](http://github.com/tk8817/fig_magic/issues)
|
132
158
|
|
133
159
|
## Contributing
|
134
160
|
|
@@ -142,4 +168,4 @@ Please ensure all contributions contain proper tests.
|
|
142
168
|
|
143
169
|
## Copyright
|
144
170
|
|
145
|
-
Copyright (c) 2012-2013 Jeffrey S. Morgan
|
171
|
+
Copyright (c) 2012-2013 Jeffrey S. Morgan & Justin Commu See LICENSE for details.
|
data/lib/fig_magic/version.rb
CHANGED