bonethug 0.0.55 → 0.0.59
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/README.md +21 -14
- data/bin/bonethug +1 -1
- data/bin/thug +1 -1
- data/config/deploy.rb +9 -1
- data/lib/bonethug/cli.rb +25 -6
- data/lib/bonethug/installer.rb +10 -0
- data/lib/bonethug/version.rb +5 -5
- data/lib/bonethug.rb +8 -2
- data/lib/tasks/bonethug.rake +36 -43
- data/scripts/ubuntu_setup.sh +22 -16
- data/skel/project_types/silverstripe3/public/project/_config.php +4 -0
- data/skel/project_types/silverstripe3/public/project/code/Pages/HomePage.php +20 -0
- data/skel/project_types/silverstripe3/public/project/code/Pages/Page.php +46 -16
- data/skel/project_types/silverstripe3/public/project/code/Pages/RootPage.php +20 -0
- metadata +4 -2
data/README.md
CHANGED
@@ -33,7 +33,7 @@ execute:
|
|
33
33
|
|
34
34
|
update the bonethug files in your project:
|
35
35
|
|
36
|
-
`bundle exec
|
36
|
+
`bundle exec thug update`
|
37
37
|
|
38
38
|
|
39
39
|
|
@@ -48,7 +48,7 @@ Usage
|
|
48
48
|
|
49
49
|
**Set up a project Skeleton**
|
50
50
|
|
51
|
-
`
|
51
|
+
`thug install {rails3|silverstripe3|drupal|php|sinatra}`
|
52
52
|
|
53
53
|
|
54
54
|
|
@@ -56,7 +56,7 @@ Usage
|
|
56
56
|
|
57
57
|
*If you just want to use the deploy / cron / backup framework*
|
58
58
|
|
59
|
-
`
|
59
|
+
`thug init`
|
60
60
|
|
61
61
|
|
62
62
|
|
@@ -65,7 +65,7 @@ Usage
|
|
65
65
|
*This updates the .bonethug/deploy.rb, .bonethug/backup.rb,
|
66
66
|
config/example/cnf.yml, config/example/schedule.rb config files*
|
67
67
|
|
68
|
-
`
|
68
|
+
`thug update`
|
69
69
|
|
70
70
|
|
71
71
|
|
@@ -74,7 +74,7 @@ config/example/cnf.yml, config/example/schedule.rb config files*
|
|
74
74
|
*Configure the watch in the config/cnf.yml. Uses vanilla coffeescript and sass
|
75
75
|
compilers by default, but can use sprockets if passed the sprockets argument*
|
76
76
|
|
77
|
-
`
|
77
|
+
`thug watch [sprockets]`
|
78
78
|
|
79
79
|
|
80
80
|
|
@@ -83,12 +83,14 @@ compilers by default, but can use sprockets if passed the sprockets argument*
|
|
83
83
|
*Uses astrails-safe to make a backup using the .bonethug/backup.rb file. Uses
|
84
84
|
the info contained in cnf.yml*
|
85
85
|
|
86
|
-
`
|
86
|
+
`thug local-backup {development|staging|production}`
|
87
87
|
|
88
88
|
|
89
89
|
|
90
90
|
### Remote Commands
|
91
91
|
|
92
|
+
*UPDATE:* Bonethug now supports interactive prompts so this may no longer be necessary
|
93
|
+
|
92
94
|
Most of these are piped through mina. Mina uses SSH to send a bash script to
|
93
95
|
the remote server where it is executed. For these commands to work you need to
|
94
96
|
have the desired host already added to your known hosts file: ~/.ssh/known_hosts
|
@@ -103,14 +105,17 @@ Host *
|
|
103
105
|
UserKnownHostsFile=/dev/null
|
104
106
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
105
107
|
|
108
|
+
**Setup a remote server**
|
106
109
|
|
110
|
+
*This wraps mina to call all the commandsThis installs all the required software on a remote server*
|
111
|
+
`thug setup_env {development|staging|production}`
|
107
112
|
|
108
113
|
**Setup and Deploy to Remote Server**
|
109
114
|
|
110
115
|
*This wraps mina and deploys using the information contained in cnf.yml*
|
111
116
|
|
112
|
-
`
|
113
|
-
`
|
117
|
+
`thug setup {development|staging|production}`
|
118
|
+
`thug deploy {develoment|staging|production}`
|
114
119
|
|
115
120
|
|
116
121
|
|
@@ -122,7 +127,7 @@ It calls astrails-safe on the remote server and using the remote
|
|
122
127
|
If you are using FTP, make sure the directory exists before triggering a
|
123
128
|
backup.*
|
124
129
|
|
125
|
-
`
|
130
|
+
`thug remote-backup {develoment|staging|production}`
|
126
131
|
|
127
132
|
|
128
133
|
|
@@ -137,9 +142,9 @@ as it keeps the password out of the log files.*
|
|
137
142
|
BE CAREFUL USING SYNC-TO - if there are no files in the source location it will
|
138
143
|
wipe the files from your deploy copy.
|
139
144
|
|
140
|
-
`
|
145
|
+
`thug sync-from {develoment|staging|production}`
|
141
146
|
|
142
|
-
`
|
147
|
+
`thug sync-to {develoment|staging|production}`
|
143
148
|
|
144
149
|
|
145
150
|
|
@@ -147,6 +152,8 @@ wipe the files from your deploy copy.
|
|
147
152
|
Contributing
|
148
153
|
------------
|
149
154
|
|
150
|
-
1. Fork it
|
151
|
-
|
152
|
-
|
155
|
+
1. Fork it
|
156
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
157
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
158
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
159
|
+
5. Create new Pull Request
|
data/bin/bonethug
CHANGED
data/bin/thug
CHANGED
data/config/deploy.rb
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
|
15
15
|
require 'rubygems'
|
16
16
|
require 'bonethug/conf'
|
17
|
+
require 'bonethug/installer'
|
17
18
|
require 'mina/bundler'
|
18
19
|
require 'mina/rails'
|
19
20
|
require 'mina/git'
|
@@ -127,7 +128,14 @@ task :update_packages => :environment do
|
|
127
128
|
queue! %[php #{deploy_to}/current/public/framework/cli-script.php dev/build] if ['silverstripe','silverstripe3'].include? deploy.get('project_type')
|
128
129
|
end
|
129
130
|
|
130
|
-
desc "
|
131
|
+
desc "Sets up an environemt"
|
132
|
+
task :setup_env => :environment do
|
133
|
+
Bonethug::Installer.get_setup_env_cmds.each do |cmd|
|
134
|
+
queue! %[#{cmd}]
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
desc "Initialises the db"
|
131
139
|
task :init_db => :environment do
|
132
140
|
queue! %[cd #{deploy_to}/current && bundle exec rake db:reset RAILS_ENV="#{env}"] if deploy.get('project_type') =~ /rails[0-9]?/
|
133
141
|
end
|
data/lib/bonethug/cli.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Bonethug
|
2
2
|
class CLI
|
3
3
|
|
4
|
-
def self.handle
|
4
|
+
def self.handle(bin_name = 'thug')
|
5
5
|
|
6
6
|
# what are we doing?
|
7
7
|
task = ARGV[0] || 'help'
|
@@ -25,13 +25,32 @@ module Bonethug
|
|
25
25
|
|
26
26
|
# validate
|
27
27
|
unless type
|
28
|
-
puts 'Usage:
|
28
|
+
puts 'Usage: ' + bin_name + ' install [type] [location]'
|
29
29
|
return
|
30
30
|
end
|
31
31
|
|
32
32
|
# run the installer
|
33
33
|
Installer.install type, location
|
34
34
|
|
35
|
+
when 'setup_env'
|
36
|
+
|
37
|
+
# handle args
|
38
|
+
env = ARGV[1]
|
39
|
+
|
40
|
+
# validate
|
41
|
+
unless env
|
42
|
+
puts 'Usage: ' + bin_name + ' setup_env environment'
|
43
|
+
return
|
44
|
+
end
|
45
|
+
|
46
|
+
if env == 'local'
|
47
|
+
gem_dir = File.expand_path File.dirname(__FILE__) + '/../..'
|
48
|
+
script = gem_dir '/scripts/ubuntu_setup.sh'
|
49
|
+
exec 'sudo bash ' + script
|
50
|
+
else
|
51
|
+
exec "export to=#{env} && bundle exec mina -f .bonethug/deploy.rb setup_env --verbose"
|
52
|
+
end
|
53
|
+
|
35
54
|
when 'init', 'update'
|
36
55
|
|
37
56
|
# handle args
|
@@ -39,7 +58,7 @@ module Bonethug
|
|
39
58
|
|
40
59
|
# validate
|
41
60
|
unless location
|
42
|
-
puts 'Usage:
|
61
|
+
puts 'Usage: ' + bin_name + ' #{task} [location]'
|
43
62
|
return
|
44
63
|
end
|
45
64
|
|
@@ -93,7 +112,7 @@ module Bonethug
|
|
93
112
|
|
94
113
|
# validate
|
95
114
|
unless environment
|
96
|
-
puts 'Usage:
|
115
|
+
puts 'Usage: thug #{task} [environment]'
|
97
116
|
return
|
98
117
|
end
|
99
118
|
|
@@ -155,8 +174,8 @@ module Bonethug
|
|
155
174
|
|
156
175
|
end
|
157
176
|
|
158
|
-
def self.display_help
|
159
|
-
puts 'Usage:
|
177
|
+
def self.display_help(bin_name = 'thug')
|
178
|
+
puts 'Usage: ' + bin_name + ' task [argument]...'
|
160
179
|
end
|
161
180
|
|
162
181
|
end
|
data/lib/bonethug/installer.rb
CHANGED
@@ -130,6 +130,16 @@ module Bonethug
|
|
130
130
|
self
|
131
131
|
end
|
132
132
|
|
133
|
+
def self.get_setup_env_cmds
|
134
|
+
File.read(@@bonthug_gem_dir + '/scripts/ubuntu_setup.sh')
|
135
|
+
.split("\n")
|
136
|
+
.each { |line|
|
137
|
+
return false if line =~ /^[\s\t]+$/
|
138
|
+
return false if line =~ /^[\s\t]*#/
|
139
|
+
true
|
140
|
+
}
|
141
|
+
end
|
142
|
+
|
133
143
|
protected
|
134
144
|
|
135
145
|
def self.try_delete(file)
|
data/lib/bonethug/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
module Bonethug
|
3
|
+
VERSION = "0.0.59"
|
4
|
+
BUILD_DATE = "2013-10-17 20:04:25 +1300"
|
5
|
+
end
|
6
|
+
|
data/lib/bonethug.rb
CHANGED
@@ -5,9 +5,15 @@ require "bonethug/cli"
|
|
5
5
|
|
6
6
|
module Bonethug
|
7
7
|
|
8
|
-
def self.
|
8
|
+
def self.increment_version
|
9
|
+
|
10
|
+
version = VERSION.split('.')
|
11
|
+
version[version.length-1] = (version.last.to_i + 1).to_s
|
12
|
+
version = version.join('.')
|
13
|
+
|
9
14
|
remove_const 'VERSION'
|
10
|
-
const_set 'VERSION',
|
15
|
+
const_set 'VERSION', version
|
16
|
+
|
11
17
|
end
|
12
18
|
|
13
19
|
end
|
data/lib/tasks/bonethug.rake
CHANGED
@@ -1,75 +1,68 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../bonethug")
|
2
2
|
|
3
|
-
namespace :
|
3
|
+
namespace :thug do
|
4
4
|
|
5
|
-
|
6
|
-
task :build do
|
7
|
-
|
8
|
-
# handle paths
|
9
|
-
ver_path = File.expand_path File.dirname(__FILE__) + '/../bonethug/version.rb'
|
10
|
-
pkg_path = File.expand_path File.dirname(__FILE__) + '/../../pkg/bonethug-' + Bonethug::VERSION + '.gem'
|
5
|
+
def update_version_file(content = nil)
|
11
6
|
|
12
|
-
|
13
|
-
if File.exists? pkg_path
|
7
|
+
unless content
|
14
8
|
|
15
|
-
version
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
9
|
+
# generate content for version file
|
10
|
+
content = '
|
11
|
+
module Bonethug
|
12
|
+
VERSION = "' + Bonethug::VERSION + '"
|
13
|
+
BUILD_DATE = "' + Time.now.to_s + '"
|
14
|
+
end
|
15
|
+
'
|
22
16
|
|
23
17
|
end
|
24
18
|
|
25
|
-
#
|
26
|
-
|
27
|
-
module Bonethug
|
28
|
-
VERSION = "' + Bonethug::VERSION + '"
|
29
|
-
BUILD_DATE = "' + Time.now.to_s + '"
|
30
|
-
end
|
31
|
-
'
|
19
|
+
# handle paths
|
20
|
+
ver_path = File.expand_path File.dirname(__FILE__) + '/../bonethug/version.rb'
|
32
21
|
|
33
22
|
# write data
|
34
23
|
File.open(ver_path,'w') do |file|
|
35
24
|
file.puts content
|
36
25
|
end
|
37
26
|
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Runs rake build + some other stuff"
|
30
|
+
task :vup do
|
31
|
+
|
32
|
+
puts "was " + Bonethug::VERSION
|
33
|
+
|
34
|
+
Bonethug::increment_version
|
35
|
+
update_version_file
|
36
|
+
|
37
|
+
puts "now " + Bonethug::VERSION
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "Runs rake build + some other stuff"
|
42
|
+
task :build do
|
43
|
+
|
44
|
+
# update version file
|
45
|
+
update_version_file
|
46
|
+
|
38
47
|
# invoke the build script
|
39
48
|
Rake::Task["build"].invoke
|
40
49
|
|
41
50
|
end
|
42
51
|
|
43
|
-
desc "
|
44
|
-
task :
|
52
|
+
desc "Runs rake release + bonethug:build"
|
53
|
+
task :release do
|
45
54
|
|
46
55
|
# handle path
|
47
56
|
path = File.expand_path File.dirname(__FILE__) + '/../../pkg/bonethug-' + Bonethug::VERSION + '.gem'
|
48
57
|
|
49
58
|
# check if there's a build with the current version
|
50
|
-
|
51
|
-
Rake::Task["bonethug:build"].invoke
|
52
|
-
end
|
59
|
+
Rake::Task["thug:build"].invoke
|
53
60
|
|
54
61
|
# push the current version
|
55
62
|
# we redefine the path because the version constant may have changed
|
56
63
|
# -> the reason being that the parent build script uses that constant to name the gem package
|
57
|
-
exec
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
desc "runs bonethug:build then bonethug:push"
|
62
|
-
task :build_and_push do
|
63
|
-
|
64
|
-
# invoke the build script
|
65
|
-
Rake::Task["bonethug:build"].invoke
|
66
|
-
Rake::Task["bonethug:push"].invoke
|
67
|
-
|
68
|
-
end
|
64
|
+
exec "rake release --trace"
|
69
65
|
|
70
|
-
desc "alias for build + push the gem"
|
71
|
-
task :bp do
|
72
|
-
Rake::Task["bonethug:build_and_push"].invoke
|
73
66
|
end
|
74
67
|
|
75
68
|
end
|
data/scripts/ubuntu_setup.sh
CHANGED
@@ -4,8 +4,13 @@
|
|
4
4
|
# install native stuff
|
5
5
|
# -----------------------------------------------------
|
6
6
|
|
7
|
+
# install the repo adding scripts
|
8
|
+
sudo apt-get install software-properties-common python-software-properties
|
9
|
+
|
7
10
|
# add repos
|
8
11
|
sudo add-apt-repository ppa:richarvey/nodejs
|
12
|
+
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
|
13
|
+
sudo add-apt-repository "deb-src http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
|
9
14
|
|
10
15
|
# update
|
11
16
|
sudo apt-get update && sudo apt-get upgrade
|
@@ -39,17 +44,21 @@ sudo apt-get install git ruby1.9.3 wkhtmltopdf nodejs npm
|
|
39
44
|
# FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
|
40
45
|
# </IfModule>
|
41
46
|
# " > /etc/apache2/conf.d/php-fpm.conf
|
42
|
-
# sed -i -e "s/listen = \/var\/run\/php5-fpm.sock
|
43
|
-
|
44
|
-
|
45
|
-
echo "
|
46
|
-
<IfModule mod_fastcgi.c>
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
</IfModule>
|
52
|
-
" > /etc/apache2/conf.d/php-fpm.conf
|
47
|
+
# sed -i -e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php5-fpm.sock/g" /etc/php5/fpm/pool.d/www.conf
|
48
|
+
|
49
|
+
## TCP
|
50
|
+
# echo "
|
51
|
+
# <IfModule mod_fastcgi.c>
|
52
|
+
# AddHandler php5-fcgi .php
|
53
|
+
# Action php5-fcgi /php5-fcgi
|
54
|
+
# Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
|
55
|
+
# FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 250 -pass-header Authorization
|
56
|
+
# </IfModule>
|
57
|
+
# " > /etc/apache2/conf.d/php-fpm.conf
|
58
|
+
# sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
|
59
|
+
|
60
|
+
sed -i -e "s/listen = \/var\/run\/php5-fpm.sock\/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
|
61
|
+
sudo echo -e "<IfModule mod_fastcgi.c>\n AddHandler php5-fcgi .php\n Action php5-fcgi /php5-fcgi\n Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\n FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 250 -pass-header Authorization\n </IfModule>" > /etc/apache2/conf.d/php-fpm.conf
|
53
62
|
|
54
63
|
# Apache
|
55
64
|
# ------
|
@@ -60,8 +69,6 @@ sudo a2enmod actions fastcgi alias rewrite headers
|
|
60
69
|
# phpmyadmin
|
61
70
|
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
|
62
71
|
|
63
|
-
|
64
|
-
|
65
72
|
# -----------------------------------------------------
|
66
73
|
# Install Gems
|
67
74
|
# -----------------------------------------------------
|
@@ -72,8 +79,8 @@ sudo gem1.9.3 install mina bundler whenever astrails-safe
|
|
72
79
|
# install passenger
|
73
80
|
sudo gem1.9.3 install passenger
|
74
81
|
sudo passenger-install-apache2-module
|
75
|
-
touch /etc/apache2/mods-available/passenger.load
|
76
|
-
touch /etc/apache2/mods-available/passenger.conf
|
82
|
+
sudo touch /etc/apache2/mods-available/passenger.load
|
83
|
+
sudo touch /etc/apache2/mods-available/passenger.conf
|
77
84
|
|
78
85
|
# -----------------------------------------------------
|
79
86
|
# Node.js related
|
@@ -85,6 +92,5 @@ npm install bower -g
|
|
85
92
|
# Restart stuff
|
86
93
|
# -----------------------------------------------------
|
87
94
|
|
88
|
-
|
89
95
|
sudo service apache2 restart
|
90
96
|
sudo /etc/init.d/php5-fpm restart
|
@@ -125,6 +125,10 @@ if (!defined('SS_SITE_DATABASE_NAME')) define('SS_SITE_DATABASE_NAME', $database
|
|
125
125
|
//jpeg quality
|
126
126
|
Config::inst()->update('GDBackend', 'default_quality', 80);
|
127
127
|
|
128
|
+
// block the default page build
|
129
|
+
SiteTree::set_create_default_pages(false);
|
130
|
+
Config::inst()->update('SiteTree', 'create_default_pages', false);
|
131
|
+
|
128
132
|
|
129
133
|
// --------------------------------- //
|
130
134
|
// Assets
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?php
|
2
|
+
class HomePage extends RootPage {
|
3
|
+
|
4
|
+
private static $can_be_root = true;
|
5
|
+
|
6
|
+
private static $db = array(
|
7
|
+
);
|
8
|
+
|
9
|
+
}
|
10
|
+
|
11
|
+
class HomePage_Controller extends RootPage_Controller {
|
12
|
+
|
13
|
+
private static $allowed_actions = array (
|
14
|
+
);
|
15
|
+
|
16
|
+
public function init() {
|
17
|
+
parent::init();
|
18
|
+
}
|
19
|
+
|
20
|
+
}
|
@@ -3,7 +3,7 @@ class Page extends SiteTree {
|
|
3
3
|
|
4
4
|
protected static $page_cache = array();
|
5
5
|
|
6
|
-
private static $can_be_root =
|
6
|
+
private static $can_be_root = false;
|
7
7
|
|
8
8
|
private static $db = array(
|
9
9
|
);
|
@@ -50,26 +50,56 @@ class Page extends SiteTree {
|
|
50
50
|
$do->Paginator = $do->DataSet->Paginator->dataForTemplate($do->DataSet->unlimitedRowCount, 2, null, $hitsOptions);
|
51
51
|
$do->HitsSelector = $do->Paginator->HitsSelector;
|
52
52
|
return $do;
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Add default records to database.
|
57
|
+
*
|
58
|
+
* This function is called whenever the database is built, after the
|
59
|
+
* database tables have all been created. Overload this to add default
|
60
|
+
* records when the database is built, but make sure you call
|
61
|
+
* parent::requireDefaultRecords().
|
62
|
+
*/
|
63
|
+
public function requireDefaultRecords() {
|
64
|
+
|
65
|
+
|
66
|
+
if(!SiteTree::get_by_link(Config::inst()->get('RootURLController', 'default_homepage_link'))) {
|
67
|
+
$homepage = new HomePage;
|
68
|
+
$homepage->Title = 'Home';
|
69
|
+
$homepage->URLSegment = Config::inst()->get('RootURLController', 'default_homepage_link');
|
70
|
+
$homepage->Sort = 1;
|
71
|
+
$homepage->write();
|
72
|
+
$homepage->publish('Stage', 'Live');
|
73
|
+
$homepage->flushCache();
|
74
|
+
DB::alteration_message('Home page created', 'created');
|
75
|
+
}
|
76
|
+
|
77
|
+
if(DB::query("SELECT COUNT(*) FROM \"SiteTree\"")->value() == 1) {
|
78
|
+
$aboutus = new RootPage;
|
79
|
+
$aboutus->Title = 'About Us';
|
80
|
+
$aboutus->Sort = 2;
|
81
|
+
$aboutus->write();
|
82
|
+
$aboutus->publish('Stage', 'Live');
|
83
|
+
$aboutus->flushCache();
|
84
|
+
DB::alteration_message('Book 1 created', 'created');
|
85
|
+
|
86
|
+
$contactus = new RootPage;
|
87
|
+
$contactus->Title = 'Contact Us';
|
88
|
+
$contactus->Sort = 3;
|
89
|
+
$contactus->write();
|
90
|
+
$contactus->publish('Stage', 'Live');
|
91
|
+
$contactus->flushCache();
|
92
|
+
DB::alteration_message('Book 2 created', 'created');
|
93
|
+
}
|
94
|
+
|
95
|
+
// call it on the parent
|
96
|
+
parent::requireDefaultRecords();
|
53
97
|
}
|
54
98
|
|
99
|
+
|
55
100
|
}
|
56
101
|
class Page_Controller extends ContentController {
|
57
102
|
|
58
|
-
/**
|
59
|
-
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
|
60
|
-
* permissions or conditions required to allow the user to access it.
|
61
|
-
*
|
62
|
-
* <code>
|
63
|
-
* array (
|
64
|
-
* 'action', // anyone can access this action
|
65
|
-
* 'action' => true, // same as above
|
66
|
-
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
|
67
|
-
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
|
68
|
-
* );
|
69
|
-
* </code>
|
70
|
-
*
|
71
|
-
* @var array
|
72
|
-
*/
|
73
103
|
private static $allowed_actions = array (
|
74
104
|
);
|
75
105
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?php
|
2
|
+
class RootPage extends Page {
|
3
|
+
|
4
|
+
private static $can_be_root = true;
|
5
|
+
|
6
|
+
private static $db = array(
|
7
|
+
);
|
8
|
+
|
9
|
+
}
|
10
|
+
|
11
|
+
class RootPage_Controller extends Page_Controller {
|
12
|
+
|
13
|
+
private static $allowed_actions = array (
|
14
|
+
);
|
15
|
+
|
16
|
+
public function init() {
|
17
|
+
parent::init();
|
18
|
+
}
|
19
|
+
|
20
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bonethug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.59
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -407,7 +407,9 @@ files:
|
|
407
407
|
- skel/project_types/silverstripe3/public/project/code/Extensions/.gitkeep
|
408
408
|
- skel/project_types/silverstripe3/public/project/code/Forms/.gitkeep
|
409
409
|
- skel/project_types/silverstripe3/public/project/code/Objects/.gitkeep
|
410
|
+
- skel/project_types/silverstripe3/public/project/code/Pages/HomePage.php
|
410
411
|
- skel/project_types/silverstripe3/public/project/code/Pages/Page.php
|
412
|
+
- skel/project_types/silverstripe3/public/project/code/Pages/RootPage.php
|
411
413
|
- skel/project_types/silverstripe3/public/project/code/Tasks/.gitkeep
|
412
414
|
- skel/project_types/silverstripe3/public/project/coffee/application.js.coffee
|
413
415
|
- skel/project_types/silverstripe3/public/project/javascript/.gitkeep
|