stephencelis-app 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{History.txt → History.rdoc} +8 -0
- data/Manifest.txt +1 -1
- data/README.rdoc +13 -12
- data/lib/app.rb +2 -1
- data/test/app_test.rb +4 -0
- metadata +5 -4
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
@@ -47,18 +47,6 @@ Sugar, sugar, sugar.
|
|
47
47
|
|
48
48
|
Let's not overdo it, though. <tt>App.apis.flickr</tt> just doesn't look right.
|
49
49
|
|
50
|
-
If your "app.yml" gets out of hand, modularize:
|
51
|
-
|
52
|
-
# config/app/authenticate.yml
|
53
|
-
---
|
54
|
-
username: password
|
55
|
-
|
56
|
-
# (elsewhere)
|
57
|
-
App::Authenticate["username"] # => "password"
|
58
|
-
|
59
|
-
|
60
|
-
Namespaces avoid collisions.
|
61
|
-
|
62
50
|
|
63
51
|
== REQUIREMENTS
|
64
52
|
|
@@ -89,6 +77,19 @@ Or submodule:
|
|
89
77
|
% script/generate app_config
|
90
78
|
|
91
79
|
|
80
|
+
If your "app.yml" gets out of hand, modularize, like in this heavy-handed
|
81
|
+
example:
|
82
|
+
|
83
|
+
% script/generate app_config apis/twitter
|
84
|
+
create config/app/apis
|
85
|
+
create config/app/apis/twitter.yml # Configure me!
|
86
|
+
|
87
|
+
|
88
|
+
Namespaces avoid collisions:
|
89
|
+
|
90
|
+
App::Apis::Twitter.username
|
91
|
+
|
92
|
+
|
92
93
|
== LICENSE
|
93
94
|
|
94
95
|
(The MIT License)
|
data/lib/app.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# What would your app be without it? Still an app, but without App.
|
4
4
|
module App
|
5
|
-
VERSION = "0.2.
|
5
|
+
VERSION = "0.2.2"
|
6
6
|
|
7
7
|
@@config = {} # Initialize.
|
8
8
|
class << self
|
@@ -41,6 +41,7 @@ module App
|
|
41
41
|
raw = File.read Rails.root.join("config", "#{name.underscore}.yml")
|
42
42
|
all = YAML.load(ERB.new(raw).result)
|
43
43
|
@@config = all[Rails.env] || all
|
44
|
+
@@config.freeze
|
44
45
|
rescue Errno::ENOENT => e
|
45
46
|
puts '** App: no file "config/app.yml". Run `script/generate app_config`.'
|
46
47
|
end
|
data/test/app_test.rb
CHANGED
@@ -57,4 +57,8 @@ class AppTest < ActiveSupport::TestCase
|
|
57
57
|
assert_instance_of Module, App::Authenticate::Basic::Config
|
58
58
|
assert_equal :basic, App::Authenticate::Basic::Config.authentication_type
|
59
59
|
end
|
60
|
+
|
61
|
+
test "should be frozen" do
|
62
|
+
assert_raise(TypeError) { App.config["loaded_at"] = Time.now }
|
63
|
+
end
|
60
64
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stephencelis-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Celis
|
@@ -30,10 +30,11 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
|
32
32
|
extra_rdoc_files:
|
33
|
-
- History.
|
33
|
+
- History.rdoc
|
34
34
|
- Manifest.txt
|
35
|
+
- README.rdoc
|
35
36
|
files:
|
36
|
-
- History.
|
37
|
+
- History.rdoc
|
37
38
|
- Manifest.txt
|
38
39
|
- README.rdoc
|
39
40
|
- Rakefile
|
@@ -46,7 +47,7 @@ files:
|
|
46
47
|
- test/fixtures/app/authenticate.yml
|
47
48
|
- test/fixtures/app.yml
|
48
49
|
has_rdoc: true
|
49
|
-
homepage:
|
50
|
+
homepage: http://github.com/stephencelis/app
|
50
51
|
post_install_message:
|
51
52
|
rdoc_options:
|
52
53
|
- --main
|