teamster 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/teamster +6 -6
- data/content/views/index.erb +1 -1
- data/content/views/navbar.erb +3 -3
- data/lib/teamster-cli.rb +36 -36
- data/lib/teamster.rb +13 -13
- data/lib/teamster/{base_module.rb → base_adapter.rb} +7 -7
- data/lib/teamster/core_helper.rb +3 -3
- data/lib/teamster/general_helper.rb +16 -16
- 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: 4e736afb7a2726e1fb47099a1f973798daf15dea
|
4
|
+
data.tar.gz: 1c0f8d0134cfacb9277385158b1b4fe10d678e40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fc3f93e01b8ec2ed889a6f7c685e8dad3e77f9815618885b818a3ab93208ba01fc5c628500aef548027099e31a2418713a65a30504c36c423d4fc8d0145fe45
|
7
|
+
data.tar.gz: 658ce956cf16dcfcd1d9379b9f5185ae83d9a265468860984812abf5bf9288da8da07ed38f4262f2295e4bcfab6e012cab349a8b867e739bbdef4d1f19f21dd5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/bin/teamster
CHANGED
@@ -71,10 +71,10 @@ class TeamsterApp
|
|
71
71
|
FileUtils.cp_r "#{content}/views", current_working_folder
|
72
72
|
FileUtils.cp_r "#{content}/public", current_working_folder
|
73
73
|
create_file "config.ru", "config_ru"
|
74
|
-
FileUtils.mkdir_p "lib/teamster-
|
75
|
-
create_file "lib/teamster-
|
74
|
+
FileUtils.mkdir_p "lib/teamster-adapters"
|
75
|
+
create_file "lib/teamster-adapters.rb", "teamster_adapters"
|
76
76
|
puts "Teamster initialized!"
|
77
|
-
puts "- Run \"teamster create <NAME>\" to create a placeholder
|
77
|
+
puts "- Run \"teamster create <NAME>\" to create a placeholder adapter."
|
78
78
|
puts "- Run \"teamster start\" to start teamster!"
|
79
79
|
end
|
80
80
|
|
@@ -116,17 +116,17 @@ class TeamsterApp
|
|
116
116
|
|
117
117
|
def create(*args)
|
118
118
|
name = args[0]
|
119
|
-
|
119
|
+
create_adapter_for name.downcase
|
120
120
|
end
|
121
121
|
|
122
122
|
def import(*args)
|
123
123
|
name = args[0]
|
124
|
-
|
124
|
+
import_adapter_for name.downcase
|
125
125
|
end
|
126
126
|
|
127
127
|
def export(*args)
|
128
128
|
name = args[0]
|
129
|
-
|
129
|
+
export_adapter_for name.downcase
|
130
130
|
end
|
131
131
|
|
132
132
|
# --{ HELPERS }-- #
|
data/content/views/index.erb
CHANGED
@@ -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
|
-
<%
|
4
|
+
<% all_adapters(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">
|
data/content/views/navbar.erb
CHANGED
@@ -12,14 +12,14 @@
|
|
12
12
|
<div>
|
13
13
|
<ul class="nav navbar-nav">
|
14
14
|
<li class="dropdown">
|
15
|
-
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
15
|
+
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Adapters <b class="caret"></b></a>
|
16
16
|
<ul class="dropdown-menu">
|
17
17
|
<li role="presentation" class="dropdown-header">Available</li>
|
18
|
-
<%
|
18
|
+
<% available_adapters.each do |link, name| %>
|
19
19
|
<li><a href=<%= link %>><%= name %></a></li>
|
20
20
|
<% end %>
|
21
21
|
<li role="presentation" class="dropdown-header">Under Development</li>
|
22
|
-
<%
|
22
|
+
<% developing_adapters.each do |link, name| %>
|
23
23
|
<li><a href=<%= link %>><%= name %></a></li>
|
24
24
|
<% end %>
|
25
25
|
</ul>
|
data/lib/teamster-cli.rb
CHANGED
@@ -43,46 +43,46 @@ module Teamster
|
|
43
43
|
STDIN.gets.strip
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
47
|
-
puts "Creating placeholders for
|
48
|
-
FileUtils.mkdir_p "lib/teamster-
|
49
|
-
create_file "lib/teamster-
|
50
|
-
create_file "lib/teamster-
|
51
|
-
create_file "lib/teamster-
|
52
|
-
create_file "lib/teamster-
|
53
|
-
puts "\nBasic
|
54
|
-
puts "Controller : \"lib/teamster-
|
55
|
-
puts "Helper : \"lib/teamster-
|
56
|
-
puts "View : \"lib/teamster-
|
57
|
-
puts "Summary View : \"lib/teamster-
|
58
|
-
end
|
59
|
-
|
60
|
-
def
|
61
|
-
puts "Importing
|
46
|
+
def create_adapter_for(name)
|
47
|
+
puts "Creating placeholders for adapter #{name}...\n"
|
48
|
+
FileUtils.mkdir_p "lib/teamster-adapters/#{name}/views"
|
49
|
+
create_file "lib/teamster-adapters/#{name}.rb", "adapter_placeholder_for", name
|
50
|
+
create_file "lib/teamster-adapters/#{name}/#{name}_helper.rb", "adapter_helper_placeholder_for", name
|
51
|
+
create_file "lib/teamster-adapters/#{name}/views/#{name}.erb", "view_placeholder_for", name
|
52
|
+
create_file "lib/teamster-adapters/#{name}/views/#{name}_summary.erb", "view_summary_placeholder_for", name
|
53
|
+
puts "\nBasic adapter creation done!"
|
54
|
+
puts "Controller : \"lib/teamster-adapters/#{name}.rb\""
|
55
|
+
puts "Helper : \"lib/teamster-adapters/#{name}/#{name}_helper.rb\""
|
56
|
+
puts "View : \"lib/teamster-adapters/#{name}/views/#{name}.erb\""
|
57
|
+
puts "Summary View : \"lib/teamster-adapters/#{name}/views/#{name}_summary.erb\""
|
58
|
+
end
|
59
|
+
|
60
|
+
def import_adapter_for(name)
|
61
|
+
puts "Importing adapter: #{name}"
|
62
62
|
zip_file = "#{name}.zip"
|
63
63
|
if File.exists?(zip_file)
|
64
64
|
if `which unzip`.length != 0
|
65
65
|
`unzip #{zip_file}`
|
66
66
|
puts "\nSuccessfully imported #{name}. Please restart teamster to use."
|
67
67
|
else
|
68
|
-
puts "\nUnable to import
|
68
|
+
puts "\nUnable to import adapter. Export depends on cli tool \"unzip\"."
|
69
69
|
end
|
70
70
|
else
|
71
71
|
puts "Unable to find file: #{zip_file}"
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
def
|
76
|
-
puts "Exporting
|
75
|
+
def export_adapter_for(name)
|
76
|
+
puts "Exporting adapter: #{name}"
|
77
77
|
zip_file = "#{name}.zip"
|
78
78
|
puts "The following files will be zipped:"
|
79
|
-
puts "- lib/teamster-
|
80
|
-
puts '- Everything in folder lib/teamster-
|
79
|
+
puts "- lib/teamster-adapters/#{name}.rb"
|
80
|
+
puts '- Everything in folder lib/teamster-adapters/#{name}/'
|
81
81
|
if `which zip`.length != 0
|
82
|
-
`zip -r #{zip_file} lib/teamster-
|
82
|
+
`zip -r #{zip_file} lib/teamster-adapters/#{name}.rb lib/teamster-adapters/#{name}/`
|
83
83
|
puts "\nExported to #{zip_file}!"
|
84
84
|
else
|
85
|
-
puts "\nUnable to export
|
85
|
+
puts "\nUnable to export adapter. Export depends on cli tool \"zip\"."
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -132,9 +132,9 @@ Commands:
|
|
132
132
|
Options (standalone):
|
133
133
|
--help Display this detailed help.
|
134
134
|
--version Version of the teamster used.
|
135
|
-
--create-
|
136
|
-
--import-
|
137
|
-
--export-
|
135
|
+
--create-adapter NAME Creates a stub of a adapter
|
136
|
+
--import-adapter FILE << PENDING IMPLEMENTATION >>
|
137
|
+
--export-adapter FILE << PENDING IMPLEMENTATION >>
|
138
138
|
|
139
139
|
|
140
140
|
Options used with \"start\":
|
@@ -164,29 +164,29 @@ run Teamster::Core::App
|
|
164
164
|
CODE
|
165
165
|
end
|
166
166
|
|
167
|
-
def
|
167
|
+
def teamster_adapters
|
168
168
|
<<-CODE
|
169
|
-
Dir.glob(File.dirname(__FILE__) + '/teamster-
|
169
|
+
Dir.glob(File.dirname(__FILE__) + '/teamster-adapters/*.rb').each do |mdl|
|
170
170
|
require mdl
|
171
171
|
end
|
172
172
|
CODE
|
173
173
|
end
|
174
174
|
|
175
|
-
def
|
175
|
+
def adapter_placeholder_for(name)
|
176
176
|
<<-CODE
|
177
177
|
require_relative \"#{name}/#{name}_helper\"
|
178
178
|
|
179
179
|
\# NOTE: If the namespace is changed, please take care of the
|
180
|
-
\# namespace of the sub-class and helper
|
180
|
+
\# namespace of the sub-class and helper adapters.
|
181
181
|
|
182
182
|
module Teamster
|
183
|
-
module
|
183
|
+
module Adapters
|
184
184
|
class #{name.capitalize} < Sinatra::Base
|
185
|
-
\# Class methods that contain Teamster-
|
186
|
-
include
|
185
|
+
\# Class methods that contain Teamster-Adapter specific helpers.
|
186
|
+
include BaseAdapter
|
187
187
|
|
188
188
|
\# Stuff that needs to be done before registration with core.
|
189
|
-
has_helpers #{name.capitalize}Helper \# Add
|
189
|
+
has_helpers #{name.capitalize}Helper \# Add adapters here (comma separated) if there are helper adapters.
|
190
190
|
views_at \"\#\{File.dirname(__FILE__)\}/#{name}/views\"
|
191
191
|
under_development \# Remove this line when development is finished.
|
192
192
|
|
@@ -202,10 +202,10 @@ end
|
|
202
202
|
CODE
|
203
203
|
end
|
204
204
|
|
205
|
-
def
|
205
|
+
def adapter_helper_placeholder_for(name)
|
206
206
|
<<-CODE
|
207
207
|
module Teamster
|
208
|
-
module
|
208
|
+
module Adapters
|
209
209
|
module #{name.capitalize}Helper
|
210
210
|
def #{name}_summary?
|
211
211
|
true
|
data/lib/teamster.rb
CHANGED
@@ -9,7 +9,7 @@ require_relative 'teamster/login'
|
|
9
9
|
module Teamster
|
10
10
|
module Core
|
11
11
|
class App < Sinatra::Base
|
12
|
-
@@
|
12
|
+
@@adapters = []
|
13
13
|
@@views = []
|
14
14
|
@@title = 'TEAMSTER'
|
15
15
|
@@root = Dir.pwd
|
@@ -38,8 +38,8 @@ module Teamster
|
|
38
38
|
erb :index
|
39
39
|
end
|
40
40
|
|
41
|
-
def self.
|
42
|
-
@@
|
41
|
+
def self.adapters
|
42
|
+
@@adapters
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.views
|
@@ -54,23 +54,23 @@ module Teamster
|
|
54
54
|
@@root
|
55
55
|
end
|
56
56
|
|
57
|
-
def self.
|
58
|
-
if @@
|
59
|
-
puts "
|
57
|
+
def self.use_adapter(teamster_adapter)
|
58
|
+
if @@adapters.include? teamster_adapter
|
59
|
+
puts "Adapter #{teamster_adapter} already registered!"
|
60
60
|
else
|
61
|
-
@@
|
62
|
-
@@views <<
|
61
|
+
@@adapters << teamster_adapter
|
62
|
+
@@views << teamster_adapter.views
|
63
63
|
end
|
64
|
-
|
65
|
-
if
|
66
|
-
|
64
|
+
teamster_adapter.helpers GeneralHelper
|
65
|
+
if teamster_adapter.has_helper?
|
66
|
+
teamster_adapter.helper_adapter.flatten.each do |mod|
|
67
67
|
helpers mod
|
68
68
|
end
|
69
69
|
end
|
70
|
-
use
|
70
|
+
use teamster_adapter
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
require_relative 'teamster/
|
76
|
+
require_relative 'teamster/base_adapter'
|
@@ -1,20 +1,20 @@
|
|
1
1
|
module Teamster
|
2
|
-
module
|
3
|
-
module
|
2
|
+
module Adapters
|
3
|
+
module BaseAdapter
|
4
4
|
def self.included(base)
|
5
5
|
base.extend ClassMethods
|
6
6
|
end
|
7
7
|
|
8
8
|
module ClassMethods
|
9
9
|
def register(klass)
|
10
|
-
Teamster::Core::App.
|
10
|
+
Teamster::Core::App.use_adapter klass
|
11
11
|
end
|
12
12
|
|
13
|
-
def has_helpers(*
|
14
|
-
if
|
13
|
+
def has_helpers(*adapters)
|
14
|
+
if adapters.size > 0
|
15
15
|
instance_eval "def has_helper?; true end"
|
16
|
-
instance_eval "def
|
17
|
-
|
16
|
+
instance_eval "def helper_adapter; #{adapters} end"
|
17
|
+
adapters.flatten.each {|adapter| helpers adapter }
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
data/lib/teamster/core_helper.rb
CHANGED
@@ -2,7 +2,7 @@ module Teamster
|
|
2
2
|
module Core
|
3
3
|
module CoreHelper
|
4
4
|
def summary_div_class_for(index)
|
5
|
-
size =
|
5
|
+
size = all_adapters.size
|
6
6
|
if size == 1
|
7
7
|
"col-lg-12"
|
8
8
|
elsif size%2 == 0
|
@@ -13,8 +13,8 @@ module Teamster
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def summary_of(
|
17
|
-
name =
|
16
|
+
def summary_of(adapter_name)
|
17
|
+
name = adapter_name.downcase
|
18
18
|
if send(:"#{name}_summary?")
|
19
19
|
send(:"#{name}_summary")
|
20
20
|
else
|
@@ -56,33 +56,33 @@ module Teamster
|
|
56
56
|
erb :footer
|
57
57
|
end
|
58
58
|
|
59
|
-
def
|
60
|
-
|
61
|
-
App.
|
62
|
-
|
63
|
-
arr << ['/' +
|
59
|
+
def available_adapters(shuffle = false)
|
60
|
+
available_adapters = [].tap do |arr|
|
61
|
+
App.adapters.each do |mod|
|
62
|
+
adapter_name = mod.to_s.split("::").last
|
63
|
+
arr << ['/' + adapter_name.downcase, adapter_name] unless mod.under_development?
|
64
64
|
end
|
65
65
|
end
|
66
|
-
shuffle ?
|
66
|
+
shuffle ? available_adapters.shuffle : available_adapters
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
69
|
+
def developing_adapters
|
70
70
|
[].tap do |arr|
|
71
|
-
App.
|
72
|
-
|
73
|
-
arr << ['/' +
|
71
|
+
App.adapters.each do |mod|
|
72
|
+
adapter_name = mod.to_s.split("::").last
|
73
|
+
arr << ['/' + adapter_name.downcase, adapter_name] if mod.under_development?
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
def
|
79
|
-
|
80
|
-
App.
|
81
|
-
|
82
|
-
arr << ['/' +
|
78
|
+
def all_adapters(shuffle = false)
|
79
|
+
all_adapters = [].tap do |arr|
|
80
|
+
App.adapters.each do |mod|
|
81
|
+
adapter_name = mod.to_s.split("::").last
|
82
|
+
arr << ['/' + adapter_name.downcase, adapter_name]
|
83
83
|
end
|
84
84
|
end
|
85
|
-
shuffle ?
|
85
|
+
shuffle ? all_adapters.shuffle : all_adapters
|
86
86
|
end
|
87
87
|
|
88
88
|
def find_template(views, *args, &block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teamster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nur Muhammad Bin Sirat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puma
|
@@ -85,7 +85,7 @@ files:
|
|
85
85
|
- content/views/no_summary.erb
|
86
86
|
- lib/teamster-cli.rb
|
87
87
|
- lib/teamster.rb
|
88
|
-
- lib/teamster/
|
88
|
+
- lib/teamster/base_adapter.rb
|
89
89
|
- lib/teamster/core_helper.rb
|
90
90
|
- lib/teamster/general_helper.rb
|
91
91
|
- lib/teamster/login.rb
|