locomotivecms_wagon 1.0.1 → 1.0.2
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/Rakefile +1 -1
- data/generators/blank/Gemfile.tt +3 -2
- data/generators/bootstrap/Gemfile.tt +3 -2
- data/generators/cloned/Gemfile.tt +21 -0
- data/generators/cloned/app/content_types/.empty_directory +1 -0
- data/generators/cloned/app/views/pages/.empty_directory +1 -0
- data/generators/cloned/app/views/snippets/.empty_directory +1 -0
- data/generators/cloned/config/deploy.yml.tt +4 -0
- data/generators/cloned/config.ru +3 -0
- data/generators/cloned/data/.empty_directory +1 -0
- data/generators/cloned/public/fonts/.empty_directory +1 -0
- data/generators/cloned/public/images/.empty_directory +1 -0
- data/generators/cloned/public/javascripts/.empty_directory +1 -0
- data/generators/cloned/public/samples/.empty_directory +1 -0
- data/generators/cloned/public/stylesheets/.empty_directory +1 -0
- data/generators/foundation/Gemfile.tt +2 -1
- data/generators/foundation/app/views/pages/index.liquid +21 -21
- data/generators/foundation/app/views/pages/index.liquid.haml +19 -20
- data/lib/locomotive/wagon/cli.rb +46 -7
- data/lib/locomotive/wagon/generators/site/cloned.rb +23 -0
- data/lib/locomotive/wagon/generators/site.rb +1 -0
- data/lib/locomotive/wagon/liquid/filters/html.rb +41 -9
- data/lib/locomotive/wagon/version.rb +1 -1
- data/lib/locomotive/wagon.rb +21 -20
- data/locomotivecms_wagon.gemspec +1 -1
- data/spec/fixtures/default/app/views/pages/index.liquid.haml +4 -1
- data/spec/integration/cassettes/push.yml +457 -428
- data/spec/integration/integration_helper.rb +1 -0
- data/spec/integration/server/basic_spec.rb +28 -0
- data/spec/integration/sites_spec.rb +2 -2
- data/spec/support/helpers.rb +1 -1
- metadata +87 -74
data/Rakefile
CHANGED
|
@@ -36,7 +36,7 @@ namespace :development do
|
|
|
36
36
|
|
|
37
37
|
FileUtils.rm_rf(File.join(File.dirname(__FILE__), 'site'))
|
|
38
38
|
VCR.use_cassette('pull') do
|
|
39
|
-
exit unless Locomotive::Wagon.clone('site',
|
|
39
|
+
exit unless Locomotive::Wagon.clone('site', '.', host: 'http://locomotive.engine.dev:3000', email: 'admin@locomotivecms.com', password: 'locomotive')
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
Locomotive::Wagon.push('site', {'host' => 'http://locomotive.engine.dev:3000'}, 'email' => 'admin@locomotivecms.com', 'password' => 'locomotive', 'force' => true, 'data' => true)
|
data/generators/blank/Gemfile.tt
CHANGED
|
@@ -6,9 +6,10 @@ gem 'locomotivecms_wagon', '<%= config[:version] -%>'
|
|
|
6
6
|
|
|
7
7
|
group :development do
|
|
8
8
|
# Mac OS X
|
|
9
|
-
gem 'rb-fsevent', '~> 0.9.1', :
|
|
9
|
+
gem 'rb-fsevent', '~> 0.9.1', require: RUBY_PLATFORM.include?('darwin') && 'rb-fsevent'
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# Unix
|
|
12
|
+
gem 'therubyracer', require: 'v8', platforms: :ruby
|
|
12
13
|
|
|
13
14
|
# TODO: Windows
|
|
14
15
|
end
|
|
@@ -6,9 +6,10 @@ gem 'locomotivecms_wagon', '<%= config[:version] -%>'
|
|
|
6
6
|
|
|
7
7
|
group :development do
|
|
8
8
|
# Mac OS X
|
|
9
|
-
gem 'rb-fsevent', '~> 0.9.1', :
|
|
9
|
+
gem 'rb-fsevent', '~> 0.9.1', require: RUBY_PLATFORM.include?('darwin') && 'rb-fsevent'
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# Unix
|
|
12
|
+
gem 'therubyracer', require: 'v8', platforms: :ruby
|
|
12
13
|
|
|
13
14
|
# TODO: Windows
|
|
14
15
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# ruby '1.9.3'
|
|
4
|
+
|
|
5
|
+
gem 'locomotivecms_wagon', '<%= config[:version] -%>'
|
|
6
|
+
|
|
7
|
+
group :development do
|
|
8
|
+
# Mac OS X
|
|
9
|
+
gem 'rb-fsevent', '~> 0.9.1', require: RUBY_PLATFORM.include?('darwin') && 'rb-fsevent'
|
|
10
|
+
|
|
11
|
+
# Unix
|
|
12
|
+
gem 'therubyracer', require: 'v8', platforms: :ruby
|
|
13
|
+
|
|
14
|
+
# TODO: Windows
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
group :misc do
|
|
18
|
+
# Add your extra gems here
|
|
19
|
+
# gem 'susy', require: 'susy'
|
|
20
|
+
# gem 'redcarpet', require: 'redcarpet'
|
|
21
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.empty_directory
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.empty_directory
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.empty_directory
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.empty_directory
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.empty_directory
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.empty_directory
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.empty_directory
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.empty_directory
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.empty_directory
|
|
@@ -12,9 +12,9 @@ published: true
|
|
|
12
12
|
<title>{{ page.title }}</title>
|
|
13
13
|
|
|
14
14
|
{{ 'normalize.css' | stylesheet_tag }}
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
{{ 'foundation.css' | stylesheet_tag }}
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
{{ 'vendor/custom.modernizr.js' | javascript_tag }}
|
|
19
19
|
|
|
20
20
|
</head>
|
|
@@ -108,43 +108,43 @@ published: true
|
|
|
108
108
|
|
|
109
109
|
<script>
|
|
110
110
|
document.write('<script src=' +
|
|
111
|
-
('__proto__' in {} ? '{{
|
|
112
|
-
'
|
|
111
|
+
('__proto__' in {} ? '{{ 'vendor/zepto.js' | javascript_url }}' : '{{ 'vendor/jquery.js' | javascript_url }}') +
|
|
112
|
+
'><\/script>')
|
|
113
113
|
</script>
|
|
114
114
|
{{ 'foundation.min.js' | javascript_tag }}
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
<!--
|
|
117
|
-
|
|
117
|
+
|
|
118
118
|
{{ 'foundation/foundation.js' | javascript_tag }}
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
{{ 'foundation/foundation.alerts.js' | javascript_tag }}
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
{{ 'foundation/foundation.clearing.js' | javascript_tag }}
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
{{ 'foundation/foundation.cookie.js' | javascript_tag }}
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
{{ 'foundation/foundation.dropdown.js' | javascript_tag }}
|
|
127
|
-
|
|
127
|
+
|
|
128
128
|
{{ 'foundation/foundation.forms.js' | javascript_tag }}
|
|
129
|
-
|
|
129
|
+
|
|
130
130
|
{{ 'foundation/foundation.joyride.js' | javascript_tag }}
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
{{ 'foundation/foundation.magellan.js' | javascript_tag }}
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
{{ 'foundation/foundation.orbit.js' | javascript_tag }}
|
|
135
|
-
|
|
135
|
+
|
|
136
136
|
{{ 'foundation/foundation.placeholder.js' | javascript_tag }}
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
{{ 'foundation/foundation.reveal.js' | javascript_tag }}
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
{{ 'foundation/foundation.section.js' | javascript_tag }}
|
|
141
|
-
|
|
141
|
+
|
|
142
142
|
{{ 'foundation/foundation.tooltips.js' | javascript_tag }}
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
{{ 'foundation/foundation.topbar.js' | javascript_tag }}
|
|
145
|
-
|
|
145
|
+
|
|
146
146
|
-->
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
<script>
|
|
149
149
|
$(document).foundation();
|
|
150
150
|
</script>
|
|
@@ -12,9 +12,9 @@ published: true
|
|
|
12
12
|
%meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}/
|
|
13
13
|
%title {{ page.title }}
|
|
14
14
|
{{ 'normalize.css' | stylesheet_tag }}
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
{{ 'foundation.css' | stylesheet_tag }}
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
{{ 'vendor/custom.modernizr.js' | javascript_tag }}
|
|
19
19
|
%body
|
|
20
20
|
.row
|
|
@@ -86,45 +86,44 @@ published: true
|
|
|
86
86
|
%br/
|
|
87
87
|
us on Twitter if you have questions. If you build something with this we'd love to see it (and send you a totally boss sticker).
|
|
88
88
|
{% endblock %}
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
{% include footer %}
|
|
91
91
|
|
|
92
92
|
:javascript
|
|
93
93
|
document.write('<script src=' +
|
|
94
|
-
('__proto__' in {} ? '{{
|
|
95
|
-
'
|
|
94
|
+
('__proto__' in {} ? '{{ 'vendor/zepto.js' | javascript_url }}' : '{{ 'vendor/jquery.js' | javascript_url }}') +
|
|
95
|
+
'><\/script>')
|
|
96
96
|
|
|
97
97
|
{{ 'foundation.min.js' | javascript_tag }}
|
|
98
98
|
|
|
99
99
|
/
|
|
100
100
|
{{ 'foundation/foundation.js' | javascript_tag }}
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
{{ 'foundation/foundation.alerts.js' | javascript_tag }}
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
{{ 'foundation/foundation.clearing.js' | javascript_tag }}
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
{{ 'foundation/foundation.cookie.js' | javascript_tag }}
|
|
107
|
-
|
|
107
|
+
|
|
108
108
|
{{ 'foundation/foundation.dropdown.js' | javascript_tag }}
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
{{ 'foundation/foundation.forms.js' | javascript_tag }}
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
{{ 'foundation/foundation.joyride.js' | javascript_tag }}
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
{{ 'foundation/foundation.magellan.js' | javascript_tag }}
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
{{ 'foundation/foundation.orbit.js' | javascript_tag }}
|
|
117
|
-
|
|
117
|
+
|
|
118
118
|
{{ 'foundation/foundation.placeholder.js' | javascript_tag }}
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
{{ 'foundation/foundation.reveal.js' | javascript_tag }}
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
{{ 'foundation/foundation.section.js' | javascript_tag }}
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
{{ 'foundation/foundation.tooltips.js' | javascript_tag }}
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
{{ 'foundation/foundation.topbar.js' | javascript_tag }}
|
|
127
|
-
|
|
127
|
+
|
|
128
128
|
:javascript
|
|
129
129
|
$(document).foundation();
|
|
130
|
-
|
data/lib/locomotive/wagon/cli.rb
CHANGED
|
@@ -118,6 +118,7 @@ module Locomotive
|
|
|
118
118
|
|
|
119
119
|
desc 'init NAME [PATH]', 'Create a brand new LocomotiveCMS site'
|
|
120
120
|
method_option :template, aliases: '-t', type: 'string', default: 'blank', desc: 'instead of building from a blank site, you can have a pre-fetched site with form a template (see the templates command)'
|
|
121
|
+
method_option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'display the full error stack trace if an error occurs'
|
|
121
122
|
def init(name, path = '.')
|
|
122
123
|
require 'locomotive/wagon/generators/site'
|
|
123
124
|
generator = Locomotive::Wagon::Generators::Site.get(options[:template])
|
|
@@ -125,13 +126,27 @@ module Locomotive
|
|
|
125
126
|
say "Unknown site template '#{options[:template]}'", :red
|
|
126
127
|
else
|
|
127
128
|
begin
|
|
128
|
-
Locomotive::Wagon.init(name, path, generator)
|
|
129
|
+
if Locomotive::Wagon.init(name, path, generator)
|
|
130
|
+
self.print_next_instructions_when_site_created(name, path)
|
|
131
|
+
end
|
|
129
132
|
rescue GeneratorException => e
|
|
130
|
-
|
|
133
|
+
self.print_exception(e, options[:verbose])
|
|
131
134
|
end
|
|
132
135
|
end
|
|
133
136
|
end
|
|
134
137
|
|
|
138
|
+
desc 'clone NAME HOST EMAIL PASSWORD [PATH]', 'Clone a remote LocomotiveCMS site'
|
|
139
|
+
method_option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'display the full error stack trace if an error occurs'
|
|
140
|
+
def clone(name, host, email, password, path = '.')
|
|
141
|
+
begin
|
|
142
|
+
if Locomotive::Wagon.clone(name, path, host: host, email: email, password: password)
|
|
143
|
+
self.print_next_instructions_when_site_created(name, path)
|
|
144
|
+
end
|
|
145
|
+
rescue Exception => e
|
|
146
|
+
self.print_exception(e, options[:verbose])
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
135
150
|
desc 'generate TYPE ...ARGS', 'Generate resources (content_types, page, snippets) for a LocomotiveCMS site'
|
|
136
151
|
subcommand 'generate', Generate
|
|
137
152
|
|
|
@@ -165,13 +180,14 @@ module Locomotive
|
|
|
165
180
|
method_option :resources, aliases: '-r', type: 'array', default: nil, desc: 'Only push the resource(s) passed in argument'
|
|
166
181
|
method_option :force, aliases: '-f', type: 'boolean', default: false, desc: 'Force the push of a resource'
|
|
167
182
|
method_option :data, aliases: '-d', type: 'boolean', default: false, desc: 'Push the content entries and the editable elements (by default, they are not)'
|
|
183
|
+
method_option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'display the full error stack trace if an error occurs'
|
|
168
184
|
def push(env, path = '.')
|
|
169
185
|
if check_path!(path)
|
|
170
186
|
if connection_info = self.retrieve_connection_info(env, path)
|
|
171
187
|
begin
|
|
172
188
|
Locomotive::Wagon.push(path, connection_info, options)
|
|
173
189
|
rescue Exception => e
|
|
174
|
-
|
|
190
|
+
self.print_exception(e, options[:verbose])
|
|
175
191
|
end
|
|
176
192
|
end
|
|
177
193
|
end
|
|
@@ -179,15 +195,14 @@ module Locomotive
|
|
|
179
195
|
|
|
180
196
|
desc 'pull ENV [PATH]', 'Pull a site from a remote LocomotiveCMS engine'
|
|
181
197
|
method_option :resources, aliases: '-r', type: 'array', default: nil, desc: 'Only pull the resource(s) passed in argument'
|
|
182
|
-
|
|
183
|
-
# method_option :data, aliases: '-d', type: 'boolean', default: false, desc: 'Push the content entries and the editable elements (by default, they are not)'
|
|
198
|
+
method_option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'display the full error stack trace if an error occurs'
|
|
184
199
|
def pull(env, path = '.')
|
|
185
200
|
if check_path!(path)
|
|
186
201
|
if connection_info = self.retrieve_connection_info(env, path)
|
|
187
202
|
begin
|
|
188
203
|
Locomotive::Wagon.pull(path, connection_info, options)
|
|
189
204
|
rescue Exception => e
|
|
190
|
-
|
|
205
|
+
self.print_exception(e, options[:verbose])
|
|
191
206
|
end
|
|
192
207
|
end
|
|
193
208
|
end
|
|
@@ -208,6 +223,29 @@ module Locomotive
|
|
|
208
223
|
|
|
209
224
|
protected
|
|
210
225
|
|
|
226
|
+
# Print a nice message when a site has been created.
|
|
227
|
+
#
|
|
228
|
+
# @param [ String ] name The name of the site
|
|
229
|
+
# @param [ String ] path The path of the local site
|
|
230
|
+
#
|
|
231
|
+
def print_next_instructions_when_site_created(name, path)
|
|
232
|
+
say "\nCongratulations, your site \"#{name}\" has been created successfully !", :green
|
|
233
|
+
say 'Next steps:', :bold
|
|
234
|
+
say "\tcd #{path}/#{name}\n\tbundle install\n\tbundle exec wagon serve\n\topen http://0.0.0.0:3333"
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Print the exception.
|
|
238
|
+
#
|
|
239
|
+
# @param [ Object ] exception The raised exception
|
|
240
|
+
# @param [ Boolean ] verbose Print the full backtrace if true
|
|
241
|
+
#
|
|
242
|
+
def print_exception(exception, verbose)
|
|
243
|
+
say exception.message, :red
|
|
244
|
+
if verbose
|
|
245
|
+
say "\t" + exception.backtrace.join("\n\t")
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
|
|
211
249
|
# From a site specified by a path, retrieve the information of the connection
|
|
212
250
|
# for a environment located in the config/deploy.yml file of the site.
|
|
213
251
|
#
|
|
@@ -217,10 +255,11 @@ module Locomotive
|
|
|
217
255
|
# @return [ Hash ] The information of the connection or nil if errors
|
|
218
256
|
#
|
|
219
257
|
def retrieve_connection_info(env, path)
|
|
258
|
+
require 'active_support/core_ext/hash'
|
|
220
259
|
connection_info = nil
|
|
221
260
|
begin
|
|
222
261
|
path_to_deploy_file = File.join(path, 'config', 'deploy.yml')
|
|
223
|
-
connection_info = YAML::load(File.open(path_to_deploy_file).read)[env.to_s]
|
|
262
|
+
connection_info = YAML::load(File.open(path_to_deploy_file).read)[env.to_s].with_indifferent_access
|
|
224
263
|
|
|
225
264
|
if connection_info.nil?
|
|
226
265
|
raise "No #{env.to_s} environment found in the config/deploy.yml file"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Locomotive
|
|
2
|
+
module Wagon
|
|
3
|
+
module Generators
|
|
4
|
+
module Site
|
|
5
|
+
|
|
6
|
+
# Template used when the remote LocomotiveCMS site is cloned
|
|
7
|
+
# in order to have the minimal files.
|
|
8
|
+
class Cloned < Base
|
|
9
|
+
|
|
10
|
+
argument :connection_info
|
|
11
|
+
|
|
12
|
+
def copy_sources
|
|
13
|
+
directory('.', self.destination, { recursive: true }, {
|
|
14
|
+
name: self.name,
|
|
15
|
+
version: Locomotive::Wagon::VERSION
|
|
16
|
+
}.merge(self.connection_info))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -4,26 +4,60 @@ module Locomotive
|
|
|
4
4
|
module Filters
|
|
5
5
|
module Html
|
|
6
6
|
|
|
7
|
+
# Returns a link tag that browsers and news readers can use to auto-detect an RSS or ATOM feed.
|
|
8
|
+
# input: url of the feed
|
|
9
|
+
# example:
|
|
10
|
+
# {{ '/foo/bar' | auto_discovery_link_tag: 'rel:alternate', 'type:application/atom+xml', 'title:A title' }}
|
|
11
|
+
def auto_discovery_link_tag(input, *args)
|
|
12
|
+
options = args_to_options(args)
|
|
13
|
+
|
|
14
|
+
rel = options[:rel] || 'alternate'
|
|
15
|
+
type = options[:type] || Mime::Type.lookup_by_extension('rss').to_s
|
|
16
|
+
title = options[:title] || 'RSS'
|
|
17
|
+
|
|
18
|
+
%{<link rel="#{rel}" type="#{type}" title="#{title}" href="#{input}" />}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Write the url of a theme stylesheet
|
|
22
|
+
# input: name of the css file
|
|
23
|
+
def stylesheet_url(input)
|
|
24
|
+
return '' if input.nil?
|
|
25
|
+
|
|
26
|
+
input = "/stylesheets/#{input}" unless input =~ /^(\/|https?:)/
|
|
27
|
+
|
|
28
|
+
input = "#{input}.css" unless input.ends_with?('.css')
|
|
29
|
+
|
|
30
|
+
input
|
|
31
|
+
end
|
|
32
|
+
|
|
7
33
|
# Write the link to a stylesheet resource
|
|
8
34
|
# input: url of the css file
|
|
9
35
|
def stylesheet_tag(input, media = 'screen')
|
|
10
36
|
return '' if input.nil?
|
|
11
37
|
|
|
12
|
-
input =
|
|
13
|
-
|
|
14
|
-
input = "#{input}.css" unless input.ends_with?('.css')
|
|
38
|
+
input = stylesheet_url(input)
|
|
15
39
|
|
|
16
40
|
%{<link href="#{input}" media="#{media}" rel="stylesheet" type="text/css" />}
|
|
17
41
|
end
|
|
18
42
|
|
|
43
|
+
# Write the url to javascript resource
|
|
44
|
+
# input: name of the javascript file
|
|
45
|
+
def javascript_url(input)
|
|
46
|
+
return '' if input.nil?
|
|
47
|
+
|
|
48
|
+
input = "/javascripts/#{input}" unless input =~ /^(\/|https?:)/
|
|
49
|
+
|
|
50
|
+
input = "#{input}.js" unless input.ends_with?('.js')
|
|
51
|
+
|
|
52
|
+
input
|
|
53
|
+
end
|
|
54
|
+
|
|
19
55
|
# Write the link to javascript resource
|
|
20
56
|
# input: url of the javascript file
|
|
21
57
|
def javascript_tag(input)
|
|
22
58
|
return '' if input.nil?
|
|
23
59
|
|
|
24
|
-
input =
|
|
25
|
-
|
|
26
|
-
input = "#{input}.js" unless input.ends_with?('.js')
|
|
60
|
+
input = javascript_url(input)
|
|
27
61
|
|
|
28
62
|
%{<script src="#{input}" type="text/javascript"></script>}
|
|
29
63
|
end
|
|
@@ -33,9 +67,7 @@ module Locomotive
|
|
|
33
67
|
def image_tag(input, *args)
|
|
34
68
|
image_options = inline_options(args_to_options(args))
|
|
35
69
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"<img src=\"#{File.join('/', get_url_from_asset(input))}\" #{image_options}/>"
|
|
70
|
+
"<img src=\"#{get_url_from_asset(input)}\" #{image_options}>"
|
|
39
71
|
end
|
|
40
72
|
|
|
41
73
|
# Write a theme image tag
|
data/lib/locomotive/wagon.rb
CHANGED
|
@@ -61,12 +61,12 @@ module Locomotive
|
|
|
61
61
|
|
|
62
62
|
writer = Locomotive::Mounter::Writer::Api.instance
|
|
63
63
|
|
|
64
|
-
connection_info[
|
|
64
|
+
connection_info[:uri] = "#{connection_info.delete(:host)}/locomotive/api"
|
|
65
65
|
|
|
66
66
|
_options = { mounting_point: reader.mounting_point, console: true }.merge(options).symbolize_keys
|
|
67
67
|
_options[:only] = _options.delete(:resources)
|
|
68
68
|
|
|
69
|
-
writer.run!(_options.merge(connection_info))
|
|
69
|
+
writer.run!(_options.merge(connection_info).with_indifferent_access)
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
|
@@ -80,9 +80,9 @@ module Locomotive
|
|
|
80
80
|
def self.pull(path, connection_info, options = {})
|
|
81
81
|
self.require_mounter(path)
|
|
82
82
|
|
|
83
|
-
Bundler.require 'misc'
|
|
83
|
+
Bundler.require 'misc' unless options[:disable_misc]
|
|
84
84
|
|
|
85
|
-
connection_info[
|
|
85
|
+
connection_info[:uri] = "#{connection_info.delete(:host)}/locomotive/api"
|
|
86
86
|
|
|
87
87
|
_options = { console: true }.merge(options)
|
|
88
88
|
_options[:only] = _options.delete(:resources)
|
|
@@ -92,29 +92,30 @@ module Locomotive
|
|
|
92
92
|
|
|
93
93
|
writer = Locomotive::Mounter::Writer::FileSystem.instance
|
|
94
94
|
writer.run!(mounting_point: reader.mounting_point, target_path: path)
|
|
95
|
-
rescue Exception => e
|
|
96
|
-
puts e.backtrace
|
|
97
95
|
end
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
# Clone a site from a remote LocomotiveCMS engine.
|
|
98
|
+
#
|
|
99
|
+
# @param [ String ] name Name of the site (arbitrary)
|
|
100
|
+
# @param [ String ] path The root path where the site will be cloned
|
|
101
|
+
# @param [ Hash ] connection_info The host, email and password needed to access the remote engine
|
|
102
|
+
# @param [ Hash ] options The options for the API reader
|
|
103
|
+
#
|
|
104
|
+
def self.clone(name, path, connection_info, options = {})
|
|
105
|
+
target_path = File.expand_path(File.join(path, name))
|
|
106
|
+
|
|
107
|
+
if File.exists?(target_path)
|
|
101
108
|
puts "Path already exists. If it's an existing site, you might want to pull instead of clone."
|
|
102
109
|
return false
|
|
103
110
|
end
|
|
104
|
-
require 'locomotive/mounter'
|
|
105
|
-
|
|
106
|
-
connection_info['uri'] = "#{connection_info.delete('host')}/locomotive/api"
|
|
107
111
|
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
# generate an almost blank site
|
|
113
|
+
require 'locomotive/wagon/generators/site'
|
|
114
|
+
generator = Locomotive::Wagon::Generators::Site::Cloned
|
|
115
|
+
generator.start [name, path, connection_info]
|
|
110
116
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
writer = Locomotive::Mounter::Writer::FileSystem.instance
|
|
115
|
-
writer.run!(mounting_point: reader.mounting_point, target_path: path)
|
|
116
|
-
# rescue Exception => e
|
|
117
|
-
# puts e.backtrace
|
|
117
|
+
# pull the remote site
|
|
118
|
+
self.pull(target_path, options.merge(connection_info).with_indifferent_access, { disable_misc: true })
|
|
118
119
|
end
|
|
119
120
|
|
|
120
121
|
# Destroy a remote site
|
data/locomotivecms_wagon.gemspec
CHANGED
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |gem|
|
|
|
31
31
|
|
|
32
32
|
gem.add_dependency 'httmultiparty', '0.3.8'
|
|
33
33
|
gem.add_dependency 'will_paginate', '~> 3.0.3'
|
|
34
|
-
gem.add_dependency 'locomotivecms_mounter', '1.0.
|
|
34
|
+
gem.add_dependency 'locomotivecms_mounter', '1.0.4'
|
|
35
35
|
|
|
36
36
|
gem.add_dependency 'faker', '~> 0.9.5'
|
|
37
37
|
|
|
@@ -12,6 +12,8 @@ title: Home page
|
|
|
12
12
|
%meta{ :content => "{{ site.meta_description }}", :name => "description" }
|
|
13
13
|
%meta{ :content => "{{ site.meta_keywords }}", :name => "keywords" }
|
|
14
14
|
|
|
15
|
+
{{ '/foo/bar' | auto_discovery_link_tag: 'rel:alternate', 'type:application/atom+xml', 'title:A title' }}
|
|
16
|
+
|
|
15
17
|
/ Le HTML5 shim, for IE6-8 support of HTML elements
|
|
16
18
|
|
|
17
19
|
/[if lt IE 9]
|
|
@@ -22,6 +24,7 @@ title: Home page
|
|
|
22
24
|
/ Le styles
|
|
23
25
|
{{ 'reboot' | stylesheet_tag }}
|
|
24
26
|
{{ 'application' | stylesheet_tag }}
|
|
27
|
+
%script{ :src => "{{ 'application.js' | javascript_url }}", :type => 'text/javascript' }
|
|
25
28
|
|
|
26
29
|
%script{ :src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', :type => 'text/javascript' }
|
|
27
30
|
|
|
@@ -30,7 +33,7 @@ title: Home page
|
|
|
30
33
|
%body
|
|
31
34
|
.container
|
|
32
35
|
#menu
|
|
33
|
-
#nav
|
|
36
|
+
%ul#nav
|
|
34
37
|
%li#home{ :class => "{% if page.fullpath == 'index' %}on{% endif %} link" }
|
|
35
38
|
%a{ :href => '/' } Home
|
|
36
39
|
{% nav site, no_wrapper: true, exclude: 'events' %}
|