chef-server-slice 0.7.10 → 0.7.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/app/controllers/application.rb +5 -1
  2. data/app/controllers/{cookbook_recipes.rb → cookbook_segment.rb} +8 -11
  3. data/app/controllers/cookbooks.rb +4 -23
  4. data/app/views/cookbooks/show.html.haml +16 -1
  5. data/lib/chef-server-slice.rb +12 -8
  6. data/public/facebox/closelabel.gif +0 -0
  7. data/public/facebox/loading.gif +0 -0
  8. data/public/images/treeBuilderImages/Thumbs.db +0 -0
  9. data/public/images/treeBuilderImages/doc.gif +0 -0
  10. data/public/images/treeBuilderImages/docNode.gif +0 -0
  11. data/public/images/treeBuilderImages/docNodeLast.gif +0 -0
  12. data/public/images/treeBuilderImages/docNodeLastFirst.gif +0 -0
  13. data/public/images/treeBuilderImages/folder.gif +0 -0
  14. data/public/images/treeBuilderImages/folderNode.gif +0 -0
  15. data/public/images/treeBuilderImages/folderNodeFirst.gif +0 -0
  16. data/public/images/treeBuilderImages/folderNodeLast.gif +0 -0
  17. data/public/images/treeBuilderImages/folderNodeLastFirst.gif +0 -0
  18. data/public/images/treeBuilderImages/folderNodeOpen.gif +0 -0
  19. data/public/images/treeBuilderImages/folderNodeOpenFirst.gif +0 -0
  20. data/public/images/treeBuilderImages/folderNodeOpenLast.gif +0 -0
  21. data/public/images/treeBuilderImages/folderNodeOpenLastFirst.gif +0 -0
  22. data/public/images/treeBuilderImages/folderOpen.gif +0 -0
  23. data/public/images/treeBuilderImages/vertLine.gif +0 -0
  24. data/public/javascripts/JSONeditor.js +0 -0
  25. data/public/javascripts/jquery-1.3.2.min.js +0 -0
  26. data/public/javascripts/jquery-ui-1.7.1.custom.min.js +0 -0
  27. data/public/stylesheets/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png +0 -0
  28. data/public/stylesheets/images/ui-bg_diagonals-thick_15_444444_40x40.png +0 -0
  29. data/public/stylesheets/images/ui-bg_glass_100_f0f0f0_1x400.png +0 -0
  30. data/public/stylesheets/images/ui-bg_glass_50_99c2ff_1x400.png +0 -0
  31. data/public/stylesheets/images/ui-bg_glass_55_fbf5d0_1x400.png +0 -0
  32. data/public/stylesheets/images/ui-bg_glass_80_e6e6e6_1x400.png +0 -0
  33. data/public/stylesheets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  34. data/public/stylesheets/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png +0 -0
  35. data/public/stylesheets/images/ui-bg_highlight-soft_100_e7eef3_1x100.png +0 -0
  36. data/public/stylesheets/images/ui-icons_222222_256x240.png +0 -0
  37. data/public/stylesheets/images/ui-icons_2694e8_256x240.png +0 -0
  38. data/public/stylesheets/images/ui-icons_2e83ff_256x240.png +0 -0
  39. data/public/stylesheets/images/ui-icons_72a7cf_256x240.png +0 -0
  40. data/public/stylesheets/images/ui-icons_888888_256x240.png +0 -0
  41. data/public/stylesheets/images/ui-icons_cd0a0a_256x240.png +0 -0
  42. data/public/stylesheets/images/ui-icons_ffffff_256x240.png +0 -0
  43. data/public/stylesheets/jquery-ui-1.7.1.custom.css +0 -0
  44. metadata +3 -6
  45. data/app/controllers/cookbook_attributes.rb +0 -59
  46. data/app/controllers/cookbook_definitions.rb +0 -60
  47. data/app/controllers/cookbook_libraries.rb +0 -60
@@ -156,8 +156,12 @@ class ChefServerSlice::Application < Merb::Controller
156
156
  files_list = cookbook.definition_files
157
157
  when :libraries
158
158
  files_list = cookbook.lib_files
159
+ when :providers
160
+ files_list = cookbook.provider_files
161
+ when :resources
162
+ files_list = cookbook.resource_files
159
163
  else
160
- raise ArgumentError, "segment must be one of :attributes, :recipes, :definitions or :libraries"
164
+ raise ArgumentError, "segment must be one of :attributes, :recipes, :definitions, :libraries, :providers, or :resources"
161
165
  end
162
166
  files_list
163
167
  end
@@ -1,7 +1,8 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@opscode.com>)
3
3
  # Author:: Christopher Brown (<cb@opscode.com>)
4
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # Author:: Christopher Walters (<cw@opscode.com>)
5
+ # Copyright:: Copyright (c) 2009 Opscode, Inc.
5
6
  # License:: Apache License, Version 2.0
6
7
  #
7
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,32 +20,28 @@
19
20
 
20
21
  require 'chef' / 'mixin' / 'checksum'
21
22
 
22
- class ChefServerSlice::CookbookRecipes < ChefServerSlice::Application
23
+ class ChefServerSlice::CookbookSegment < ChefServerSlice::Application
23
24
 
24
25
  provides :html, :json
26
+
25
27
  before :login_required
26
28
 
27
29
  include Chef::Mixin::Checksum
28
30
 
29
- def load_cookbook_recipes()
30
- @recipe_files = load_cookbook_segment(params[:cookbook_id], :recipes)
31
- end
32
-
33
31
  def index
34
32
  if params[:id]
35
33
  show
36
34
  else
37
- load_cookbook_recipes()
38
- display @recipe_files
35
+ display load_cookbook_segment(params[:cookbook_id], params[:type])
39
36
  end
40
37
  end
41
38
 
42
39
  def show
43
40
  only_provides :json
44
- load_cookbook_recipes
45
- raise NotFound, "Cannot find a suitable recipe file!" unless @recipe_files.has_key?(params[:id])
41
+ files = load_cookbook_segment(params[:cookbook_id], params[:type])
46
42
 
47
- to_send = @recipe_files[params[:id]][:file]
43
+ raise NotFound, "Cannot find a suitable #{params[:type].to_s.singularize} file!" unless files.has_key?(params[:id])
44
+ to_send = files[params[:id]][:file]
48
45
  current_checksum = checksum(to_send)
49
46
  Chef::Log.debug("old sum: #{params[:checksum]}, new sum: #{current_checksum}")
50
47
  if current_checksum == params[:checksum]
@@ -1,6 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@opscode.com>)
3
3
  # Author:: Christopher Brown (<cb@opscode.com>)
4
+ # Author:: Christopher Walters (<cw@opscode.com>)
4
5
  # Copyright:: Copyright (c) 2008 Opscode, Inc.
5
6
  # License:: Apache License, Version 2.0
6
7
  #
@@ -22,7 +23,7 @@ require 'chef' / 'cookbook_loader'
22
23
  class ChefServerSlice::Cookbooks < ChefServerSlice::Application
23
24
 
24
25
  provides :html, :json
25
- before :login_required
26
+ before :login_required
26
27
 
27
28
  def index
28
29
  @cl = Chef::CookbookLoader.new
@@ -36,28 +37,8 @@ class ChefServerSlice::Cookbooks < ChefServerSlice::Application
36
37
  display @cookbook
37
38
  end
38
39
 
39
- def recipe_files
40
- node = params.has_key?('node') ? params[:node] : nil
41
- @recipe_files = load_all_files(:recipes, node)
42
- display @recipe_files
43
- end
44
-
45
- def attribute_files
46
- node = params.has_key?('node') ? params[:node] : nil
47
- @attribute_files = load_all_files(:attributes, node)
48
- display @attribute_files
49
- end
50
-
51
- def definition_files
52
- node = params.has_key?('node') ? params[:node] : nil
53
- @definition_files = load_all_files(:definitions, node)
54
- display @definition_files
55
- end
56
-
57
- def library_files
58
- node = params.has_key?('node') ? params[:node] : nil
59
- @lib_files = load_all_files(:libraries, node)
60
- display @lib_files
40
+ def files
41
+ display load_all_files(params[:type], params[:node])
61
42
  end
62
43
 
63
44
  end
@@ -31,10 +31,25 @@
31
31
  .code
32
32
  %h4.head= link_to File.basename(f), "#"
33
33
  %pre.ruby= syntax_highlight(f)
34
+ - unless @cookbook.resource_files.empty?
35
+ %h2.head= link_to "Resource Files", "#"
36
+ .files
37
+ - @cookbook.resource_files.each do |f|
38
+ .code
39
+ %h4.head= link_to File.basename(f), "#"
40
+ %pre.ruby= syntax_highlight(f)
41
+ - unless @cookbook.provider_files.empty?
42
+ %h2.head= link_to "Provider Files", "#"
43
+ .files
44
+ - @cookbook.provider_files.each do |f|
45
+ .code
46
+ %h4.head= link_to File.basename(f), "#"
47
+ %pre.ruby= syntax_highlight(f)
34
48
  - unless @cookbook.template_files.empty?
35
49
  %h2.head= link_to "Template Files", "#"
36
50
  .files
37
51
  - @cookbook.template_files.each do |f|
52
+ - rel = f.split('templates/',2)[1]
38
53
  .code
39
- %h4.head= link_to File.basename(f), "#"
54
+ %h4.head= link_to rel, "#"
40
55
  %pre.ruby= syntax_highlight(f)
@@ -94,16 +94,20 @@ if defined?(Merb::Plugins)
94
94
  scope.match("/search/:search_id/entries/:id", :method => 'post').to(:controller => "search_entries", :action => "update")
95
95
  scope.match("/search/:search_id/entries/:id", :method => 'delete').to(:controller => "search_entries", :action => "destroy")
96
96
 
97
- scope.match("/cookbooks/_attribute_files").to(:controller => "cookbooks", :action => "attribute_files")
98
- scope.match("/cookbooks/_recipe_files").to(:controller => "cookbooks", :action => "recipe_files")
99
- scope.match("/cookbooks/_definition_files").to(:controller => "cookbooks", :action => "definition_files")
100
- scope.match("/cookbooks/_library_files").to(:controller => "cookbooks", :action => "library_files")
97
+ scope.match("/cookbooks/_attribute_files").to(:controller => "cookbooks", :action => "files", :type => :attributes)
98
+ scope.match("/cookbooks/_recipe_files").to(:controller => "cookbooks", :action => "files", :type => :recipes)
99
+ scope.match("/cookbooks/_definition_files").to(:controller => "cookbooks", :action => "files", :type => :definitions)
100
+ scope.match("/cookbooks/_library_files").to(:controller => "cookbooks", :action => "files", :type => :libraries)
101
+ scope.match("/cookbooks/_provider_files").to(:controller => "cookbooks", :action => "files", :type => :providers)
102
+ scope.match("/cookbooks/_resource_files").to(:controller => "cookbooks", :action => "files", :type => :resources)
101
103
 
102
104
  scope.match("/cookbooks/:cookbook_id/templates", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_templates", :action => "index")
103
- scope.match("/cookbooks/:cookbook_id/libraries", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_libraries", :action => "index")
104
- scope.match("/cookbooks/:cookbook_id/definitions", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_definitions", :action => "index")
105
- scope.match("/cookbooks/:cookbook_id/recipes", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_recipes", :action => "index")
106
- scope.match("/cookbooks/:cookbook_id/attributes", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_attributes", :action => "index")
105
+ scope.match("/cookbooks/:cookbook_id/libraries", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_segment", :action => "index", :type => :libraries)
106
+ scope.match("/cookbooks/:cookbook_id/definitions", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_segment", :action => "index", :type => :definitions)
107
+ scope.match("/cookbooks/:cookbook_id/providers", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_segment", :action => "index", :type => :providers)
108
+ scope.match("/cookbooks/:cookbook_id/resources", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_segment", :action => "index", :type => :resources)
109
+ scope.match("/cookbooks/:cookbook_id/recipes", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_segment", :action => "index", :type => :recipes)
110
+ scope.match("/cookbooks/:cookbook_id/attributes", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_segment", :action => "index", :type => :attributes)
107
111
  scope.match("/cookbooks/:cookbook_id/files", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_files", :action => "index")
108
112
 
109
113
  scope.resources :cookbooks
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-server-slice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.10
4
+ version: 0.7.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Opscode
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-16 00:00:00 +12:00
12
+ date: 2009-10-21 00:00:00 +13:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -155,11 +155,8 @@ files:
155
155
  - LICENSE
156
156
  - README.rdoc
157
157
  - app/controllers/application.rb
158
- - app/controllers/cookbook_attributes.rb
159
- - app/controllers/cookbook_definitions.rb
160
158
  - app/controllers/cookbook_files.rb
161
- - app/controllers/cookbook_libraries.rb
162
- - app/controllers/cookbook_recipes.rb
159
+ - app/controllers/cookbook_segment.rb
163
160
  - app/controllers/cookbook_templates.rb
164
161
  - app/controllers/cookbooks.rb
165
162
  - app/controllers/exceptions.rb
@@ -1,59 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Author:: Christopher Brown (<cb@opscode.com>)
4
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- require 'chef' / 'mixin' / 'checksum'
21
-
22
- class ChefServerSlice::CookbookAttributes < ChefServerSlice::Application
23
-
24
- provides :html, :json
25
-
26
- before :login_required
27
-
28
- include Chef::Mixin::Checksum
29
-
30
- def load_cookbook_attributes()
31
- @attribute_files = load_cookbook_segment(params[:cookbook_id], :attributes)
32
- end
33
-
34
- def index
35
- if params[:id]
36
- show
37
- else
38
- load_cookbook_attributes()
39
- display @attribute_files
40
- end
41
- end
42
-
43
- def show
44
- only_provides :json
45
- load_cookbook_attributes
46
- raise NotFound, "Cannot find a suitable attribute file!" unless @attribute_files.has_key?(params[:id])
47
- to_send = @attribute_files[params[:id]][:file]
48
- current_checksum = checksum(to_send)
49
- Chef::Log.debug("old sum: #{params[:checksum]}, new sum: #{current_checksum}")
50
- if current_checksum == params[:checksum]
51
- display "File #{to_send} has not changed", :status => 304
52
- else
53
- send_file(to_send)
54
- end
55
- end
56
-
57
- end
58
-
59
-
@@ -1,60 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Author:: Christopher Brown (<cb@opscode.com>)
4
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- require 'chef' / 'mixin' / 'checksum'
21
-
22
- class ChefServerSlice::CookbookDefinitions < ChefServerSlice::Application
23
-
24
- provides :html, :json
25
-
26
- before :login_required
27
-
28
- include Chef::Mixin::Checksum
29
-
30
- def load_cookbook_definitions()
31
- @definition_files = load_cookbook_segment(params[:cookbook_id], :definitions)
32
- end
33
-
34
- def index
35
- if params[:id]
36
- show
37
- else
38
- load_cookbook_definitions()
39
- display @definition_files
40
- end
41
- end
42
-
43
- def show
44
- only_provides :json
45
- load_cookbook_definitions
46
- raise NotFound, "Cannot find a suitable definition file!" unless @definition_files.has_key?(params[:id])
47
-
48
- to_send = @definition_files[params[:id]][:file]
49
- current_checksum = checksum(to_send)
50
- Chef::Log.debug("Old sum: #{params[:checksum]}, New sum: #{current_checksum}")
51
- if current_checksum == params[:checksum]
52
- display "File #{to_send} has not changed", :status => 304
53
- else
54
- send_file(to_send)
55
- end
56
- end
57
-
58
- end
59
-
60
-
@@ -1,60 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Author:: Christopher Brown (<cb@opscode.com>)
4
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- require 'chef' / 'mixin' / 'checksum'
21
- require 'chef' / 'cookbook_loader'
22
-
23
- class ChefServerSlice::CookbookLibraries < ChefServerSlice::Application
24
-
25
- provides :html, :json
26
- before :login_required
27
-
28
- include Chef::Mixin::Checksum
29
-
30
- def load_cookbook_libs()
31
- @lib_files = load_cookbook_segment(params[:cookbook_id], :libraries)
32
- end
33
-
34
- def index
35
- if params[:id]
36
- show
37
- else
38
- load_cookbook_libs()
39
- display @lib_files
40
- end
41
- end
42
-
43
- def show
44
- only_provides :json
45
- load_cookbook_libs
46
- raise NotFound, "Cannot find a suitable library file!" unless @lib_files.has_key?(params[:id])
47
-
48
- to_send = @lib_files[params[:id]][:file]
49
- current_checksum = checksum(to_send)
50
- Chef::Log.debug("Old sum: #{params[:checksum]}, New sum: #{current_checksum}")
51
- if current_checksum == params[:checksum]
52
- display "File #{to_send} has not changed", :status => 304
53
- else
54
- send_file(to_send)
55
- end
56
- end
57
-
58
- end
59
-
60
-