totem 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1e1fef0efa244f9ddb47614e6d7abe6bfe9bbc8
4
- data.tar.gz: 36e76c0eb66c1b3cad43d3075681d9610c5e7e31
3
+ metadata.gz: b91b0c0894e147403b0a8368ab3ed6cd0118f22c
4
+ data.tar.gz: f592fd42bf0fc878f223e92d7246811e8797327e
5
5
  SHA512:
6
- metadata.gz: 6d8028e8a41664dbdad40914fd43decc587379f0938268d75ff07f371028660a0d03b3718d10259e9d517fe07ca2cd94e53faac7e6c16830830e82a05255cfa8
7
- data.tar.gz: e4a432d15367fe08653fe82f320a7747ca7dcacac427a6cea4d7d720c6379559a27514c032c2088088c551a23f2d46477974e9cb41fa4d77abd5fc0cfe8a2f32
6
+ metadata.gz: 3933380a3066b2ddde6f7327372a88ef29a88b9bbd5791ad9772dc70201eeaf620a2c379b725f9311ef7659fa929ca2e4ba45755658d46a429db3176b005bd93
7
+ data.tar.gz: 5e19100ab1cbeed5dc2ef13afb5bcbac2909a7115a0b33e9df53a77fad9782c03570f026f35dd198ce480acbb165b3a1980e46fa5fa66b3596f347b43b98e82d
data/README.md CHANGED
@@ -75,6 +75,8 @@ Don't forget, you need to register this class in `app/loader.rb` with `require m
75
75
  Below is a list of available add-ons that extend the functionality of a Totem project:
76
76
 
77
77
  - [totem_activerecord](https://github.com/chadrem/totem_activerecord): The Rails database library
78
+ - [raad_totem](https://github.com/chadrem/raad_totem): Create background services (daemons)
79
+ - [Tribe](https://github.com/chadrem/tribe): Create actor model based apps and servers
78
80
 
79
81
  ## Contributing
80
82
 
@@ -10,13 +10,19 @@ module Totem
10
10
  def self.initialize(root)
11
11
  raise 'Already initialized.' if @setup
12
12
 
13
+ # Must stay at top of method.
14
+ run_callbacks(:before_init)
15
+
13
16
  @setup = true
14
17
  @root = root
15
18
  Bundler.require(Totem.env.to_sym)
16
- run_callbacks(:before_load_app)
19
+ run_callbacks(:before_first_load_app)
17
20
  $LOAD_PATH.unshift(root + '/app')
18
21
  load_app
19
- run_callbacks(:after_load_app)
22
+ run_callbacks(:after_first_load_app)
23
+
24
+ # Must stay at bottom of method.
25
+ run_callbacks(:after_init)
20
26
 
21
27
  return true
22
28
  end
@@ -30,12 +36,10 @@ module Totem
30
36
  end
31
37
 
32
38
  def self.env=(val)
39
+ run_callbacks(:before_set_env)
33
40
  raise 'env may only be set once and must be set before calling logger' if @logger || @env
34
41
  @env = val
35
- end
36
-
37
- def self.load_app
38
- require "#{Totem.root}/app/loader.rb"
42
+ run_callbacks(:after_set_env)
39
43
  end
40
44
 
41
45
  def self.component
@@ -43,8 +47,10 @@ module Totem
43
47
  end
44
48
 
45
49
  def self.component=(val)
50
+ run_callbacks(:before_set_component)
46
51
  raise 'component may only be set once and must be set before calling logger' if @logger || @component
47
52
  @component = val
53
+ run_callbacks(:after_set_component)
48
54
  end
49
55
 
50
56
  def self.instance
@@ -52,20 +58,14 @@ module Totem
52
58
  end
53
59
 
54
60
  def self.instance=(val)
61
+ run_callbacks(:before_set_instance)
55
62
  raise 'instance may only be set once and must be set before calling logger' if @logger || @instance
56
63
  @instance = val
57
- end
58
-
59
- def self.logger=(val)
60
- return @logger = val
64
+ run_callbacks(:after_set_instance)
61
65
  end
62
66
 
63
67
  def self.logger
64
- return @logger if @logger
65
-
66
- log_to_file
67
-
68
- return @logger
68
+ return @logger || log_to_file
69
69
  end
70
70
 
71
71
  def self.register_callback(type, callback=nil, &block)
@@ -87,18 +87,34 @@ module Totem
87
87
  return File.join(root, 'log', "#{process_name}.log")
88
88
  end
89
89
 
90
+ def self.reload
91
+ run_callbacks(:before_reload)
92
+ load_app
93
+ run_callbacks(:after_reload)
94
+ end
95
+
96
+ def self.restart
97
+ run_callbacks(:before_restart)
98
+ load_app
99
+ run_callbacks(:after_restart)
100
+ end
101
+
90
102
  private
91
103
 
92
- def self.log_to_stdout
93
- init_logger($stdout)
104
+ def self.load_app
105
+ run_callbacks(:before_load_app)
106
+ load "#{Totem.root}/app/loader.rb"
107
+ run_callbacks(:after_load_app)
94
108
 
95
109
  return nil
96
110
  end
97
111
 
98
- def self.log_to_file
99
- init_logger(log_file_path)
112
+ def self.log_to_stdout
113
+ return init_logger($stdout)
114
+ end
100
115
 
101
- return nil
116
+ def self.log_to_file
117
+ return init_logger(log_file_path)
102
118
  end
103
119
 
104
120
  def self.init_logger(output)
@@ -109,7 +125,7 @@ module Totem
109
125
  "#{datetime} :: #{msg}\n"
110
126
  end
111
127
 
112
- return nil
128
+ return @logger
113
129
  end
114
130
 
115
131
  def self.run_callbacks(type)
@@ -1,3 +1,3 @@
1
1
  module Totem
2
- VERSION = '0.0.7' unless defined?(Totem::VERSION)
2
+ VERSION = '0.0.8' unless defined?(Totem::VERSION)
3
3
  end
@@ -1,2 +1,6 @@
1
- # Manually require your application classes here.
2
- # Example: require 'my_class'
1
+ # Manually load your application files here using either 'load' or 'require'.
2
+ # Hot reloading requires that you design your code for it.
3
+ #
4
+ # Examples:
5
+ # load 'my_class.rb' # hot reloadable.
6
+ # require 'my_class' # one time load only.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: totem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Remesch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-15 00:00:00.000000000 Z
11
+ date: 2016-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  requirements: []
83
83
  rubyforge_project:
84
- rubygems_version: 2.2.2
84
+ rubygems_version: 2.5.1
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: It's like having a Rails project folder without the Rails dependency.