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 +4 -4
- data/README.md +2 -0
- data/lib/totem.rb +37 -21
- data/lib/totem/version.rb +1 -1
- data/templates/app/loader.rb.erb +6 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b91b0c0894e147403b0a8368ab3ed6cd0118f22c
|
4
|
+
data.tar.gz: f592fd42bf0fc878f223e92d7246811e8797327e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/totem.rb
CHANGED
@@ -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(:
|
19
|
+
run_callbacks(:before_first_load_app)
|
17
20
|
$LOAD_PATH.unshift(root + '/app')
|
18
21
|
load_app
|
19
|
-
run_callbacks(:
|
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
|
-
|
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
|
-
|
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
|
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.
|
93
|
-
|
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.
|
99
|
-
init_logger(
|
112
|
+
def self.log_to_stdout
|
113
|
+
return init_logger($stdout)
|
114
|
+
end
|
100
115
|
|
101
|
-
|
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
|
128
|
+
return @logger
|
113
129
|
end
|
114
130
|
|
115
131
|
def self.run_callbacks(type)
|
data/lib/totem/version.rb
CHANGED
data/templates/app/loader.rb.erb
CHANGED
@@ -1,2 +1,6 @@
|
|
1
|
-
# Manually
|
2
|
-
#
|
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.
|
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:
|
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.
|
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.
|