trinidad_sandbox_extension 0.4.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. data/Gemfile +4 -0
  2. data/Gemfile.lock +56 -0
  3. data/History.txt +6 -0
  4. data/README +27 -0
  5. data/git-hooks/post-commit +7 -0
  6. data/lib/trinidad_sandbox_extension.rb +24 -3
  7. data/lib/trinidad_sandbox_extension/app/helpers/{sandbox.rb → auth.rb} +20 -19
  8. data/lib/trinidad_sandbox_extension/app/helpers/context.rb +72 -0
  9. data/lib/trinidad_sandbox_extension/app/helpers/deploy.rb +106 -0
  10. data/lib/trinidad_sandbox_extension/app/helpers/view.rb +39 -0
  11. data/lib/trinidad_sandbox_extension/app/model/application_context.rb +48 -4
  12. data/lib/trinidad_sandbox_extension/app/public/css/sandbox.css +187 -0
  13. data/lib/trinidad_sandbox_extension/app/sandbox.rb +56 -39
  14. data/lib/trinidad_sandbox_extension/app/views/actions.html.haml +2 -2
  15. data/lib/trinidad_sandbox_extension/app/views/applications.html.haml +17 -0
  16. data/lib/trinidad_sandbox_extension/app/views/applications.xml.haml +13 -0
  17. data/lib/trinidad_sandbox_extension/app/views/deploy.html.haml +16 -0
  18. data/lib/trinidad_sandbox_extension/app/views/layout.html.haml +10 -6
  19. data/lib/trinidad_sandbox_extension/app/views/navigation.html.haml +10 -0
  20. data/spec/trinidad_sandbox_extension_spec.rb +12 -2
  21. data/trinidad-libs/trinidad-sandbox-extension.jar +0 -0
  22. data/trinidad_sandbox_extension.gemspec +16 -9
  23. metadata +52 -41
  24. data/lib/trinidad_sandbox_extension/app/public/css/main.css +0 -137
  25. data/lib/trinidad_sandbox_extension/app/views/app.html.haml +0 -8
  26. data/lib/trinidad_sandbox_extension/app/views/app.xml.haml +0 -11
  27. data/lib/trinidad_sandbox_extension/app/views/index.html.haml +0 -6
  28. data/lib/trinidad_sandbox_extension/app/views/index.xml.haml +0 -3
@@ -0,0 +1,13 @@
1
+ %applications
2
+ - @applications.each do |app|
3
+ %application
4
+ %name= app.name
5
+ %path= app.path
6
+ %available= app.available
7
+ - unless readonly?
8
+ - app.actions.each do |action|
9
+ %link(rel = "#{action[:rel]}" href = "#{action[:href]}.xml")
10
+ - if app.parameters
11
+ %context-parameters
12
+ - app.parameters.each do |param_name|
13
+ %parameter(name = "#{param_name}" value = "#{app.find_parameter(param_name)}")
@@ -0,0 +1,16 @@
1
+ %div(id="deploy" class="container")
2
+ %form(action="#{sandbox_context.path}/deploy" method="post")
3
+ %input(type="hidden" name="deploy_token" value="#{render_deploy_token}")
4
+ %div
5
+ %label(for = "repo") Repository url
6
+ %input(type="text" name="repo" id="repo" size="38")
7
+ %div
8
+ %label(for = "branch") Branch
9
+ %input(type="text" name="branch" id="branch" size="38")
10
+ %div
11
+ %label(for = "path") Application path
12
+ %input(type="text" name="path" id="path" size="38")
13
+ %div
14
+ %button(type="submit" data-disable-with="Please wait...") Deploy
15
+ #git-hook
16
+ %p Use <span>http://#{render_host_name}/sandbox/deploy?deploy_token=#{render_deploy_token}</span> as a Post-Receive URL on Github.
@@ -1,12 +1,16 @@
1
1
  %html
2
2
  %head
3
3
  %title Trinidad's sandbox
4
- %link(rel="stylesheet" href="#{sandbox_context.path}/css/main.css" type="text/css")
4
+ %link(rel="stylesheet" href="#{sandbox_context.path}/css/sandbox.css" type="text/css")
5
5
  %body
6
+ #ribbon
7
+ %a(href="http://github.com/calavera/trinidad_sandbox_extension")
8
+ %img(style="position: absolute; top: 0; right: 0; border: 0;" src="https://assets2.github.com/img/71eeaab9d563c2b3c590319b398dd35683265e85?repo=&url=http%3A%2F%2Fs3.amazonaws.com%2Fgithub%2Fribbons%2Fforkme_right_gray_6d6d6d.png&path=" alt="Fork me on GitHub")
6
9
  .site
7
- #title
8
- %h1 Trinidad's sandbox
9
- #content
10
+ %nav
10
11
  %div
11
- = styled_flash
12
- = yield
12
+ %h1 Trinidad
13
+ = haml :navigation, :layout => false
14
+ = styled_flash
15
+ %div
16
+ = yield
@@ -0,0 +1,10 @@
1
+ #nav
2
+ - unless readonly?
3
+ - if @page_id == 'deploy'
4
+ %a(class="nav" href="apps") Applications
5
+ %span(class="nav") Deploy
6
+ - else
7
+ %span(class="nav") Applications
8
+ %a(class="nav" href="deploy") Deploy
9
+ - else
10
+ %span(class="nav") Applications
@@ -51,7 +51,17 @@ describe Trinidad::Extensions::SandboxServerExtension do
51
51
 
52
52
  app_ctx = ext.create_application_context(@tomcat, opts)
53
53
 
54
- app_ctx.servlet_context.getAttribute('sandbox_username').should == 'foo'
55
- app_ctx.servlet_context.getAttribute('sandbox_password').should == 'bar'
54
+ app_ctx.servlet_context.get_attribute('sandbox_username').should == 'foo'
55
+ app_ctx.servlet_context.get_attribute('sandbox_password').should == 'bar'
56
+ end
57
+
58
+ it 'stores the deploy token to use it for git deployment' do
59
+ opts = subject.prepare_options
60
+ opts[:deploy_token] = 'foobar'
61
+
62
+ ext = Trinidad::Extensions::SandboxServerExtension.new(opts)
63
+
64
+ app_ctx = ext.create_application_context(@tomcat, opts)
65
+ app_ctx.servlet_context.get_attribute('deploy_token').should == 'foobar'
56
66
  end
57
67
  end
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'trinidad_sandbox_extension'
16
- s.version = '0.4.2'
17
- s.date = '2010-12-21'
16
+ s.version = '1.0.0'
17
+ s.date = '2011-03-17'
18
18
  s.rubyforge_project = 'trinidad_sandbox_extension'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -41,7 +41,8 @@ Gem::Specification.new do |s|
41
41
  ## List your runtime dependencies here. Runtime dependencies are those
42
42
  ## that are needed for an end user to actually USE your code.
43
43
  s.add_dependency('trinidad', '>=1.0.1')
44
- ['sinatra', 'sinatra-authorization', 'sinatra-respond_to', 'sinatra-flash', 'haml'].each do |dep|
44
+ ['sinatra', 'sinatra-authorization', 'sinatra-respond_to',
45
+ 'sinatra-flash', 'haml', 'grit', 'json'].each do |dep|
45
46
  s.add_dependency(dep)
46
47
  end
47
48
 
@@ -55,21 +56,27 @@ Gem::Specification.new do |s|
55
56
  ## THE MANIFEST COMMENTS, they are used as delimiters by the task.
56
57
  # = MANIFEST =
57
58
  s.files = %w[
59
+ Gemfile
60
+ Gemfile.lock
58
61
  History.txt
59
62
  LICENSE
60
63
  README
61
64
  Rakefile
65
+ git-hooks/post-commit
62
66
  lib/trinidad_sandbox_extension.rb
63
- lib/trinidad_sandbox_extension/app/helpers/sandbox.rb
67
+ lib/trinidad_sandbox_extension/app/helpers/auth.rb
68
+ lib/trinidad_sandbox_extension/app/helpers/context.rb
69
+ lib/trinidad_sandbox_extension/app/helpers/deploy.rb
70
+ lib/trinidad_sandbox_extension/app/helpers/view.rb
64
71
  lib/trinidad_sandbox_extension/app/model/application_context.rb
65
- lib/trinidad_sandbox_extension/app/public/css/main.css
72
+ lib/trinidad_sandbox_extension/app/public/css/sandbox.css
66
73
  lib/trinidad_sandbox_extension/app/sandbox.rb
67
74
  lib/trinidad_sandbox_extension/app/views/actions.html.haml
68
- lib/trinidad_sandbox_extension/app/views/app.html.haml
69
- lib/trinidad_sandbox_extension/app/views/app.xml.haml
70
- lib/trinidad_sandbox_extension/app/views/index.html.haml
71
- lib/trinidad_sandbox_extension/app/views/index.xml.haml
75
+ lib/trinidad_sandbox_extension/app/views/applications.html.haml
76
+ lib/trinidad_sandbox_extension/app/views/applications.xml.haml
77
+ lib/trinidad_sandbox_extension/app/views/deploy.html.haml
72
78
  lib/trinidad_sandbox_extension/app/views/layout.html.haml
79
+ lib/trinidad_sandbox_extension/app/views/navigation.html.haml
73
80
  lib/trinidad_sandbox_extension/config.ru
74
81
  spec/spec.opts
75
82
  spec/spec_helper.rb
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trinidad_sandbox_extension
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 4
8
- - 2
9
- version: 0.4.2
4
+ prerelease:
5
+ version: 1.0.0
10
6
  platform: ruby
11
7
  authors:
12
8
  - David Calavera
@@ -14,20 +10,17 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-12-21 00:00:00 +01:00
13
+ date: 2011-03-17 00:00:00 -07:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
21
17
  name: trinidad
22
18
  prerelease: false
23
19
  requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
24
21
  requirements:
25
22
  - - ">="
26
23
  - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 0
30
- - 1
31
24
  version: 1.0.1
32
25
  type: :runtime
33
26
  version_requirements: *id001
@@ -35,11 +28,10 @@ dependencies:
35
28
  name: sinatra
36
29
  prerelease: false
37
30
  requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
38
32
  requirements:
39
33
  - - ">="
40
34
  - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
35
  version: "0"
44
36
  type: :runtime
45
37
  version_requirements: *id002
@@ -47,11 +39,10 @@ dependencies:
47
39
  name: sinatra-authorization
48
40
  prerelease: false
49
41
  requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
50
43
  requirements:
51
44
  - - ">="
52
45
  - !ruby/object:Gem::Version
53
- segments:
54
- - 0
55
46
  version: "0"
56
47
  type: :runtime
57
48
  version_requirements: *id003
@@ -59,11 +50,10 @@ dependencies:
59
50
  name: sinatra-respond_to
60
51
  prerelease: false
61
52
  requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
62
54
  requirements:
63
55
  - - ">="
64
56
  - !ruby/object:Gem::Version
65
- segments:
66
- - 0
67
57
  version: "0"
68
58
  type: :runtime
69
59
  version_requirements: *id004
@@ -71,11 +61,10 @@ dependencies:
71
61
  name: sinatra-flash
72
62
  prerelease: false
73
63
  requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
74
65
  requirements:
75
66
  - - ">="
76
67
  - !ruby/object:Gem::Version
77
- segments:
78
- - 0
79
68
  version: "0"
80
69
  type: :runtime
81
70
  version_requirements: *id005
@@ -83,39 +72,57 @@ dependencies:
83
72
  name: haml
84
73
  prerelease: false
85
74
  requirement: &id006 !ruby/object:Gem::Requirement
75
+ none: false
86
76
  requirements:
87
77
  - - ">="
88
78
  - !ruby/object:Gem::Version
89
- segments:
90
- - 0
91
79
  version: "0"
92
80
  type: :runtime
93
81
  version_requirements: *id006
94
82
  - !ruby/object:Gem::Dependency
95
- name: rspec
83
+ name: grit
96
84
  prerelease: false
97
85
  requirement: &id007 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ type: :runtime
92
+ version_requirements: *id007
93
+ - !ruby/object:Gem::Dependency
94
+ name: json
95
+ prerelease: false
96
+ requirement: &id008 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: "0"
102
+ type: :runtime
103
+ version_requirements: *id008
104
+ - !ruby/object:Gem::Dependency
105
+ name: rspec
106
+ prerelease: false
107
+ requirement: &id009 !ruby/object:Gem::Requirement
108
+ none: false
98
109
  requirements:
99
110
  - - ">="
100
111
  - !ruby/object:Gem::Version
101
- segments:
102
- - 2
103
- - 2
104
112
  version: "2.2"
105
113
  type: :development
106
- version_requirements: *id007
114
+ version_requirements: *id009
107
115
  - !ruby/object:Gem::Dependency
108
116
  name: mocha
109
117
  prerelease: false
110
- requirement: &id008 !ruby/object:Gem::Requirement
118
+ requirement: &id010 !ruby/object:Gem::Requirement
119
+ none: false
111
120
  requirements:
112
121
  - - ">="
113
122
  - !ruby/object:Gem::Version
114
- segments:
115
- - 0
116
123
  version: "0"
117
124
  type: :development
118
- version_requirements: *id008
125
+ version_requirements: *id010
119
126
  description: Sandox console for Trinidad. It allows to manage the applications deployed on Trinidad.
120
127
  email: calavera@apache.org
121
128
  executables: []
@@ -126,21 +133,27 @@ extra_rdoc_files:
126
133
  - README
127
134
  - LICENSE
128
135
  files:
136
+ - Gemfile
137
+ - Gemfile.lock
129
138
  - History.txt
130
139
  - LICENSE
131
140
  - README
132
141
  - Rakefile
142
+ - git-hooks/post-commit
133
143
  - lib/trinidad_sandbox_extension.rb
134
- - lib/trinidad_sandbox_extension/app/helpers/sandbox.rb
144
+ - lib/trinidad_sandbox_extension/app/helpers/auth.rb
145
+ - lib/trinidad_sandbox_extension/app/helpers/context.rb
146
+ - lib/trinidad_sandbox_extension/app/helpers/deploy.rb
147
+ - lib/trinidad_sandbox_extension/app/helpers/view.rb
135
148
  - lib/trinidad_sandbox_extension/app/model/application_context.rb
136
- - lib/trinidad_sandbox_extension/app/public/css/main.css
149
+ - lib/trinidad_sandbox_extension/app/public/css/sandbox.css
137
150
  - lib/trinidad_sandbox_extension/app/sandbox.rb
138
151
  - lib/trinidad_sandbox_extension/app/views/actions.html.haml
139
- - lib/trinidad_sandbox_extension/app/views/app.html.haml
140
- - lib/trinidad_sandbox_extension/app/views/app.xml.haml
141
- - lib/trinidad_sandbox_extension/app/views/index.html.haml
142
- - lib/trinidad_sandbox_extension/app/views/index.xml.haml
152
+ - lib/trinidad_sandbox_extension/app/views/applications.html.haml
153
+ - lib/trinidad_sandbox_extension/app/views/applications.xml.haml
154
+ - lib/trinidad_sandbox_extension/app/views/deploy.html.haml
143
155
  - lib/trinidad_sandbox_extension/app/views/layout.html.haml
156
+ - lib/trinidad_sandbox_extension/app/views/navigation.html.haml
144
157
  - lib/trinidad_sandbox_extension/config.ru
145
158
  - spec/spec.opts
146
159
  - spec/spec_helper.rb
@@ -157,23 +170,21 @@ rdoc_options:
157
170
  require_paths:
158
171
  - lib
159
172
  required_ruby_version: !ruby/object:Gem::Requirement
173
+ none: false
160
174
  requirements:
161
175
  - - ">="
162
176
  - !ruby/object:Gem::Version
163
- segments:
164
- - 0
165
177
  version: "0"
166
178
  required_rubygems_version: !ruby/object:Gem::Requirement
179
+ none: false
167
180
  requirements:
168
181
  - - ">="
169
182
  - !ruby/object:Gem::Version
170
- segments:
171
- - 0
172
183
  version: "0"
173
184
  requirements: []
174
185
 
175
186
  rubyforge_project: trinidad_sandbox_extension
176
- rubygems_version: 1.3.6
187
+ rubygems_version: 1.5.1
177
188
  signing_key:
178
189
  specification_version: 2
179
190
  summary: Sandbox console for Trinidad
@@ -1,137 +0,0 @@
1
- /* Reset */
2
-
3
- ul {
4
- padding: 0px;
5
- }
6
-
7
- li {
8
- list-style: none;
9
- margin: 0px;
10
- padding: 0px;
11
- display: list-item;
12
- }
13
-
14
- /* End: Reset */
15
-
16
-
17
- body {
18
- font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
19
- font-size:10.5pt;
20
- color:#222222;
21
- background: #333333;
22
- margin: 0;
23
- }
24
-
25
- a {
26
- color: #617fc3;
27
- font-weight: bold;
28
- text-decoration: none;
29
- }
30
-
31
- a:hover {
32
- color: #395490;
33
- }
34
-
35
- h1 {
36
- font-family: Helvetica, Arial, Sans-Serif;
37
- letter-spacing: -0.03em;
38
- color:#CCCCCC;
39
- font-size:3em;
40
- margin-top:2em;
41
- margin-bottom:0;
42
- }
43
-
44
- h2 {
45
- color:#CCCCCC;
46
- font-size: 3em;
47
- }
48
-
49
- #title {
50
- font-family: Helvetica, Arial, Sans-Serif;
51
- letter-spacing:-0.07em;
52
- text-align: left;
53
- font-size:1.7em;
54
- margin-left: .7em;
55
- margin-bottom: 1.5em;
56
- color:#666666;
57
- }
58
-
59
- #title h1 {
60
- font-size:3em;
61
- line-height:0.5em;
62
- margin: 0;
63
- margin-bottom: -0.05em;
64
- }
65
-
66
- #content {
67
- line-height: 1.5em;
68
- margin-bottom: 1em;
69
- margin-right:-0.5em;
70
- }
71
-
72
- .site {
73
- width:45em;
74
- margin: 0 auto;
75
- padding: 5em 5em;
76
- background: #F5F5F5;
77
- }
78
-
79
- #parameters {
80
- background: black;
81
- color: white;
82
- font-size: 0.9em;
83
- max-height: 50em;
84
- overflow: auto;
85
- margin: 0.5em;
86
- padding: 0.5em;
87
- line-height: 2em;
88
- }
89
-
90
- .ack {
91
- padding-top: 1em;
92
- float: right;
93
- font-size: 9pt;
94
- }
95
-
96
- .note {
97
- background-color: #ffffcc;
98
- border: solid 1px #ffff76;
99
-
100
- padding: 1em;
101
- }
102
-
103
- #content #applications {
104
- margin: 1em 0px 2em;
105
- border-top: 1px solid silver;
106
- }
107
-
108
- #content #applications li {
109
- border-bottom: 1px solid silver;
110
- position: relative;
111
- }
112
-
113
- .app_name {
114
- display: block;
115
- font-size: 2em;
116
- font-weight: bold;
117
- line-height: 1.2;
118
- padding: 0.25em;
119
- }
120
-
121
- .actions {
122
- font-size: 0.8em;
123
- position: absolute;
124
- right: 0.6em;
125
- text-align: right;
126
- top: 1.5em;
127
- }
128
-
129
- .actions form {
130
- display: inline;
131
- }
132
-
133
- .application {
134
- border-top: 1px solid silver;
135
- border-bottom: 1px solid silver;
136
- position: relative;
137
- }