public
Rubygem
Description: JSON Web App Framework
Homepage: http://halcyon.rubyforge.org/
Clone URL: git://github.com/mtodd/halcyon.git
Search Repo:
Click here to lend your support to: halcyon and make a donation at www.pledgie.com !
Added Halcyon.environment configurable attribute, including tests. 
Defaults to the development environment. Also updated app init templates 
to include configuration and initialization, along with documentation. 
[#35 state:resolved]
mtodd (author)
Mon May 12 02:37:07 -0700 2008
commit  08cf8650bf861533a37cd30a074191df2314b74b
tree    50d22710f3fa3c53adf72e596497a42f09c8e70e
parent  43b73ce612cb345ef7e27c06f77d63a1acb53340
...
67
68
69
70
 
71
72
73
74
75
76
 
77
78
79
...
67
68
69
 
70
71
72
73
74
75
 
76
77
78
79
0
@@ -67,13 +67,13 @@
0
       Halcyon.logger = Halcyon::Logger.setup(Halcyon.config[:logging])
0
       
0
       # Run initializers
0
- Dir.glob(Halcyon.paths[:init]/'{requires.rb,hooks.rb,routes.rb,*}').each do |initializer|
0
+ Dir.glob(Halcyon.paths[:init]/'{requires,hooks,routes,environment,*}.rb').each do |initializer|
0
         self.logger.debug "Init: #{File.basename(initializer).chomp('.rb').camel_case}" if
0
         require initializer.chomp('.rb')
0
       end
0
       
0
       # Setup autoloads for Controllers found in Halcyon.root/'app'
0
- Dir.glob(Halcyon.paths[:controller]/'{application.rb,*}').each do |controller|
0
+ Dir.glob(Halcyon.paths[:controller]/'{application,*}.rb').each do |controller|
0
         self.logger.debug "Load: #{File.basename(controller).chomp('.rb').camel_case} Controller" if
0
         require controller.chomp('.rb')
0
       end
...
18
19
20
 
 
 
 
 
21
22
23
...
18
19
20
21
22
23
24
25
26
27
28
0
@@ -18,6 +18,11 @@
0
     Halcyon.config.is_a?(Hash).should.be.true?
0
   end
0
   
0
+ it "should provide environment label" do
0
+ Halcyon.environment.should == :development
0
+ Halcyon.environment.should == Halcyon.config[:environment]
0
+ end
0
+
0
   it "should provide universal access to a logger" do
0
     # We assume Logger here because, you know, we're gods of the test
0
     Halcyon.logger.is_a?(Logger).should.be.true?
...
6
7
8
 
9
10
11
...
63
64
65
 
 
 
 
66
67
68
...
6
7
8
9
10
11
12
...
64
65
66
67
68
69
70
71
72
73
0
@@ -6,6 +6,7 @@
0
 
0
 $config = {
0
   :allow_from => :all,
0
+ :environment => :development,
0
   :logger => nil,
0
   :logging => {
0
     :level => 'debug'
0
@@ -63,6 +64,10 @@
0
 class Model
0
   attr_accessor :id
0
 end
0
+
0
+# Environment
0
+
0
+Halcyon.configurable_attr(:environment)
0
 
0
 # Testing routes
0
 
...
6
7
8
 
 
 
 
 
 
 
9
10
11
...
6
7
8
9
10
11
12
13
14
15
16
17
18
0
@@ -6,6 +6,13 @@
0
 # * <tt>halcyon_clients</tt>: only Halcyon clients (tests the User-Agent only)
0
 allow_from: all
0
 
0
+# = Environment
0
+#
0
+# Uncomment to manually specify the environment to run the application in.
0
+# Defaults to <tt>:development</tt>.
0
+#
0
+# environment: production
0
+
0
 # = Logging
0
 #
0
 # Configures the logging client in the framework, including destination,
...
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
0
@@ -1 +1,12 @@
0
+# = Environment
0
+#
0
+# Sets the environment unless already set.
0
+#
0
+# Creates the <tt>Halcyon.environment</tt> configurable attribute. Since this
0
+# is mapped to <tt>Halcyon.config[:environment]</tt>, environment can be set
0
+# by setting the <tt>environment:</tt> configuration value in the
0
+# <tt>config/config.yml</tt> file.
0
+
0
+Halcyon.configurable_attr(:environment)
0
+Halcyon.environment = :development unless Halcyon.environment
...
14
15
16
 
 
 
 
 
 
17
18
19
...
14
15
16
17
18
19
20
21
22
23
24
25
0
@@ -14,6 +14,12 @@
0
   }
0
 }.to_mash
0
 
0
+# = Environment
0
+# Set the environment if not set above; create the <tt>Halcyon.environment</tt>
0
+# configurable attribute. Maps to <tt>Halcyon.config[:environment]</tt>.
0
+Halcyon.configurable_attr(:environment)
0
+Halcyon.environment = :development unless Halcyon.environment
0
+
0
 # = Routes
0
 Halcyon::Application.route do |r|
0
   r.match('/time').to(:controller => 'application', :action => 'time')

Comments

    No one has commented yet.