marv 0.2.5 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/.rspec +1 -0
  2. data/CHANGELOG.md +13 -0
  3. data/Gemfile +3 -4
  4. data/Gemfile.lock +70 -28
  5. data/LICENSE +24 -0
  6. data/Rakefile +7 -1
  7. data/VERSION +1 -1
  8. data/layouts/bramble/functions/functions.php.erb +12 -12
  9. data/layouts/bramble/includes/options.php.erb +4 -4
  10. data/layouts/config/{config.tt → project-config.rb} +4 -1
  11. data/layouts/config/rack-config.ru +38 -0
  12. data/layouts/config/wp-config.php.erb +105 -0
  13. data/layouts/default/functions/functions.php.erb +25 -25
  14. data/layouts/default/includes/filters-admin.php.erb +8 -8
  15. data/layouts/default/includes/filters.php.erb +11 -11
  16. data/layouts/default/includes/helpers.php.erb +1 -1
  17. data/layouts/default/templates/404.php.erb +2 -2
  18. data/layouts/default/templates/archive.php.erb +5 -5
  19. data/layouts/default/templates/author.php.erb +1 -1
  20. data/layouts/default/templates/partials/comments.php.erb +8 -8
  21. data/layouts/default/templates/partials/content-none.php.erb +3 -3
  22. data/layouts/default/templates/partials/content.php.erb +2 -2
  23. data/layouts/default/templates/partials/searchform.php.erb +3 -3
  24. data/layouts/default/templates/search.php.erb +2 -2
  25. data/lib/guard/marv/assets.rb +11 -3
  26. data/lib/guard/marv/config.rb +2 -0
  27. data/lib/guard/marv/folders.rb +37 -0
  28. data/lib/guard/marv/functions.rb +13 -9
  29. data/lib/guard/marv/templates.rb +12 -3
  30. data/lib/marv.rb +1 -0
  31. data/lib/marv/builder.rb +49 -15
  32. data/lib/marv/cli.rb +135 -10
  33. data/lib/marv/engines.rb +3 -1
  34. data/lib/marv/generator.rb +13 -8
  35. data/lib/marv/guard.rb +4 -1
  36. data/lib/marv/project.rb +18 -10
  37. data/lib/marv/server.rb +301 -0
  38. data/lib/marv/version.rb +1 -1
  39. data/marv.gemspec +18 -16
  40. data/spec/lib/marv/project_spec.rb +3 -4
  41. metadata +27 -38
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ == 0.3.0 ==
2
+ - Marv server (Wordpress local install)
3
+ - Global plugins & themes for Marv servers
4
+ - Config.rb option for additional assets
5
+ - Use local layouts on project on create
6
+ - Copy user folders in project root
7
+ - Copy file with project name from functions folder
8
+ - Informative error messages
9
+ - Remove extras folder
10
+ - Update dependencies
11
+ - Update config templates
12
+ - Many new functions & function updates
13
+
1
14
  == 0.2.5 ==
2
15
  - Remove compass, sprockets-sass and yui-compressor
3
16
  - Better error reporting in pry
data/Gemfile CHANGED
@@ -2,23 +2,22 @@ source 'http://rubygems.org'
2
2
  # Add dependencies required to use your gem here.
3
3
 
4
4
  gem 'thor', '>= 0.19.1'
5
- gem 'guard', '>= 2.2.1'
6
5
  gem 'guard-livereload', '>= 2.3.0'
7
6
  gem 'sprockets', '>= 2.12.0'
8
7
  gem 'rubyzip', '>= 1.1.6'
9
- gem 'rack', '>= 1.5.2'
8
+ gem 'rack-legacy', '>= 1.0.0'
9
+ gem 'mysql2', '>= 0.3.15'
10
10
  gem 'sass', '>= 3.3.0'
11
11
  gem 'less', '>= 2.6.0'
12
12
  gem 'coffee-script', '>= 2.3.0'
13
13
  gem 'therubyracer', '>= 0.12.0'
14
- gem 'rb-fsevent', '>= 0.9.4'
15
14
  gem 'uglifier', '>= 2.5.0'
16
15
 
17
16
  # Add dependencies to develop your gem here.
18
17
  # Include everything needed to run rake, tests, features, etc.
19
18
  group :development do
19
+ gem 'rake'
20
20
  gem 'rspec'
21
21
  gem 'cucumber'
22
- gem 'aruba'
23
22
  gem 'jeweler'
24
23
  end
data/Gemfile.lock CHANGED
@@ -1,12 +1,8 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- aruba (0.4.11)
5
- childprocess (>= 0.2.3)
6
- cucumber (>= 1.1.1)
7
- ffi (>= 1.0.11)
8
- rspec (>= 2.7.0)
9
- builder (3.0.4)
4
+ addressable (2.3.6)
5
+ builder (3.2.2)
10
6
  celluloid (0.15.2)
11
7
  timers (~> 1.1.0)
12
8
  childprocess (0.3.5)
@@ -17,22 +13,35 @@ GEM
17
13
  execjs
18
14
  coffee-script-source (1.7.1)
19
15
  commonjs (0.2.7)
20
- cucumber (1.2.1)
16
+ cucumber (1.3.16)
21
17
  builder (>= 2.1.2)
22
18
  diff-lcs (>= 1.1.3)
23
- gherkin (~> 2.11.0)
24
- json (>= 1.4.6)
25
- diff-lcs (1.1.3)
19
+ gherkin (~> 2.12)
20
+ multi_json (>= 1.7.5, < 2.0)
21
+ multi_test (>= 0.1.1)
22
+ descendants_tracker (0.0.4)
23
+ thread_safe (~> 0.3, >= 0.3.1)
24
+ diff-lcs (1.2.5)
26
25
  em-websocket (0.5.1)
27
26
  eventmachine (>= 0.12.9)
28
27
  http_parser.rb (~> 0.6.0)
29
28
  eventmachine (1.0.3)
30
29
  execjs (2.2.1)
30
+ faraday (0.9.0)
31
+ multipart-post (>= 1.2, < 3)
31
32
  ffi (1.9.3)
32
33
  formatador (0.2.5)
33
- gherkin (2.11.1)
34
- json (>= 1.4.6)
35
- git (1.2.5)
34
+ gherkin (2.12.2)
35
+ multi_json (~> 1.3)
36
+ git (1.2.8)
37
+ github_api (0.12.1)
38
+ addressable (~> 2.3)
39
+ descendants_tracker (~> 0.0.4)
40
+ faraday (~> 0.8, < 0.10)
41
+ hashie (>= 3.2)
42
+ multi_json (>= 1.7.5, < 2.0)
43
+ nokogiri (~> 1.6.3)
44
+ oauth2
36
45
  guard (2.6.1)
37
46
  formatador (>= 0.2.4)
38
47
  listen (~> 2.7)
@@ -43,13 +52,21 @@ GEM
43
52
  em-websocket (~> 0.5)
44
53
  guard (~> 2.0)
45
54
  multi_json (~> 1.8)
55
+ hashie (3.3.1)
56
+ highline (1.6.21)
46
57
  hike (1.2.3)
47
58
  http_parser.rb (0.6.0)
48
- jeweler (1.6.4)
49
- bundler (~> 1.0)
59
+ jeweler (2.0.1)
60
+ builder
61
+ bundler (>= 1.0)
50
62
  git (>= 1.2.5)
63
+ github_api
64
+ highline (>= 1.6.15)
65
+ nokogiri (>= 1.5.10)
51
66
  rake
67
+ rdoc
52
68
  json (1.8.1)
69
+ jwt (1.0.0)
53
70
  less (2.6.0)
54
71
  commonjs (~> 0.2.7)
55
72
  libv8 (3.16.14.3)
@@ -59,25 +76,50 @@ GEM
59
76
  rb-inotify (>= 0.9)
60
77
  lumberjack (1.0.9)
61
78
  method_source (0.8.2)
79
+ mini_portile (0.6.0)
62
80
  multi_json (1.10.1)
81
+ multi_test (0.1.1)
82
+ multi_xml (0.5.5)
83
+ multipart-post (2.0.0)
84
+ mysql2 (0.3.16)
85
+ nokogiri (1.6.3.1)
86
+ mini_portile (= 0.6.0)
87
+ oauth2 (1.0.0)
88
+ faraday (>= 0.8, < 0.10)
89
+ jwt (~> 1.0)
90
+ multi_json (~> 1.3)
91
+ multi_xml (~> 0.5)
92
+ rack (~> 1.2)
63
93
  pry (0.10.0)
64
94
  coderay (~> 1.1.0)
65
95
  method_source (~> 0.8.1)
66
96
  slop (~> 3.4)
67
97
  rack (1.5.2)
68
- rake (0.9.2.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
+ rake (10.3.2)
69
105
  rb-fsevent (0.9.4)
70
106
  rb-inotify (0.9.5)
71
107
  ffi (>= 0.5.0)
108
+ rdoc (4.1.1)
109
+ json (~> 1.4)
72
110
  ref (1.0.5)
73
- rspec (2.11.0)
74
- rspec-core (~> 2.11.0)
75
- rspec-expectations (~> 2.11.0)
76
- rspec-mocks (~> 2.11.0)
77
- rspec-core (2.11.1)
78
- rspec-expectations (2.11.2)
79
- diff-lcs (~> 1.1.3)
80
- rspec-mocks (2.11.2)
111
+ rspec (3.1.0)
112
+ rspec-core (~> 3.1.0)
113
+ rspec-expectations (~> 3.1.0)
114
+ rspec-mocks (~> 3.1.0)
115
+ rspec-core (3.1.1)
116
+ rspec-support (~> 3.1.0)
117
+ rspec-expectations (3.1.0)
118
+ diff-lcs (>= 1.2.0, < 2.0)
119
+ rspec-support (~> 3.1.0)
120
+ rspec-mocks (3.1.0)
121
+ rspec-support (~> 3.1.0)
122
+ rspec-support (3.1.0)
81
123
  rubyzip (1.1.6)
82
124
  sass (3.3.14)
83
125
  slop (3.6.0)
@@ -90,6 +132,7 @@ GEM
90
132
  libv8 (~> 3.16.14.0)
91
133
  ref
92
134
  thor (0.19.1)
135
+ thread_safe (0.3.4)
93
136
  tilt (1.4.1)
94
137
  timers (1.1.0)
95
138
  uglifier (2.5.3)
@@ -100,15 +143,14 @@ PLATFORMS
100
143
  ruby
101
144
 
102
145
  DEPENDENCIES
103
- aruba
104
146
  coffee-script (>= 2.3.0)
105
147
  cucumber
106
- guard (>= 2.2.1)
107
148
  guard-livereload (>= 2.3.0)
108
149
  jeweler
109
150
  less (>= 2.6.0)
110
- rack (>= 1.5.2)
111
- rb-fsevent (>= 0.9.4)
151
+ mysql2 (>= 0.3.15)
152
+ rack-legacy (>= 1.0.0)
153
+ rake
112
154
  rspec
113
155
  rubyzip (>= 1.1.6)
114
156
  sass (>= 3.3.0)
data/LICENSE CHANGED
@@ -1,3 +1,27 @@
1
+ Copyright (c) 2014 Hardpixel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+
23
+ LICENSES FOR PARTS OF THIS SOFTWARE
24
+
1
25
  Copyright (c) 2011 Jestro LLC
2
26
 
3
27
  Permission is hereby granted, free of charge, to any person obtaining
data/Rakefile CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'bundler'
5
+
5
6
  begin
6
7
  Bundler.setup(:default, :development)
7
8
  rescue Bundler::BundlerError => e
@@ -9,9 +10,10 @@ rescue Bundler::BundlerError => e
9
10
  $stderr.puts "Run `bundle install` to install missing gems"
10
11
  exit e.status_code
11
12
  end
12
- require 'rake'
13
13
 
14
+ require 'rake'
14
15
  require 'jeweler'
16
+
15
17
  Jeweler::Tasks.new do |gem|
16
18
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
19
  gem.name = "marv"
@@ -25,10 +27,12 @@ Jeweler::Tasks.new do |gem|
25
27
  # dependencies defined in Gemfile
26
28
  gem.files.include Dir.glob('**/*')
27
29
  end
30
+
28
31
  Jeweler::RubygemsDotOrgTasks.new
29
32
 
30
33
  require 'rspec/core'
31
34
  require 'rspec/core/rake_task'
35
+
32
36
  RSpec::Core::RakeTask.new(:spec) do |spec|
33
37
  spec.pattern = FileList['spec/**/*_spec.rb']
34
38
  end
@@ -39,11 +43,13 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
39
43
  end
40
44
 
41
45
  require 'cucumber/rake/task'
46
+
42
47
  Cucumber::Rake::Task.new(:features)
43
48
 
44
49
  task :default => :spec
45
50
 
46
51
  require 'rdoc/task'
52
+
47
53
  RDoc::Task.new do |rdoc|
48
54
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
55
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.3.0
@@ -6,17 +6,17 @@ if( ! defined( 'ABSPATH' ) ) exit;
6
6
  /**
7
7
  * Init for Bramble Child
8
8
  */
9
- function <%= theme_id %>_init() {
9
+ function <%= project_id %>_init() {
10
10
 
11
11
  // Image sizes
12
12
  add_image_size( 'wide', 1600, 1200, true );
13
13
 
14
14
  // Default settings
15
- <%= theme_id %>_default_settings();
15
+ <%= project_id %>_default_settings();
16
16
 
17
17
  }
18
18
 
19
- add_action( 'bramble_child_init', '<%= theme_id %>_init' );
19
+ add_action( 'bramble_child_init', '<%= project_id %>_init' );
20
20
 
21
21
 
22
22
  /**
@@ -25,7 +25,7 @@ add_action( 'bramble_child_init', '<%= theme_id %>_init' );
25
25
  *
26
26
  **/
27
27
 
28
- function <%= theme_id %>_default_settings()
28
+ function <%= project_id %>_default_settings()
29
29
  {
30
30
  $user = get_option( 'theme_options' );
31
31
 
@@ -57,7 +57,7 @@ function <%= theme_id %>_default_settings()
57
57
  /**
58
58
  * Localize scripts
59
59
  */
60
- function <%= theme_id %>_localize_scripts()
60
+ function <%= project_id %>_localize_scripts()
61
61
  {
62
62
  $localize = array(
63
63
  'ajax_url' => admin_url('admin-ajax.php')
@@ -66,18 +66,18 @@ function <%= theme_id %>_localize_scripts()
66
66
  wp_localize_script( 'theme', 'localize', $localize );
67
67
  }
68
68
 
69
- add_action( 'wp_enqueue_scripts', '<%= theme_id %>_localize_scripts', 99 );
69
+ add_action( 'wp_enqueue_scripts', '<%= project_id %>_localize_scripts', 99 );
70
70
 
71
71
 
72
72
  /**
73
73
  * Enqueue admin scripts
74
74
  */
75
- function <%= theme_id %>_enqueue_admin_scripts()
75
+ function <%= project_id %>_enqueue_admin_scripts()
76
76
  {
77
- wp_enqueue_script( '<%= theme_id %>-admin', get_stylesheet_directory_uri() . '/javascripts/admin.js', array( 'jquery' ), '', true );
77
+ wp_enqueue_script( '<%= project_id %>-admin', get_stylesheet_directory_uri() . '/javascripts/admin.js', array( 'jquery' ), '', true );
78
78
  }
79
79
 
80
- add_action( 'admin_enqueue_scripts', '<%= theme_id %>_enqueue_admin_scripts', 99 );
80
+ add_action( 'admin_enqueue_scripts', '<%= project_id %>_enqueue_admin_scripts', 99 );
81
81
 
82
82
 
83
83
  /**
@@ -91,7 +91,7 @@ include 'includes/options.php';
91
91
  * Theme Settings Page
92
92
  */
93
93
 
94
- function <%= theme_id %>_settings_page( $pages )
94
+ function <%= project_id %>_settings_page( $pages )
95
95
  {
96
96
  $pages[] = array(
97
97
  'page_title' => 'Theme Settings',
@@ -102,11 +102,11 @@ function <%= theme_id %>_settings_page( $pages )
102
102
  'setting' => 'theme_settings',
103
103
  'icon' => 'options-general',
104
104
  'save' => true,
105
- 'save_text' => __( 'Save Theme Settings', '<%= theme_id %>' ),
105
+ 'save_text' => __( 'Save Theme Settings', '<%= project_id %>' ),
106
106
  'default_tab' => 'Theme Settings'
107
107
  );
108
108
 
109
109
  return $pages;
110
110
  }
111
111
 
112
- add_filter('piklist_admin_pages', '<%= theme_id %>_settings_page');
112
+ add_filter('piklist_admin_pages', '<%= project_id %>_settings_page');
@@ -4,14 +4,14 @@
4
4
  * Theme Customizer options
5
5
  */
6
6
 
7
- function <%= theme_id %>_customizer_options() {
7
+ function <%= project_id %>_customizer_options() {
8
8
 
9
9
  /*
10
10
  * Using helper function to get default required capability
11
11
  */
12
12
  $bramble_customizer_capability = bramble_customizer_capability();
13
13
 
14
- $<%= theme_id %>_options = array(
14
+ $<%= project_id %>_options = array(
15
15
 
16
16
  /*
17
17
  * Add fields to an existing Customizer section
@@ -1332,8 +1332,8 @@ function <%= theme_id %>_customizer_options() {
1332
1332
 
1333
1333
  );
1334
1334
 
1335
- return $<%= theme_id %>_options;
1335
+ return $<%= project_id %>_options;
1336
1336
 
1337
1337
  }
1338
1338
 
1339
- add_filter( 'bramble_customizer_options_array', '<%= theme_id %>_customizer_options' );
1339
+ add_filter( 'bramble_customizer_options_array', '<%= project_id %>_customizer_options' );
@@ -9,6 +9,9 @@ config[:compress_css] = false
9
9
  # Enable livereload
10
10
  config[:livereload] = false
11
11
 
12
+ # Additional assets
13
+ # config[:additional_assets] = [['custom.js'], ['stylesheets', 'custom.css'], ['includes', 'javascripts', 'includes.js']]
14
+
12
15
  # You can also include additional Compass frameworks by requiring them:
13
- # require 'boubon'
16
+ # require 'bourbon'
14
17
  # require 'neat'
@@ -0,0 +1,38 @@
1
+ # config.ru for Rackup + Wordpress
2
+
3
+ require 'rack-legacy'
4
+
5
+ module Rack
6
+ module Legacy
7
+ # patch Php from rack-legacy to write pid file and customize server
8
+ class Php
9
+ def initialize app, public_dir=Dir.getwd, php_exe='php', quiet=true
10
+ @app = app; @public_dir = public_dir
11
+ server = TCPServer.new('127.0.0.1', 0)
12
+ port = server.addr[1]
13
+ server.close()
14
+ @proxy = Rack::ReverseProxy.new do
15
+ reverse_proxy_options preserve_host: false
16
+ reverse_proxy /^.*$/, "http://localhost:#{port}"
17
+ end
18
+ @php = ChildProcess.build php_exe,
19
+ '-S', "localhost:#{port}", '-t', public_dir
20
+ @php.io.inherit! unless quiet
21
+ @php.start
22
+ at_exit {@php.stop if @php.alive?}
23
+
24
+ # Write PHP proccess id to file
25
+ ::File.open(::File.join(@public_dir, 'php.pid'), 'w') do |file|
26
+ file.write(@php.pid)
27
+ end
28
+
29
+ puts "Visit http://localhost:#{port}";
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ use Rack::Legacy::Index
36
+ use Rack::Legacy::Php
37
+ use Rack::Legacy::Cgi
38
+ run Rack::File.new Dir.getwd