marv 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/CHANGELOG.md +58 -52
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +7 -7
  4. data/VERSION +1 -1
  5. data/layouts/config/router.php.erb +25 -0
  6. data/layouts/plugin/functions/plugin.php.erb +94 -0
  7. data/layouts/{default → plugin}/images/screenshot.png +0 -0
  8. data/layouts/{bramble → plugin}/javascripts/admin.coffee +0 -0
  9. data/layouts/{bramble → plugin}/javascripts/admin.js +0 -0
  10. data/layouts/{bramble/javascripts/theme.coffee → plugin/javascripts/plugin.coffee} +0 -0
  11. data/layouts/{bramble/javascripts/theme.js → plugin/javascripts/plugin.js} +0 -0
  12. data/layouts/plugin/stylesheets/plugin.scss +1 -0
  13. data/layouts/{default → theme}/functions/functions.php.erb +0 -0
  14. data/layouts/theme/images/screenshot.png +0 -0
  15. data/layouts/{default → theme}/includes/filters-admin.php.erb +0 -0
  16. data/layouts/{default → theme}/includes/filters.php.erb +0 -0
  17. data/layouts/{default → theme}/includes/helpers.php.erb +0 -0
  18. data/layouts/{default → theme}/javascripts/admin.coffee +0 -0
  19. data/layouts/{default → theme}/javascripts/admin.js +0 -0
  20. data/layouts/{default → theme}/javascripts/theme.coffee +0 -0
  21. data/layouts/{default → theme}/javascripts/theme.js +0 -0
  22. data/layouts/{default → theme}/stylesheets/_header.scss.erb +0 -0
  23. data/layouts/{bramble → theme}/stylesheets/style.scss.erb +0 -0
  24. data/layouts/{default → theme}/templates/404.php.erb +0 -0
  25. data/layouts/{default → theme}/templates/archive.php.erb +0 -0
  26. data/layouts/{default → theme}/templates/author.php.erb +0 -0
  27. data/layouts/{default → theme}/templates/footer.php +0 -0
  28. data/layouts/{default → theme}/templates/header.php +0 -0
  29. data/layouts/{default → theme}/templates/index.php +0 -0
  30. data/layouts/{default → theme}/templates/page.php +0 -0
  31. data/layouts/{default → theme}/templates/partials/comments.php.erb +0 -0
  32. data/layouts/{default → theme}/templates/partials/content-none.php.erb +0 -0
  33. data/layouts/{default → theme}/templates/partials/content-page.php +0 -0
  34. data/layouts/{default → theme}/templates/partials/content-single.php +0 -0
  35. data/layouts/{default → theme}/templates/partials/content.php.erb +0 -0
  36. data/layouts/{default → theme}/templates/partials/searchform.php.erb +0 -0
  37. data/layouts/{default → theme}/templates/partials/sidebar.php +0 -0
  38. data/layouts/{default → theme}/templates/search.php.erb +0 -0
  39. data/layouts/{default → theme}/templates/single.php +0 -0
  40. data/lib/marv/builder.rb +1 -1
  41. data/lib/marv/cli.rb +5 -5
  42. data/lib/marv/server.rb +65 -79
  43. data/marv.gemspec +44 -45
  44. metadata +57 -45
  45. data/layouts/bramble/functions/functions.php.erb +0 -112
  46. data/layouts/bramble/images/screenshot.png +0 -0
  47. data/layouts/bramble/includes/options.php.erb +0 -1339
  48. data/layouts/bramble/stylesheets/_header.scss.erb +0 -16
  49. data/layouts/bramble/templates/sample-template.php +0 -25
  50. data/layouts/config/rack-config.ru +0 -38
  51. data/layouts/default/stylesheets/style.scss.erb +0 -4
  52. data/lib/marv/version.rb +0 -3
@@ -1,52 +1,58 @@
1
- == 0.3.1 ==
2
- - Remove command servers
3
- - Add option --list to server command
4
- - Remove option --create from server command
5
- - Add option --start to server command
6
- - Remove marv link options except --folder
7
- - Link projects by default to global folders
8
-
9
- == 0.3.0 ==
10
- - Marv server (Wordpress local install)
11
- - Global plugins & themes for Marv servers
12
- - Config.rb option for additional assets
13
- - Use local layouts on project on create
14
- - Copy user folders in project root
15
- - Copy file with project name from functions folder
16
- - Informative error messages
17
- - Remove extras folder
18
- - Update dependencies
19
- - Update config templates
20
- - Many new functions & function updates
21
-
22
- == 0.2.5 ==
23
- - Remove compass, sprockets-sass and yui-compressor
24
- - Better error reporting in pry
25
- - Add uglifier
26
- - Remove unused functions
27
-
28
- == 0.2.4 ==
29
- - Update compass version
30
-
31
- == 0.2.3 ==
32
- - Fix marv global settings folder name
33
- - Remove ie.css
34
- - Add admin.css
35
- - Fix errors on build
36
-
37
- == 0.2.2 ==
38
- - Add support for layouts on marv create
39
- - Bramble Framework child theme project layout
40
- - Optimize images
41
-
42
- == 0.2.1 ==
43
- - New default project layout
44
-
45
- == 0.2.0 ==
46
- - Fix errors
47
-
48
- == 0.1.0 ==
49
- - Fork from Forge (https://github.com/thethemefoundry/forge)
50
- - Update dependencies
51
- - Fix errors from old dependencies
52
- - Add extras folder
1
+ ## v0.3.2
2
+ * Fix bug when creating server
3
+ * Use Thor to download wordpress
4
+ * Fix marv watch not compiling assets
5
+ * Fix error when compression enabled
6
+
7
+ ## v0.3.1
8
+ * Remove command servers
9
+ * Add option --list to server command
10
+ * Remove option --create from server command
11
+ * Add option --start to server command
12
+ * Remove marv link options except --folder
13
+ * Link projects by default to global folders
14
+
15
+ ## v0.3.0
16
+ * Marv server (Wordpress local install)
17
+ * Global plugins & themes for Marv servers
18
+ * Config.rb option for additional assets
19
+ * Use local layouts on project on create
20
+ * Copy user folders in project root
21
+ * Copy file with project name from functions folder
22
+ * Informative error messages
23
+ * Remove extras folder
24
+ * Update dependencies
25
+ * Update config templates
26
+ * Many new functions & function updates
27
+
28
+ ## v0.2.5
29
+ * Remove compass, sprockets-sass and yui-compressor
30
+ * Better error reporting in pry
31
+ * Add uglifier
32
+ * Remove unused functions
33
+
34
+ ## v0.2.4
35
+ * Update compass version
36
+
37
+ ## v0.2.3
38
+ * Fix marv global settings folder name
39
+ * Remove ie.css
40
+ * Add admin.css
41
+ * Fix errors on build
42
+
43
+ ## v0.2.2
44
+ * Add support for layouts on marv create
45
+ * Bramble Framework child theme project layout
46
+ * Optimize images
47
+
48
+ ## v0.2.1
49
+ * New default project layout
50
+
51
+ ## v0.2.0
52
+ * Fix errors
53
+
54
+ ## v0.1.0
55
+ * Fork from Forge (https://github.com/thethemefoundry/forge)
56
+ * Update dependencies
57
+ * Fix errors from old dependencies
58
+ * Add extras folder
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ gem 'thor', '>= 0.19.1'
5
5
  gem 'guard-livereload', '>= 2.3.0'
6
6
  gem 'sprockets', '>= 2.12.0'
7
7
  gem 'rubyzip', '>= 1.1.6'
8
- gem 'rack-legacy', '>= 1.0.0'
8
+ gem 'childprocess', '>= 0.3.5'
9
9
  gem 'mysql2', '>= 0.3.15'
10
10
  gem 'sass', '>= 3.3.0'
11
11
  gem 'less', '>= 2.6.0'
@@ -19,6 +19,7 @@ gem 'uglifier', '>= 2.5.0'
19
19
  group :development do
20
20
  gem 'rake'
21
21
  gem 'rspec'
22
+ gem 'aruba'
22
23
  gem 'cucumber'
23
24
  gem 'jeweler'
24
25
  end
@@ -2,6 +2,11 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  addressable (2.3.6)
5
+ aruba (0.4.11)
6
+ childprocess (>= 0.2.3)
7
+ cucumber (>= 1.1.1)
8
+ ffi (>= 1.0.11)
9
+ rspec (>= 2.7.0)
5
10
  builder (3.2.2)
6
11
  celluloid (0.15.2)
7
12
  timers (~> 1.1.0)
@@ -95,12 +100,6 @@ GEM
95
100
  method_source (~> 0.8.1)
96
101
  slop (~> 3.4)
97
102
  rack (1.5.2)
98
- rack-legacy (1.0.0)
99
- childprocess
100
- rack
101
- rack-reverse-proxy
102
- rack-reverse-proxy (0.4.4)
103
- rack (>= 1.0.0)
104
103
  rake (10.3.2)
105
104
  rb-fsevent (0.9.4)
106
105
  rb-inotify (0.9.5)
@@ -143,13 +142,14 @@ PLATFORMS
143
142
  ruby
144
143
 
145
144
  DEPENDENCIES
145
+ aruba
146
+ childprocess (>= 0.3.5)
146
147
  coffee-script (>= 2.3.0)
147
148
  cucumber
148
149
  guard-livereload (>= 2.3.0)
149
150
  jeweler
150
151
  less (>= 2.6.0)
151
152
  mysql2 (>= 0.3.15)
152
- rack-legacy (>= 1.0.0)
153
153
  rake
154
154
  rspec
155
155
  rubyzip (>= 1.1.6)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -0,0 +1,25 @@
1
+ <?php
2
+
3
+ $root = $_SERVER['DOCUMENT_ROOT'];
4
+ chdir( $root );
5
+
6
+ $path = '/'. ltrim( parse_url( $_SERVER['REQUEST_URI'] )['path'], '/' );
7
+ set_include_path( get_include_path() .':'. __DIR__ );
8
+
9
+ if( file_exists( $root.$path ) ) {
10
+
11
+ if( is_dir( $root.$path ) && substr( $path, strlen( $path ) - 1, 1 ) !== '/' ) {
12
+ $path = rtrim( $path, '/' ) .'/index.php';
13
+ }
14
+
15
+ if( strpos( $path, '.php' ) === false ) {
16
+ return false;
17
+ }
18
+ else {
19
+ chdir( dirname( $root.$path ) );
20
+ require_once $root.$path;
21
+ }
22
+ }
23
+ else {
24
+ include_once 'index.php';
25
+ }
@@ -0,0 +1,94 @@
1
+ <?php
2
+ /**
3
+ * Plugin Name: <%= config[:name].capitalize %>
4
+ * Plugin URI: <%= config[:uri] %>
5
+ * Description: <%= config[:name].capitalize %> plugin created with Marv.
6
+ * Version: 0.1
7
+ * Author: <%= config[:author] %>
8
+ * Author URI: <%= config[:author_uri] %>
9
+ * License: GPL2
10
+ */
11
+
12
+ // Block direct access
13
+ if( ! defined( 'ABSPATH' ) ) exit;
14
+
15
+
16
+ /**
17
+ * Enqueue scripts and styles.
18
+ */
19
+ function <%= project_id %>_styles_scripts()
20
+ {
21
+ // Styles
22
+ add_action( 'wp_enqueue_scripts', '<%= project_id %>_register_styles' );
23
+ add_action( 'wp_enqueue_scripts', '<%= project_id %>_enqueue_styles' );
24
+
25
+ // Scripts
26
+ add_action( 'wp_enqueue_scripts', '<%= project_id %>_register_scripts' );
27
+ add_action( 'wp_enqueue_scripts', '<%= project_id %>_enqueue_scripts' );
28
+
29
+ // Admin scripts
30
+ add_action( 'admin_enqueue_scripts', '<%= project_id %>_register_admin_scripts' );
31
+ add_action( 'admin_enqueue_scripts', '<%= project_id %>_enqueue_admin_scripts' );
32
+ }
33
+
34
+ add_action( 'init', '<%= project_id %>_styles_scripts' );
35
+
36
+ /**
37
+ * Register styles.
38
+ */
39
+ function <%= project_id %>_register_styles()
40
+ {
41
+ // Theme
42
+ wp_register_style( 'plugin', get_stylesheet_directory_uri() . '/plugin.css', '', '', 'screen' );
43
+ }
44
+
45
+ /**
46
+ * Enqueue styles.
47
+ */
48
+ function <%= project_id %>_enqueue_styles()
49
+ {
50
+ wp_enqueue_style( 'plugin' );
51
+ }
52
+
53
+ /**
54
+ * Register scripts
55
+ */
56
+ function <%= project_id %>_register_scripts()
57
+ {
58
+ // Theme
59
+ wp_register_script( 'plugin', get_stylesheet_directory_uri() . '/javascripts/plugin.js', array( 'jquery' ), '', true );
60
+ }
61
+
62
+ /**
63
+ * Enqueue scripts
64
+ */
65
+ function <%= project_id %>_enqueue_scripts()
66
+ {
67
+ wp_enqueue_script( 'plugin' );
68
+
69
+ if ( is_singular() && get_option( 'thread_comments' ) ) {
70
+ wp_enqueue_script( 'comment-reply' );
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Register admin scripts
76
+ */
77
+ function <%= project_id %>_register_admin_scripts()
78
+ {
79
+ // Admin
80
+ wp_register_script( 'admin', get_stylesheet_directory_uri() . '/javascripts/admin.js', array( 'jquery' ), '', true );
81
+ }
82
+
83
+ /**
84
+ * Enqueue admin scripts
85
+ */
86
+ function <%= project_id %>_enqueue_admin_scripts()
87
+ {
88
+ wp_enqueue_script( 'admin' );
89
+ }
90
+
91
+ /**
92
+ * Allow automatic updates
93
+ */
94
+ add_filter( 'automatic_updates_is_vcs_checkout', '__return_false' );
@@ -0,0 +1 @@
1
+ // This is your master stylesheet
@@ -22,10 +22,10 @@ module Marv
22
22
  # Runs all the methods necessary to build a completed project
23
23
  def build
24
24
  clean_build_directory
25
+ copy_folders
25
26
  copy_templates
26
27
  copy_functions
27
28
  copy_includes
28
- copy_folders
29
29
  build_assets
30
30
  end
31
31
 
@@ -16,8 +16,8 @@ module Marv
16
16
 
17
17
  desc "create DIRECTORY", "Creates a Marv project into specified directory"
18
18
  long_desc "Creates a new project. Use the layout option to choose a scaffold"
19
- method_option :layout, :type => :string, :default => 'default', :desc => "Name of alternate layout"
20
- method_option :local, :type => :boolean, :force => false, :desc => "Use local layout from .marv folder"
19
+ method_option :layout, :type => :string, :default => 'theme', :enum => %w{theme plugin}, :desc => "Scaffold layout for theme or plugin"
20
+ method_option :local, :type => :boolean, :force => false, :desc => "Use custom layout from ~/.marv/layouts folder"
21
21
  def create(dir)
22
22
  theme = {}
23
23
  theme[:name] = dir
@@ -29,14 +29,14 @@ module Marv
29
29
  long_desc "This command will symlink the compiled version of the project to the specified server or WordPress install path."+
30
30
  "If you don't provide a directory or a server name, the symlink will be created in Marv global themes or plugins folder."
31
31
  method_option :folder, :type => :string, :enum => %w{themes plugins}, :required => true, :desc => "Link Marv project in themes or plugins folfer"
32
- def link(dir='global')
32
+ def link(dir=nil)
33
33
  project = Marv::Project.new('.', self)
34
34
 
35
35
  unless File.directory?(project.build_path)
36
36
  FileUtils.mkdir_p project.build_path
37
37
  end
38
38
 
39
- if dir == 'global'
39
+ if dir.nil?
40
40
  link_project_globaly(options, project)
41
41
  else
42
42
  wp_path = File.join(dir, 'wp-content', options[:folder])
@@ -83,7 +83,7 @@ module Marv
83
83
  builder.zip(filename)
84
84
  end
85
85
 
86
- desc "server SERVER", "Start a Marv server by name"
86
+ desc "server SERVER", "Create a Marv server with the specified name"
87
87
  method_option :list, :type => :boolean, :force => false, :desc => "List all available Marv servers"
88
88
  method_option :start, :type => :boolean, :force => false, :desc => "Create a new Marv server"
89
89
  method_option :stop, :type => :boolean, :force => false, :desc => "Stop a running Marv server"
@@ -1,5 +1,6 @@
1
1
  require 'net/http'
2
2
  require 'mysql2'
3
+ require 'childprocess'
3
4
 
4
5
  module Marv
5
6
  class Server
@@ -10,10 +11,6 @@ module Marv
10
11
  # Deploy variables
11
12
  @server_name = name
12
13
  @server_path = server_path
13
-
14
- @rack_config = rack_config
15
- @wp_config = wp_config
16
-
17
14
  @db_name = 'marv_'+name.gsub(/\W/, '_').downcase
18
15
 
19
16
  # CLI Options
@@ -39,14 +36,6 @@ module Marv
39
36
  File.join(ENV['HOME'], '.marv', 'servers', @server_name)
40
37
  end
41
38
 
42
- def rack_config
43
- File.join(ENV['HOME'], '.marv', @server_path, 'config.ru')
44
- end
45
-
46
- def wp_config
47
- File.join(ENV['HOME'], '.marv', @server_path, 'wp-config.php')
48
- end
49
-
50
39
  def db_name
51
40
  @db_name
52
41
  end
@@ -59,15 +48,33 @@ module Marv
59
48
  @db_host
60
49
  end
61
50
 
51
+ def run_php_server
52
+ # Setup server
53
+ server = TCPServer.new('127.0.0.1', 0)
54
+ port = server.addr[1]
55
+ server.close()
56
+
57
+ # Run PHP server
58
+ ::Dir.chdir @server_path
59
+ @php = ChildProcess.build 'php', '-S', "localhost:#{port}", 'router.php'
60
+ @php.start
61
+
62
+ # Write PHP proccess id to file
63
+ File.open(File.join(@server_path, 'php.pid'), 'w') do |file|
64
+ file.write(@php.pid)
65
+ end
66
+
67
+ @task.say "Visit http://localhost:#{port}"
68
+ end
69
+
62
70
  def create_server
63
71
  create_server_directory
64
72
 
65
- download_wordpress
66
- extract_wordpress
67
- add_rack_config
73
+ copy_wordpress_files
74
+ add_config_file('router.php.erb', 'router.php')
68
75
 
69
76
  create_server_database
70
- add_wordpress_config
77
+ add_config_file('wp-config.php.erb', 'wp-config.php')
71
78
 
72
79
  add_global_content
73
80
 
@@ -77,12 +84,9 @@ module Marv
77
84
  end
78
85
 
79
86
  def start_server
80
- update_global_projects
81
-
82
87
  begin
83
- @task.shell.mute do
84
- system("cd #{server_path}; rackup --daemonize --pid=ruby.pid")
85
- end
88
+ update_global_projects
89
+ run_php_server
86
90
  rescue Exception => e
87
91
  @task.say "Error while starting server:"
88
92
  @task.say e.message + "\n", :red
@@ -93,14 +97,12 @@ module Marv
93
97
  def stop_server
94
98
  begin
95
99
  @task.shell.mute do
96
- ruby_pid_file = File.join(@server_path, 'ruby.pid')
97
100
  php_pid_file = File.join(@server_path, 'php.pid')
98
101
 
99
- if File.exist?(ruby_pid_file) && File.exist?(php_pid_file) then
100
- ruby_pid = File.read(ruby_pid_file).to_i
102
+ if File.exists?(php_pid_file)
101
103
  php_pid = File.read(php_pid_file).to_i
102
104
 
103
- Process.kill(9, ruby_pid, php_pid)
105
+ Process.kill('KILL', php_pid)
104
106
  @task.say "Server #{@server_name} stopped", :yellow
105
107
  else
106
108
  @task.say "Server #{@server_name} is not running", :red
@@ -142,79 +144,66 @@ module Marv
142
144
 
143
145
  private
144
146
 
147
+ # Creates a directory for a new server
145
148
  def create_server_directory
146
- unless File.exist?(self.servers_root)
147
- Dir.mkdir(servers_root)
149
+ # Create dir
150
+ unless ::File.exist?(self.servers_root)
151
+ ::Dir.mkdir(servers_root)
148
152
  end
149
-
150
- if File.exist?(@server_path)
153
+ # Exit if dir exists
154
+ if ::File.exist?(@server_path)
151
155
  @task.say "A server with name #{@server_name} already exists", :red
152
156
  exit
153
157
  end
154
158
  end
155
159
 
160
+ # Downloads WordPress from wordpress.org
156
161
  def download_wordpress
157
- @task.say "Starting server installation:"
162
+ package = "/tmp/wordpress-#{@wp_version}.tar.gz"
158
163
 
159
- begin
160
- @task.shell.mute do
161
- if !File.exists?("/tmp/wordpress-#{@wp_version}.tar.gz")
162
- @task.say "Downloading wordpress-#{@wp_version}.tar.gz..."
163
-
164
- Net::HTTP.start('wordpress.org') do |http|
165
- resp = http.get("/wordpress-#{@wp_version}.tar.gz")
166
- open("/tmp/wordpress-#{@wp_version}.tar.gz", 'w') do |file|
167
- file.write(resp.body)
168
- end
169
- end
164
+ # Download package file
165
+ @task.shell.mute do
166
+ unless ::File.exists?(package)
167
+ @task.get "https://wordpress.org/wordpress-#{@wp_version}.tar.gz" do |content|
168
+ @task.create_file package, content
170
169
  end
171
170
  end
172
- rescue Exception => e
173
- @task.say "Error while downloading wordpress-#{@wp_version}.tar.gz:"
174
- @task.say e.message + "\n", :red
175
- exit
176
171
  end
177
- end
178
172
 
179
- def extract_wordpress
180
- begin
181
- @task.shell.mute do
182
- filestamp = Time.now.to_i
183
- download_location = File.join('/tmp', "wordpress-#{@wp_version}.tar.gz")
184
- tmp_dir = "/tmp/wordpress-latest-#{filestamp}"
173
+ # Return package file
174
+ package
175
+ end
185
176
 
186
- Dir.mkdir(tmp_dir)
187
- `cd #{tmp_dir}; tar -xzf #{download_location}`
177
+ # Copy WordPress files
178
+ def copy_wordpress_files
179
+ package = download_wordpress
188
180
 
189
- FileUtils.mv("#{tmp_dir}/wordpress", @server_path)
190
- FileUtils.rm_r(tmp_dir)
191
- end
192
- rescue Exception => e
193
- @task.say "Error while extracting wordpress-#{@wp_version}.tar.gz:"
194
- @task.say e.message + "\n", :red
195
- exit
181
+ # Get package content and extract to dir
182
+ tmp_dir = "/tmp/wordpress-latest-#{Time.now.to_i}"
183
+ # Create temporary dir
184
+ unless ::File.exists?(tmp_dir)
185
+ Dir.mkdir(tmp_dir)
196
186
  end
197
- @task.say "WordPress files created", :green
198
- end
199
187
 
200
- def add_wordpress_config
201
- unless File.exists?(@wp_config)
202
- wp_config = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'layouts', 'config', 'wp-config.php.erb'))
203
- wp_config_template = ERB.new(::File.binread(wp_config), nil, '-', '@output_buffer')
188
+ # Extract package to temporary dir
189
+ @task.shell.mute do
190
+ @task.run "cd #{tmp_dir};tar -xzf #{package}"
191
+ @task.directory "#{tmp_dir}/wordpress", @server_path
192
+ end
204
193
 
205
- File.open(File.join(@server_path, 'wp-config.php'), 'w') do |file|
206
- file.write(wp_config_template.result(binding))
207
- end
194
+ # Remove temporary dir
195
+ if ::File.exists?(tmp_dir)
196
+ FileUtils.rm_r(tmp_dir)
208
197
  end
209
198
  end
210
199
 
211
- def add_rack_config
212
- unless File.exists?(@rack_config)
213
- config_wp = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'layouts', 'config', 'rack-config.ru'))
214
- config_ru_template = ERB.new(::File.binread(config_wp), nil, '-', '@output_buffer')
200
+ def add_config_file(source, target)
201
+ unless File.exists?(target)
202
+ config = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'layouts', 'config', source))
203
+ config_template = ERB.new(::File.binread(config), nil, '-', '@output_buffer')
215
204
 
216
- File.open(File.join(@server_path, 'config.ru'), 'w') do |file|
217
- file.write(config_ru_template.result(binding))
205
+ File.open(File.join(@server_path, target), 'w') do |file|
206
+ file.write(config_template.result(binding))
218
207
  end
219
208
  end
220
209
  end
@@ -233,12 +222,10 @@ module Marv
233
222
  @task.say e.message + "\n", :red
234
223
  exit
235
224
  end
236
- @task.say "Mysql database created", :green
237
225
  end
238
226
 
239
227
  def remove_server_database
240
228
  begin
241
- @task.say "Removing Mysql database..."
242
229
  @task.shell.mute do
243
230
  client = Mysql2::Client.new(:host => @db_host, :port => @db_port, :username => @db_user, :password => @db_password)
244
231
  client.query("DROP DATABASE IF EXISTS #{@db_name}")
@@ -250,7 +237,6 @@ module Marv
250
237
  @task.say "Error while removing Mysql database:"
251
238
  @task.say e.message + "\n", :red
252
239
  end
253
- @task.say "Mysql database removed", :green
254
240
  end
255
241
 
256
242
  def add_global_content