teamster 0.2.2 → 0.3.0

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: 58ff0d4b5486fe8ef3501955b44d7d194e959bda
4
- data.tar.gz: 64b79fea2e60fa4e8be84aa140a37f2dd7597249
3
+ metadata.gz: 408dd6c1de8da8854d489bddfd6a08ca8543a70d
4
+ data.tar.gz: 5eae8abb7fe45335457bb8d81d18411850a61b05
5
5
  SHA512:
6
- metadata.gz: f1126346b2484ac18fa2d1b0227127f95f8da2f09c52e20ab0383a0736056dbc55c7be8ef233b3d42cadec097fb54dc91a0495fd78aa2a954e8a7f353e1171d1
7
- data.tar.gz: c3436c9579eeeb9334430bdf8790f9ed66f9a04c5a78a3650580f8389c98c002270feb9074984b367814d89298f61af4680838ab8ef33398637e99b2320e978c
6
+ metadata.gz: d499d7be8553ed8bf83e0dd16f3d7690238ecef12ae0c72f772b8594072b3ae5b4a07c5f410e3f245f467d43b7f921cb4307b82ee9811f37a76cbfc8ff712460
7
+ data.tar.gz: 1dd7a0f717d19dfc0222e88faa092106ea36d7441ee7905638e513823b7cd15d850f1611d4dac142e9251c49371fcf7de42a36caff573dbeb3b62d92aef2f717
data/README.md ADDED
@@ -0,0 +1,76 @@
1
+ teamster
2
+ ========
3
+
4
+ A simple bare-bones extensible web portal for individuals or small teams
5
+
6
+
7
+ Dependencies
8
+ ============
9
+
10
+ To run teamster, there is a few dependencies:
11
+
12
+ * Only supported in OS X and linux. Not test on Windows. YMMV.
13
+
14
+ Install
15
+ =======
16
+
17
+ Teamster has been packaged into a gem. To install, simply run `gem install teamster`.
18
+
19
+
20
+ Usage
21
+ =====
22
+
23
+ * Create a new folder where you want your site to live and navigate into it: `mkdir new-site && cd new-site`
24
+ * Initialize teamster and answer some configuration questions: `teamster init`
25
+ * Run teamster: `teamster start`
26
+
27
+ Open a browser and point to http://localhost:9292. A bare teamster page should be shown.
28
+
29
+
30
+ Running In A "Production" Environment
31
+ =====================================
32
+
33
+ I do not recommended this application be exposed to the wide Internet just yet, but it should be secure enough for an individual or small team to use over their private LAN.
34
+
35
+ When the `--prod` flag is passed, teamster will not run using rackup, but will utilize the [Puma](http://puma.io/) app server to serve itself. It will create and bind itself to a UNIX socket file and a Puma state file.
36
+
37
+ Use With Nginx
38
+ --------------
39
+
40
+ Personally, I'm using this in conjunction with the popular [Nginx](http://nginx.org/) web server. To follow these, Nginx must already be installed on your system.
41
+
42
+ * Run teamster in production mode: `teamster start --prod --socket-file /tmp/teamster.sock --state-file /srv/my-site/app.state`
43
+ * In the nginx site configuration file, add the following:
44
+
45
+ > upstream app {
46
+ > server unix:///tmp/teamster.sock;
47
+ > }
48
+ >
49
+ > server {
50
+ > server_name my-site.example.com;
51
+ > }
52
+ >
53
+ > location / {
54
+ > proxy_pass http://app;
55
+ > }
56
+ > }
57
+
58
+ * Restart nginx.
59
+
60
+ Open a browser and point to http://my-site.example.com. A bare teamster page should be shown.
61
+
62
+
63
+ Create Modules
64
+ ==============
65
+
66
+ To create your custom modules:
67
+
68
+ * Navigate to the site folder root: `cd /path/to/root/folder/of/my-site`
69
+ * Run: `teamster --create-module MODULENAME`.
70
+
71
+ This will create the following files in your site folder:
72
+
73
+ * lib/teamster-modules/MODULENAME.rb
74
+ * lib/teamster-modules/MODULENAME/views/MODULENAME.erb
75
+
76
+ In MODULENAME.rb, a class MODULENAME will be created. While it may sub-class from Teamster::Module::Base, it is also a sub-class of Sinatra::Base. When developing it, you can use helper methods and other nifty stuff available from Sinatra. However, do take note of the scoping.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.3.0
data/bin/teamster CHANGED
@@ -135,10 +135,14 @@ class TeamsterApp
135
135
  puts "Creating placeholders for module #{name}...\n"
136
136
  FileUtils.mkdir_p "lib/teamster-modules/#{name}/views"
137
137
  create_file "lib/teamster-modules/#{name}.rb", "module_placeholder_for", name
138
+ create_file "lib/teamster-modules/#{name}/#{name}_helper.rb", "module_helper_placeholder_for", name
138
139
  create_file "lib/teamster-modules/#{name}/views/#{name}.erb", "view_placeholder_for", name
140
+ create_file "lib/teamster-modules/#{name}/views/#{name}_summary.erb", "view_summary_placeholder_for", name
139
141
  puts "\nBasic module creation done!"
140
- puts "Controller : \"lib/teamster-modules/#{name}.rb\""
141
- puts "View : \"lib/teamster-modules/#{name}/views/#{name}.erb\""
142
+ puts "Controller : \"lib/teamster-modules/#{name}.rb\""
143
+ puts "Helper : \"lib/teamster-modules/#{name}/#{name}_helper.rb\""
144
+ puts "View : \"lib/teamster-modules/#{name}/views/#{name}.erb\""
145
+ puts "Summary View : \"lib/teamster-modules/#{name}/views/#{name}_summary.erb\""
142
146
  end
143
147
 
144
148
  def create_file(filename, method, *args)
@@ -229,17 +233,44 @@ end
229
233
 
230
234
  def module_placeholder_for(name)
231
235
  <<-CODE
232
- class #{name.capitalize} < ::Teamster::Modules::Base
233
- \# Stuff that needs to be done before registration with core.
234
- has_helpers nil \# Add array of modules here if there are helper modules.
235
- views_at \"\#\{File.dirname(__FILE__)\}/#{name}/views\"
236
- under_development \# Remove this line when development is finished.
236
+ require_relative \"#{name}/#{name}_helper\"
237
237
 
238
- \# Register this class so it can be used.
239
- register self
238
+ \# NOTE: If the namespace is changed, please take care of the
239
+ \# namespace of the sub-class and helper modules.
240
240
 
241
- get '/#{name}/?' do
242
- erb :#{name}
241
+ module Teamster
242
+ module Modules
243
+ class #{name.capitalize} < Base
244
+ \# Stuff that needs to be done before registration with core.
245
+ has_helpers #{name.capitalize}Helper \# Add modules here (comma separated) if there are helper modules.
246
+ views_at \"\#\{File.dirname(__FILE__)\}/#{name}/views\"
247
+ under_development \# Remove this line when development is finished.
248
+
249
+ \# Register this class so it can be used.
250
+ register self
251
+
252
+ get '/#{name}/?' do
253
+ erb :#{name}
254
+ end
255
+ end
256
+ end
257
+ end
258
+ CODE
259
+ end
260
+
261
+ def module_helper_placeholder_for(name)
262
+ <<-CODE
263
+ module Teamster
264
+ module Modules
265
+ module #{name.capitalize}Helper
266
+ def #{name}_summary?
267
+ true
268
+ end
269
+
270
+ def #{name}_summary
271
+ erb :#{name}_summary
272
+ end
273
+ end
243
274
  end
244
275
  end
245
276
  CODE
@@ -251,6 +282,12 @@ end
251
282
  <p style='text-align: center'>Page under construction. Please check back later!</p>
252
283
  CODE
253
284
  end
285
+
286
+ def view_summary_placeholder_for(name)
287
+ <<-CODE
288
+ <p>Under development right now..</p>
289
+ CODE
290
+ end
254
291
  end
255
292
  end
256
293
 
@@ -1,7 +1,7 @@
1
1
  <h1 class='text-center'>Status At A Glance</h1>
2
2
  <hr class="fancy-line">
3
3
  <div class='row'>
4
- <% available_modules(true).each_with_index do |arr, i| %>
4
+ <% all_modules(true).each_with_index do |arr, i| %>
5
5
  <% link, name = arr %>
6
6
  <div class=<%= summary_div_class_for i%>>
7
7
  <div class="frontpage-panel panel panel-default">
@@ -10,7 +10,7 @@ module Teamster
10
10
  if mods.size > 0
11
11
  instance_eval "def has_helper?; true end"
12
12
  instance_eval "def helper_module; #{mods} end"
13
- mods.each {|mod| helpers mod }
13
+ mods.flatten.each {|mod| helpers mod }
14
14
  end
15
15
  end
16
16
 
@@ -54,6 +54,16 @@ module Teamster
54
54
  end
55
55
  end
56
56
 
57
+ def all_modules(shuffle = false)
58
+ all_modules = [].tap do |arr|
59
+ App.modules.each do |mod|
60
+ module_name = mod.to_s.split("::").last
61
+ arr << ['/' + module_name.downcase, module_name]
62
+ end
63
+ end
64
+ shuffle ? all_modules.shuffle : all_modules
65
+ end
66
+
57
67
  def find_template(views, name, engine, &block)
58
68
  App.views.each {|v| super(v, name, engine, &block)}
59
69
  end
data/lib/teamster.rb CHANGED
@@ -13,8 +13,8 @@ module Teamster
13
13
  @@title = 'TEAMSTER'
14
14
  CORE_CONFIG = 'conf/teamster.conf'
15
15
 
16
- # NOTE: Methods used in configure block needs be declared before
17
- # the configure block.
16
+ # NOTE: Class methods used in configure block needs be declared
17
+ # before the configure block.
18
18
  def self.set_default_options_from(core_opts)
19
19
  @@title = core_opts[:title]
20
20
  end
@@ -40,8 +40,10 @@ module Teamster
40
40
  end
41
41
 
42
42
  def summary_div_class_for(index)
43
- size = available_modules.size
44
- if size%2 == 0
43
+ size = all_modules.size
44
+ if size == 1
45
+ "col-lg-12"
46
+ elsif size%2 == 0
45
47
  "col-lg-6"
46
48
  else
47
49
  last = size - 1
@@ -58,7 +60,6 @@ module Teamster
58
60
  end
59
61
  end
60
62
 
61
- # NOTE: Class methods here are for module processing.
62
63
  def self.modules
63
64
  @@modules
64
65
  end
@@ -80,7 +81,7 @@ module Teamster
80
81
  end
81
82
  teamster_module.helpers GeneralHelper
82
83
  if teamster_module.has_helper?
83
- teamster_module.helper_module.each do |mod|
84
+ teamster_module.helper_module.flatten.each do |mod|
84
85
  helpers mod
85
86
  end
86
87
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nur Muhammad Bin Sirat
@@ -49,6 +49,7 @@ files:
49
49
  - Gemfile
50
50
  - Gemfile.lock
51
51
  - LICENSE.md
52
+ - README.md
52
53
  - Rakefile
53
54
  - VERSION
54
55
  - bin/teamster