chef-server-slice 0.7.10
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.
- data/LICENSE +201 -0
- data/README.rdoc +135 -0
- data/app/controllers/application.rb +228 -0
- data/app/controllers/cookbook_attributes.rb +59 -0
- data/app/controllers/cookbook_definitions.rb +60 -0
- data/app/controllers/cookbook_files.rb +94 -0
- data/app/controllers/cookbook_libraries.rb +60 -0
- data/app/controllers/cookbook_recipes.rb +59 -0
- data/app/controllers/cookbook_templates.rb +80 -0
- data/app/controllers/cookbooks.rb +63 -0
- data/app/controllers/exceptions.rb +33 -0
- data/app/controllers/main.rb +7 -0
- data/app/controllers/nodes.rb +144 -0
- data/app/controllers/openid_consumer.rb +133 -0
- data/app/controllers/openid_register.rb +113 -0
- data/app/controllers/openid_server.rb +252 -0
- data/app/controllers/roles.rb +138 -0
- data/app/controllers/search.rb +58 -0
- data/app/controllers/search_entries.rb +73 -0
- data/app/controllers/status.rb +34 -0
- data/app/helpers/application_helper.rb +144 -0
- data/app/helpers/cookbook_attributes_helper.rb +7 -0
- data/app/helpers/cookbook_definitions_helper.rb +8 -0
- data/app/helpers/cookbook_files_helper.rb +8 -0
- data/app/helpers/cookbook_libraries_helper.rb +7 -0
- data/app/helpers/cookbook_recipes_helper.rb +8 -0
- data/app/helpers/cookbook_templates_helper.rb +8 -0
- data/app/helpers/cookbooks_helper.rb +31 -0
- data/app/helpers/exceptions_helper.rb +6 -0
- data/app/helpers/global_helpers.rb +39 -0
- data/app/helpers/nodes_helper.rb +33 -0
- data/app/helpers/openid_consumer_helper.rb +8 -0
- data/app/helpers/openid_register_helper.rb +8 -0
- data/app/helpers/openid_server_helper.rb +6 -0
- data/app/helpers/openid_server_helpers.rb +29 -0
- data/app/helpers/roles_helper.rb +5 -0
- data/app/helpers/search_entries_helper.rb +8 -0
- data/app/helpers/search_helper.rb +38 -0
- data/app/helpers/status_helper.rb +26 -0
- data/app/views/cookbook_templates/index.html.haml +7 -0
- data/app/views/cookbooks/index.html.haml +10 -0
- data/app/views/cookbooks/show.html.haml +40 -0
- data/app/views/exceptions/bad_request.json.erb +1 -0
- data/app/views/exceptions/internal_server_error.html.erb +216 -0
- data/app/views/exceptions/not_acceptable.html.erb +63 -0
- data/app/views/exceptions/not_found.html.erb +47 -0
- data/app/views/exceptions/standard_error.html.erb +217 -0
- data/app/views/layout/chef_server_slice.html.haml +53 -0
- data/app/views/layout/login.html.haml +37 -0
- data/app/views/main/index.html.erb +1 -0
- data/app/views/nodes/_action.html.haml +13 -0
- data/app/views/nodes/_form.html.haml +56 -0
- data/app/views/nodes/_navigation.html.haml +9 -0
- data/app/views/nodes/_resource.html.haml +22 -0
- data/app/views/nodes/edit.html.haml +7 -0
- data/app/views/nodes/index.html.haml +25 -0
- data/app/views/nodes/new.html.haml +6 -0
- data/app/views/nodes/show.html.haml +60 -0
- data/app/views/openid_consumer/index.html.haml +23 -0
- data/app/views/openid_consumer/start.html.haml +4 -0
- data/app/views/openid_login/index.html.haml +5 -0
- data/app/views/openid_register/index.html.haml +19 -0
- data/app/views/openid_register/show.html.haml +7 -0
- data/app/views/openid_server/decide.html.haml +27 -0
- data/app/views/roles/_form.html.haml +48 -0
- data/app/views/roles/_navigation.html.haml +9 -0
- data/app/views/roles/edit.html.haml +6 -0
- data/app/views/roles/index.html.haml +22 -0
- data/app/views/roles/new.html.haml +6 -0
- data/app/views/roles/show.html.haml +29 -0
- data/app/views/search/_search_form.html.haml +6 -0
- data/app/views/search/index.html.haml +9 -0
- data/app/views/search/show.html.haml +14 -0
- data/app/views/search_entries/index.html.haml +8 -0
- data/app/views/search_entries/show.html.haml +7 -0
- data/app/views/status/index.html.haml +88 -0
- data/config/init.rb +48 -0
- data/config/router.rb +6 -0
- data/lib/chef-server-slice.rb +150 -0
- data/lib/chef-server-slice/merbtasks.rb +103 -0
- data/lib/chef-server-slice/slicetasks.rb +20 -0
- data/lib/chef-server-slice/spectasks.rb +53 -0
- data/public/facebox/README.txt +4 -0
- data/public/facebox/b.png +0 -0
- data/public/facebox/bl.png +0 -0
- data/public/facebox/br.png +0 -0
- data/public/facebox/closelabel.gif +0 -0
- data/public/facebox/facebox.css +95 -0
- data/public/facebox/facebox.js +319 -0
- data/public/facebox/loading.gif +0 -0
- data/public/facebox/tl.png +0 -0
- data/public/facebox/tr.png +0 -0
- data/public/images/avatar.png +0 -0
- data/public/images/black_big.png +0 -0
- data/public/images/indicator.gif +0 -0
- data/public/images/merb.jpg +0 -0
- data/public/images/toggle-collapse-dark.png +0 -0
- data/public/images/toggle-collapse-light.png +0 -0
- data/public/images/toggle-collapse.gif +0 -0
- data/public/images/toggle-expand-dark.png +0 -0
- data/public/images/toggle-expand-light.png +0 -0
- data/public/images/toggle-expand.gif +0 -0
- data/public/images/treeBuilderImages/Thumbs.db +0 -0
- data/public/images/treeBuilderImages/doc.gif +0 -0
- data/public/images/treeBuilderImages/docNode.gif +0 -0
- data/public/images/treeBuilderImages/docNodeLast.gif +0 -0
- data/public/images/treeBuilderImages/docNodeLastFirst.gif +0 -0
- data/public/images/treeBuilderImages/folder.gif +0 -0
- data/public/images/treeBuilderImages/folderNode.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeFirst.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeLast.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeLastFirst.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeOpen.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeOpenFirst.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeOpenLast.gif +0 -0
- data/public/images/treeBuilderImages/folderNodeOpenLastFirst.gif +0 -0
- data/public/images/treeBuilderImages/folderOpen.gif +0 -0
- data/public/images/treeBuilderImages/vertLine.gif +0 -0
- data/public/javascripts/JSONeditor.js +1171 -0
- data/public/javascripts/chef.js +126 -0
- data/public/javascripts/jquery-1.3.2.min.js +19 -0
- data/public/javascripts/jquery-ui-1.7.1.custom.min.js +65 -0
- data/public/javascripts/jquery.editinline.js +108 -0
- data/public/javascripts/jquery.jeditable.mini.js +30 -0
- data/public/javascripts/jquery.livequery.js +250 -0
- data/public/javascripts/jquery.localscroll.js +104 -0
- data/public/javascripts/jquery.scrollTo.js +150 -0
- data/public/javascripts/jquery.tools.min.js +17 -0
- data/public/javascripts/jquery.treeTable.min.js +165 -0
- data/public/stylesheets/base.css +336 -0
- data/public/stylesheets/chef.css +157 -0
- data/public/stylesheets/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png +0 -0
- data/public/stylesheets/images/ui-bg_diagonals-thick_15_444444_40x40.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_100_f0f0f0_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_50_99c2ff_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_55_fbf5d0_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_80_e6e6e6_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png +0 -0
- data/public/stylesheets/images/ui-bg_highlight-soft_100_e7eef3_1x100.png +0 -0
- data/public/stylesheets/images/ui-icons_222222_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_2694e8_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_2e83ff_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_72a7cf_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_888888_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/stylesheets/jquery-ui-1.7.1.custom.css +404 -0
- data/public/stylesheets/jquery.treeTable.css +43 -0
- data/public/stylesheets/themes/bec-green/style.css +290 -0
- data/public/stylesheets/themes/bec/style.css +301 -0
- data/public/stylesheets/themes/blue/style.css +280 -0
- data/public/stylesheets/themes/default/style.css +267 -0
- data/public/stylesheets/themes/djime-cerulean/style.css +298 -0
- data/public/stylesheets/themes/kathleene/style.css +272 -0
- data/public/stylesheets/themes/orange/style.css +263 -0
- data/public/stylesheets/themes/reidb-greenish/style.css +301 -0
- metadata +341 -0
data/config/init.rb
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#
|
|
2
|
+
# ==== Standalone Chefserver configuration
|
|
3
|
+
#
|
|
4
|
+
# This configuration/environment file is only loaded by bin/slice, which can be
|
|
5
|
+
# used during development of the slice. It has no effect on this slice being
|
|
6
|
+
# loaded in a host application. To run your slice in standalone mode, just
|
|
7
|
+
# run 'slice' from its directory. The 'slice' command is very similar to
|
|
8
|
+
# the 'merb' command, and takes all the same options, including -i to drop
|
|
9
|
+
# into an irb session for example.
|
|
10
|
+
#
|
|
11
|
+
# The usual Merb configuration directives and init.rb setup methods apply,
|
|
12
|
+
# including use_orm and before_app_loads/after_app_loads.
|
|
13
|
+
#
|
|
14
|
+
# If you need need different configurations for different environments you can
|
|
15
|
+
# even create the specific environment file in config/environments/ just like
|
|
16
|
+
# in a regular Merb application.
|
|
17
|
+
#
|
|
18
|
+
# In fact, a slice is no different from a normal # Merb application - it only
|
|
19
|
+
# differs by the fact that seamlessly integrates into a so called 'host'
|
|
20
|
+
# application, which in turn can override or finetune the slice implementation
|
|
21
|
+
# code and views.
|
|
22
|
+
#
|
|
23
|
+
|
|
24
|
+
$: << File.join(File.dirname(__FILE__), "..", "..", "chef", "lib")
|
|
25
|
+
require 'chef'
|
|
26
|
+
|
|
27
|
+
merb_gems_version = " > 1.0"
|
|
28
|
+
dependency "merb-haml", merb_gems_version
|
|
29
|
+
dependency "merb-assets", merb_gems_version
|
|
30
|
+
dependency "merb-helpers", merb_gems_version
|
|
31
|
+
dependency "chef", :immediate=>true unless defined?(Chef)
|
|
32
|
+
|
|
33
|
+
use_template_engine :haml
|
|
34
|
+
|
|
35
|
+
Merb::Config.use do |c|
|
|
36
|
+
# BUGBUG [cb] For some reason, this next line
|
|
37
|
+
# causes a merb slice to vomit around openid
|
|
38
|
+
# c[:fork_for_class_load] = false
|
|
39
|
+
|
|
40
|
+
c[:session_id_key] = '_chef_server_session_id'
|
|
41
|
+
c[:session_secret_key] = Chef::Config.manage_secret_key
|
|
42
|
+
c[:session_store] = 'cookie'
|
|
43
|
+
c[:exception_details] = true
|
|
44
|
+
c[:reload_classes] = true
|
|
45
|
+
c[:log_level] = Chef::Config[:log_level]
|
|
46
|
+
c[:log_file] = Chef::Config[:log_location]
|
|
47
|
+
end
|
|
48
|
+
|
data/config/router.rb
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
if defined?(Merb::Plugins)
|
|
2
|
+
$:.unshift File.dirname(__FILE__)
|
|
3
|
+
|
|
4
|
+
dependency 'merb-slices', :immediate => true
|
|
5
|
+
dependency 'chef', :immediate=>true unless defined?(Chef)
|
|
6
|
+
require 'chef/role'
|
|
7
|
+
|
|
8
|
+
require 'coderay'
|
|
9
|
+
|
|
10
|
+
Merb::Plugins.add_rakefiles "chef-server-slice/merbtasks", "chef-server-slice/slicetasks", "chef-server-slice/spectasks"
|
|
11
|
+
|
|
12
|
+
# Register the Slice for the current host application
|
|
13
|
+
Merb::Slices::register(__FILE__)
|
|
14
|
+
|
|
15
|
+
Merb.disable :json
|
|
16
|
+
|
|
17
|
+
# Slice configuration - set this in a before_app_loads callback.
|
|
18
|
+
# By default a Slice uses its own layout, so you can switch to
|
|
19
|
+
# the main application layout or no layout at all if needed.
|
|
20
|
+
#
|
|
21
|
+
# Configuration options:
|
|
22
|
+
# :layout - the layout to use; defaults to :chefserverslice
|
|
23
|
+
# :mirror - which path component types to use on copy operations; defaults to all
|
|
24
|
+
Merb::Slices::config[:chef_server_slice][:layout] ||= :chef_server_slice
|
|
25
|
+
|
|
26
|
+
# All Slice code is expected to be namespaced inside a module
|
|
27
|
+
module ChefServerSlice
|
|
28
|
+
# Slice metadata
|
|
29
|
+
self.description = "ChefServerSlice.. serving up some piping hot infrastructure!"
|
|
30
|
+
self.version = Chef::VERSION
|
|
31
|
+
self.author = "Opscode"
|
|
32
|
+
|
|
33
|
+
# Stub classes loaded hook - runs before LoadClasses BootLoader
|
|
34
|
+
# right after a slice's classes have been loaded internally.
|
|
35
|
+
def self.loaded
|
|
36
|
+
Chef::Queue.connect
|
|
37
|
+
|
|
38
|
+
# create the couch databases for openid association and nonce storage, if configured
|
|
39
|
+
if Chef::Config[:openid_store_couchdb] || Chef::Config[:openid_cstore_couchdb]
|
|
40
|
+
rest = Chef::REST.new(Chef::Config[:couchdb_url])
|
|
41
|
+
@database_list = rest.get_rest("_all_dbs")
|
|
42
|
+
unless @database_list.detect { |db| db == 'associations' }
|
|
43
|
+
response = rest.put_rest('associations', Hash.new)
|
|
44
|
+
end
|
|
45
|
+
unless @database_list.detect { |db| db == 'nonces' }
|
|
46
|
+
response = rest.put_rest('nonces', Hash.new)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# create the couch design docs for nodes and openid registrations
|
|
51
|
+
Chef::Node.create_design_document
|
|
52
|
+
Chef::Role.create_design_document
|
|
53
|
+
Chef::OpenIDRegistration.create_design_document
|
|
54
|
+
|
|
55
|
+
Chef::Log.logger = Merb.logger
|
|
56
|
+
Chef::Log.info("Compiling routes... (totally normal to see 'Cannot find resource model')")
|
|
57
|
+
Chef::Log.info("Loading roles")
|
|
58
|
+
Chef::Role.sync_from_disk_to_couchdb
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Initialization hook - runs before AfterAppLoads BootLoader
|
|
62
|
+
def self.init
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Activation hook - runs after AfterAppLoads BootLoader
|
|
66
|
+
def self.activate
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Deactivation hook - triggered by Merb::Slices.deactivate(Chefserver)
|
|
70
|
+
def self.deactivate
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Setup routes inside the host application
|
|
74
|
+
#
|
|
75
|
+
# @param scope<Merb::Router::Behaviour>
|
|
76
|
+
# Routes will be added within this scope (namespace). In fact, any
|
|
77
|
+
# router behaviour is a valid namespace, so you can attach
|
|
78
|
+
# routes at any level of your router setup.
|
|
79
|
+
#
|
|
80
|
+
# @note prefix your named routes with :chefserverslice_
|
|
81
|
+
# to avoid potential conflicts with global named routes.
|
|
82
|
+
def self.setup_router(scope)
|
|
83
|
+
|
|
84
|
+
scope.resources :nodes
|
|
85
|
+
scope.resources :roles
|
|
86
|
+
|
|
87
|
+
scope.match("/status").to(:controller => "status", :action => "index").name(:status)
|
|
88
|
+
|
|
89
|
+
scope.resources :searches, :path => "search", :controller => "search"
|
|
90
|
+
scope.match("/search/:search_id/entries", :method => 'get').to(:controller => "search_entries", :action => "index")
|
|
91
|
+
scope.match("/search/:search_id/entries", :method => 'post').to(:controller => "search_entries", :action => "create")
|
|
92
|
+
scope.match("/search/:search_id/entries/:id", :method => 'get').to(:controller => "search_entries", :action => "show")
|
|
93
|
+
scope.match("/search/:search_id/entries/:id", :method => 'put').to(:controller => "search_entries", :action => "create")
|
|
94
|
+
scope.match("/search/:search_id/entries/:id", :method => 'post').to(:controller => "search_entries", :action => "update")
|
|
95
|
+
scope.match("/search/:search_id/entries/:id", :method => 'delete').to(:controller => "search_entries", :action => "destroy")
|
|
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")
|
|
101
|
+
|
|
102
|
+
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")
|
|
107
|
+
scope.match("/cookbooks/:cookbook_id/files", :cookbook_id => /[\w\.]+/).to(:controller => "cookbook_files", :action => "index")
|
|
108
|
+
|
|
109
|
+
scope.resources :cookbooks
|
|
110
|
+
scope.resources :registrations, :controller => "openid_register"
|
|
111
|
+
scope.resources :registrations, :controller => "openid_register", :member => { :validate => :post }
|
|
112
|
+
scope.resources :registrations, :controller => "openid_register", :member => { :admin => :post }
|
|
113
|
+
|
|
114
|
+
scope.match("/openid/server").to(:controller => "openid_server", :action => "index").name(:openid_server)
|
|
115
|
+
scope.match("/openid/server/server/xrds").
|
|
116
|
+
to(:controller => "openid_server", :action => 'idp_xrds').name(:openid_server_xrds)
|
|
117
|
+
scope.match("/openid/server/node/:id").
|
|
118
|
+
to(:controller => "openid_server", :action => 'node_page').name(:openid_node)
|
|
119
|
+
scope.match('/openid/server/node/:id/xrds').
|
|
120
|
+
to(:controller => 'openid_server', :action => 'node_xrds').name(:openid_node_xrds)
|
|
121
|
+
scope.match('/openid/server/decision').to(:controller => "openid_server", :action => "decision").name(:openid_server_decision)
|
|
122
|
+
scope.match('/login').to(:controller=>'openid_consumer', :action=>'index').name(:openid_consumer)
|
|
123
|
+
scope.match('/logout').to(:controller => 'openid_consumer', :action => 'logout').name(:openid_consumer_logout)
|
|
124
|
+
scope.match('/openid/consumer').to(:controller => 'openid_consumer', :action => 'index').name(:openid_consumer)
|
|
125
|
+
scope.match('/openid/consumer/start').to(:controller => 'openid_consumer', :action => 'start').name(:openid_consumer_start)
|
|
126
|
+
scope.match('/openid/consumer/login').to(:controller => 'openid_consumer', :action => 'login').name(:openid_consumer_login)
|
|
127
|
+
scope.match('/openid/consumer/complete').to(:controller => 'openid_consumer', :action => 'complete').name(:openid_consumer_complete)
|
|
128
|
+
scope.match('/openid/consumer/logout').to(:controller => 'openid_consumer', :action => 'logout').name(:openid_consumer_logout)
|
|
129
|
+
|
|
130
|
+
scope.match('/').to(:controller => 'nodes', :action =>'index').name(:top)
|
|
131
|
+
# enable slice-level default routes by default
|
|
132
|
+
# scope.default_routes
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Setup the slice layout for ChefServerSlice
|
|
138
|
+
#
|
|
139
|
+
# Use ChefServerSlice.push_path and ChefServerSlice.push_app_path
|
|
140
|
+
# to set paths to chefserver-level and app-level paths. Example:
|
|
141
|
+
#
|
|
142
|
+
# ChefServerSlice.push_path(:application, ChefServerSlice.root)
|
|
143
|
+
# ChefServerSlice.push_app_path(:application, Merb.root / 'slices' / 'chefserverslice')
|
|
144
|
+
# ...
|
|
145
|
+
#
|
|
146
|
+
# Any component path that hasn't been set will default to ChefServerSlice.root
|
|
147
|
+
#
|
|
148
|
+
# Or just call setup_default_structure! to setup a basic Merb MVC structure.
|
|
149
|
+
ChefServerSlice.setup_default_structure!
|
|
150
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
namespace :slices do
|
|
2
|
+
namespace :chefserverslice do
|
|
3
|
+
|
|
4
|
+
desc "Install Chefserver"
|
|
5
|
+
task :install => [:preflight, :setup_directories, :copy_assets, :migrate]
|
|
6
|
+
|
|
7
|
+
desc "Test for any dependencies"
|
|
8
|
+
task :preflight do # see slicetasks.rb
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
desc "Setup directories"
|
|
12
|
+
task :setup_directories do
|
|
13
|
+
puts "Creating directories for host application"
|
|
14
|
+
ChefServerSlice.mirrored_components.each do |type|
|
|
15
|
+
if File.directory?(ChefServerSlice.dir_for(type))
|
|
16
|
+
if !File.directory?(dst_path = ChefServerSlice.app_dir_for(type))
|
|
17
|
+
relative_path = dst_path.relative_path_from(Merb.root)
|
|
18
|
+
puts "- creating directory :#{type} #{File.basename(Merb.root) / relative_path}"
|
|
19
|
+
mkdir_p(dst_path)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# desc "Copy stub files to host application"
|
|
26
|
+
# task :stubs do
|
|
27
|
+
# puts "Copying stubs for ChefServerSlice - resolves any collisions"
|
|
28
|
+
# copied, preserved = ChefServerSlice.mirror_stubs!
|
|
29
|
+
# puts "- no files to copy" if copied.empty? && preserved.empty?
|
|
30
|
+
# copied.each { |f| puts "- copied #{f}" }
|
|
31
|
+
# preserved.each { |f| puts "! preserved override as #{f}" }
|
|
32
|
+
# end
|
|
33
|
+
|
|
34
|
+
# desc "Copy stub files and views to host application"
|
|
35
|
+
# task :patch => [ "stubs", "freeze:views" ]
|
|
36
|
+
|
|
37
|
+
desc "Copy public assets to host application"
|
|
38
|
+
task :copy_assets do
|
|
39
|
+
puts "Copying assets for ChefServerSlice - resolves any collisions"
|
|
40
|
+
copied, preserved = ChefServerSlice.mirror_public!
|
|
41
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
|
42
|
+
copied.each { |f| puts "- copied #{f}" }
|
|
43
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
desc "Migrate the database"
|
|
47
|
+
task :migrate do # see slicetasks.rb
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
desc "Freeze ChefServerSlice into your app (only chefserverslice/app)"
|
|
51
|
+
task :freeze => [ "freeze:app" ]
|
|
52
|
+
|
|
53
|
+
namespace :freeze do
|
|
54
|
+
|
|
55
|
+
# desc "Freezes ChefServerSlice by installing the gem into application/gems"
|
|
56
|
+
# task :gem do
|
|
57
|
+
# ENV["GEM"] ||= "chefserverslice"
|
|
58
|
+
# Rake::Task['slices:install_as_gem'].invoke
|
|
59
|
+
# end
|
|
60
|
+
|
|
61
|
+
desc "Freezes ChefServerSlice by copying all files from chefserverslice/app to your application"
|
|
62
|
+
task :app do
|
|
63
|
+
puts "Copying all chefserverslice/app files to your application - resolves any collisions"
|
|
64
|
+
copied, preserved = ChefServerSlice.mirror_app!
|
|
65
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
|
66
|
+
copied.each { |f| puts "- copied #{f}" }
|
|
67
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
desc "Freeze all views into your application for easy modification"
|
|
71
|
+
task :views do
|
|
72
|
+
puts "Copying all view templates to your application - resolves any collisions"
|
|
73
|
+
copied, preserved = ChefServerSlice.mirror_files_for :view
|
|
74
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
|
75
|
+
copied.each { |f| puts "- copied #{f}" }
|
|
76
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
desc "Freeze all models into your application for easy modification"
|
|
80
|
+
task :models do
|
|
81
|
+
puts "Copying all models to your application - resolves any collisions"
|
|
82
|
+
copied, preserved = ChefServerSlice.mirror_files_for :model
|
|
83
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
|
84
|
+
copied.each { |f| puts "- copied #{f}" }
|
|
85
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
desc "Freezes ChefServerSlice as a gem and copies over chefserver/app"
|
|
89
|
+
task :app_with_gem => [:gem, :app]
|
|
90
|
+
|
|
91
|
+
desc "Freezes ChefServerSlice by unpacking all files into your application"
|
|
92
|
+
task :unpack do
|
|
93
|
+
puts "Unpacking ChefServerSlice files to your application - resolves any collisions"
|
|
94
|
+
copied, preserved = ChefServerSlice.unpack_slice!
|
|
95
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
|
96
|
+
copied.each { |f| puts "- copied #{f}" }
|
|
97
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
namespace :slices do
|
|
2
|
+
namespace :chefserverslice do
|
|
3
|
+
|
|
4
|
+
# add your own chefserver tasks here
|
|
5
|
+
|
|
6
|
+
# # Uncomment the following lines and edit the pre defined tasks
|
|
7
|
+
#
|
|
8
|
+
# # implement this to test for structural/code dependencies
|
|
9
|
+
# # like certain directories or availability of other files
|
|
10
|
+
# desc "Test for any dependencies"
|
|
11
|
+
# task :preflight do
|
|
12
|
+
# end
|
|
13
|
+
#
|
|
14
|
+
# # implement this to perform any database related setup steps
|
|
15
|
+
# desc "Migrate the database"
|
|
16
|
+
# task :migrate do
|
|
17
|
+
# end
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
namespace :slices do
|
|
2
|
+
namespace :chefserverslice do
|
|
3
|
+
|
|
4
|
+
desc "Run slice specs within the host application context"
|
|
5
|
+
task :spec => [ "spec:explain", "spec:default" ]
|
|
6
|
+
|
|
7
|
+
namespace :spec do
|
|
8
|
+
|
|
9
|
+
slice_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
|
10
|
+
|
|
11
|
+
task :explain do
|
|
12
|
+
puts "\nNote: By running ChefServerSlice specs inside the application context any\n" +
|
|
13
|
+
"overrides could break existing specs. This isn't always a problem,\n" +
|
|
14
|
+
"especially in the case of views. Use these spec tasks to check how\n" +
|
|
15
|
+
"well your application conforms to the original slice implementation."
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Spec::Rake::SpecTask.new('default') do |t|
|
|
19
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
|
20
|
+
t.spec_files = Dir["#{slice_root}/spec/**/*_spec.rb"].sort
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
desc "Run all model specs, run a spec for a specific Model with MODEL=MyModel"
|
|
24
|
+
Spec::Rake::SpecTask.new('model') do |t|
|
|
25
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
|
26
|
+
if(ENV['MODEL'])
|
|
27
|
+
t.spec_files = Dir["#{slice_root}/spec/models/**/#{ENV['MODEL']}_spec.rb"].sort
|
|
28
|
+
else
|
|
29
|
+
t.spec_files = Dir["#{slice_root}/spec/models/**/*_spec.rb"].sort
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
desc "Run all request specs, run a spec for a specific request with REQUEST=MyRequest"
|
|
34
|
+
Spec::Rake::SpecTask.new('request') do |t|
|
|
35
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
|
36
|
+
if(ENV['REQUEST'])
|
|
37
|
+
t.spec_files = Dir["#{slice_root}/spec/requests/**/#{ENV['REQUEST']}_spec.rb"].sort
|
|
38
|
+
else
|
|
39
|
+
t.spec_files = Dir["#{slice_root}/spec/requests/**/*_spec.rb"].sort
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
desc "Run all specs and output the result in html"
|
|
44
|
+
Spec::Rake::SpecTask.new('html') do |t|
|
|
45
|
+
t.spec_opts = ["--format", "html"]
|
|
46
|
+
t.libs = ['lib', 'server/lib' ]
|
|
47
|
+
t.spec_files = Dir["#{slice_root}/spec/**/*_spec.rb"].sort
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#facebox .b {
|
|
2
|
+
background:url(/facebox/b.png);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
#facebox .tl {
|
|
6
|
+
background:url(/facebox/tl.png);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
#facebox .tr {
|
|
10
|
+
background:url(/facebox/tr.png);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
#facebox .bl {
|
|
14
|
+
background:url(/facebox/bl.png);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#facebox .br {
|
|
18
|
+
background:url(/facebox/br.png);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#facebox {
|
|
22
|
+
position: absolute;
|
|
23
|
+
top: 0;
|
|
24
|
+
left: 0;
|
|
25
|
+
z-index: 100;
|
|
26
|
+
text-align: left;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#facebox .popup {
|
|
30
|
+
position: relative;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#facebox table {
|
|
34
|
+
border-collapse: collapse;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#facebox td {
|
|
38
|
+
border-bottom: 0;
|
|
39
|
+
padding: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#facebox .body {
|
|
43
|
+
padding: 10px;
|
|
44
|
+
background: #fff;
|
|
45
|
+
width: 370px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#facebox .loading {
|
|
49
|
+
text-align: center;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#facebox .image {
|
|
53
|
+
text-align: center;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#facebox img {
|
|
57
|
+
border: 0;
|
|
58
|
+
margin: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#facebox .footer {
|
|
62
|
+
border-top: 1px solid #DDDDDD;
|
|
63
|
+
padding-top: 5px;
|
|
64
|
+
margin-top: 10px;
|
|
65
|
+
text-align: right;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#facebox .tl, #facebox .tr, #facebox .bl, #facebox .br {
|
|
69
|
+
height: 10px;
|
|
70
|
+
width: 10px;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
padding: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#facebox_overlay {
|
|
76
|
+
position: fixed;
|
|
77
|
+
top: 0px;
|
|
78
|
+
left: 0px;
|
|
79
|
+
height:100%;
|
|
80
|
+
width:100%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.facebox_hide {
|
|
84
|
+
z-index:-100;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.facebox_overlayBG {
|
|
88
|
+
background-color: #000;
|
|
89
|
+
z-index: 99;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
* html #facebox_overlay { /* ie6 hack */
|
|
93
|
+
position: absolute;
|
|
94
|
+
height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
|
|
95
|
+
}
|