locomotivecms_wagon 2.0.0.rc6 → 2.0.0.rc7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f762fee2b5e2a55c9000323e814145d6c09cf732
4
- data.tar.gz: 7ff6dbc6a2d00eb28b4e2259db598c442eabb7e0
3
+ metadata.gz: 9e8df3a287cbb05c29d2117ec271460129175326
4
+ data.tar.gz: c89bdf2637d74db7d876754f7432db3ecaadf0d9
5
5
  SHA512:
6
- metadata.gz: dea5e635c441886ecf9231bbd7549f1991d0867e16df9761fc8aeda5dddb48f93cd733029e46b8eb2c28fa67d55a5b8f13104dc838a9443b1cc974ef252c75a1
7
- data.tar.gz: e26b8a68906b25cfd1f8d1c78669fcd49fc9382f8b02aa67aa8843068dca0f5cceaa5cc44ae8263c081e5c7265522771da476e269fb9fd9310447ff66a1aa8da
6
+ metadata.gz: 586b40e8f1f65cf0b72953b4aa78fa5296c974be3fdb9a92f67843b3b550b036e1c54e2e4709cae288794a304728ed94c9e497b34467ab7e9c0721e3595d9eb5
7
+ data.tar.gz: 5578ece2a190b9a70761cd32745211394d5b54153f872500ae8eb2f003f646427874a5b1c4e649127e23f03060f56bbffa143dd6397cb5f2ac4c2d9baa196c59
data/.travis.yml CHANGED
@@ -1,3 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.1
3
+ - 2.1.1
4
+ before_install:
5
+ - export TZ=Paris
6
+ - date
7
+
data/Gemfile CHANGED
@@ -8,7 +8,7 @@ gem 'rb-fsevent', '~> 0.9.1'
8
8
  gem 'therubyracer'
9
9
 
10
10
  # Development
11
- # gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: '0aa777b', require: false
11
+ # gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: '7825b47', require: false
12
12
  # gem 'locomotivecms_coal', github: 'locomotivecms/coal', ref: '32b2844', require: false
13
13
  # gem 'locomotivecms_common', github: 'locomotivecms/common', ref: '3046b79893', require: false
14
14
 
data/README.md CHANGED
@@ -1,47 +1,53 @@
1
- # LocomotiveCMS::Wagon
1
+ # Wagon
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/locomotivecms_wagon.svg)](http://badge.fury.io/rb/locomotivecms_wagon) [![Code Climate](https://codeclimate.com/github/locomotivecms/wagon/badges/gpa.svg)](https://codeclimate.com/github/locomotivecms/wagon) [![Dependency Status](https://gemnasium.com/locomotivecms/wagon.png)](https://gemnasium.com/locomotivecms/wagon) [![Build Status](https://travis-ci.org/locomotivecms/wagon.svg?branch=master)](https://travis-ci.org/locomotivecms/wagon) [![Coverage Status](https://coveralls.io/repos/locomotivecms/wagon/badge.svg?branch=master)](https://coveralls.io/r/locomotivecms/wagon?branch=master)
4
4
 
5
- Wagon is the official site generator for the LocomotiveCMS engine powered by all the efficient and modern HTML development tools (Haml, SASS, Compass, Less).
5
+ Wagon is a command line tool that let's you develop for Locomotive right on your local machine.
6
+
7
+ With Wagon, you can generate the scaffolding for a new Locomotive site and start adding the content types and templates you need using any text editor. And thanks to Wagon's built-in web server, you can preview the site with your computer's web browser.
8
+
9
+ Wagon can also deploy sites to any Locomotive Engine using the wagon deploy command. Your changes will immediately be reflected on that site without restarting or making any changes to the Engine server app.
10
+
11
+ To help you work faster, Wagon comes with support for tools like SASS, LESS, HAML, and CoffeeScript. It also works well with source version control systems like git and svn.
12
+
13
+ **Note:** The previous version of Wagon (v1.5.8) is available in the *[v1.5.x](https://github.com/locomotivecms/wagon/tree/v1.5.x)* branch
6
14
 
7
15
  ## Documentation
8
16
 
9
- Please, visit the documentation website of LocomotiveCMS.
17
+ Please, visit the documentation website of Locomotive.
18
+
19
+ [http://locomotive-v3.locomotivecms.com](http://locomotive-v3.readme.io)
10
20
 
11
- [http://doc.locomotivecms.com](http://doc.locomotivecms.com)
21
+ **Note:** The documentation for the previous version (v1.5.x) is available [here](http://doc.locomotivecms.com).
12
22
 
13
23
  ## Developers / Contributors
14
24
 
15
- ### Get the development of the mounter
25
+ ### Get the development version of the Steam gem
16
26
 
17
- $ git clone git://github.com/locomotivecms/mounter.git
27
+ $ git clone git://github.com/locomotivecms/steam.git
18
28
 
19
29
  Note: If you want to contribute, you may consider to fork it instead
20
30
 
21
- ### Get the source of the wagon
31
+ ### Get the source of Wagon
22
32
 
23
33
  $ git clone git://github.com/locomotivecms/wagon.git
24
34
  $ cd wagon
25
35
 
26
36
  Note: Again, if you want to contribute, you may consider to fork it instead
27
37
 
28
- Modify the Gemfile to change the link to the *mounter* gem which should point to your local installation of the mounter.
38
+ Modify the Gemfile to change the link to the *steam* gem which should point to your local installation of Steam.
29
39
 
30
40
  $ bundle install
31
41
 
32
42
  ### Test it
33
43
 
34
- #### Run the server with a default site
44
+ #### Run the spec tests
35
45
 
36
- $ bundle exec bin/wagon serve spec/fixtures/default
37
-
38
- #### Push a site
39
-
40
- $ bundle exec bin/wagon push <path to your LocomotiveCMS local site> <url of your remote LocomotiveCMS site> <email of your admin account> <password>
46
+ $ bundle exec rake spec
41
47
 
42
- #### Pull a site
48
+ #### Run the server with a default site
43
49
 
44
- $ bundle exec bin/wagon pull <url of your remote LocomotiveCMS site> <email of your admin account> <password>
50
+ $ bundle exec bin/wagon serve spec/fixtures/default
45
51
 
46
52
  ## Contributing
47
53
 
@@ -55,4 +61,4 @@ Please, visit the documentation website of LocomotiveCMS.
55
61
 
56
62
  Feel free to contact me (did at locomotivecms dot com).
57
63
 
58
- Copyright (c) 2013 NoCoffee, released under the MIT license
64
+ Copyright (c) 2016 NoCoffee, released under the MIT license
@@ -13,7 +13,7 @@
13
13
  <% when 'date' -%>
14
14
  <%= field.name -%>: <%= Time.now.strftime('%Y/%m/%d') -%> # YYYY/MM/DD
15
15
  <% when 'file' -%>
16
- <%= field.name -%>: null # Path to a file in the public/samples folder or to a remote and external file.
16
+ # <%= field.name -%>: /samples/<%= config[:slug] -%>/yourfile.txt # Path to a file in the public/samples folder or to a remote and external file.
17
17
  <% when 'belongs_to' -%>
18
18
  <%= field.name -%>: null # Slug of the target entry
19
19
  <% when 'many_to_many' -%>
@@ -21,4 +21,4 @@
21
21
  <% end -%>
22
22
  <% end -%>
23
23
 
24
- <% end -%>
24
+ <% end -%>
@@ -302,6 +302,7 @@ module Locomotive
302
302
 
303
303
  desc 'deploy ENV [PATH]', 'Deploy a site to a remote Locomotive Engine'
304
304
  option :resources, aliases: '-r', type: 'array', default: nil, desc: 'Only push the resource(s) passed in argument'
305
+ option :filter, aliases: '-f', type: 'array', default: nil, desc: 'Push specific resource entries'
305
306
  option :data, aliases: '-d', type: 'boolean', default: false, desc: 'Push the content entries and the editable elements (by default, they are not)'
306
307
  option :shell, type: 'boolean', default: true, desc: 'Use shell to ask for missing connection information like the site handle (in this case, take a random one)'
307
308
  option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'display the full error stack trace if an error occurs'
@@ -5,6 +5,7 @@ require_relative 'loggers/push_logger'
5
5
  require_relative_all 'concerns'
6
6
  require_relative_all '../decorators/concerns'
7
7
  require_relative_all '../decorators'
8
+ require_relative '../tools/glob'
8
9
 
9
10
  require_relative 'push_sub_commands/push_base_command'
10
11
  require_relative_all 'push_sub_commands'
@@ -53,6 +54,7 @@ module Locomotive::Wagon
53
54
  each_resource do |klass|
54
55
  klass.push(api_client, steam_services, content_assets_pusher, remote_site) do |pusher|
55
56
  pusher.with_data if options[:data]
57
+ pusher.only(options[:filter]) unless options[:filter].blank?
56
58
  end
57
59
  end
58
60
 
@@ -1,6 +1,6 @@
1
1
  module Locomotive::Wagon
2
2
 
3
- class PushBaseCommand < Struct.new(:api_client, :steam_services, :content_assets_pusher, :remote_site)
3
+ class PushBaseCommand < Struct.new(:api_client, :steam_services, :content_assets_pusher, :remote_site, :filter)
4
4
 
5
5
  extend Forwardable
6
6
 
@@ -71,6 +71,12 @@ module Locomotive::Wagon
71
71
  !!@with_data
72
72
  end
73
73
 
74
+ def only(entities)
75
+ @only_entities = entities.map do |entity_or_filter|
76
+ Locomotive::Wagon::Glob.new(entity_or_filter.gsub(/\A\//, '')).to_regexp
77
+ end
78
+ end
79
+
74
80
  class SkipPersistingException < Exception
75
81
  end
76
82
 
@@ -3,7 +3,10 @@ module Locomotive::Wagon
3
3
  class PushPagesCommand < PushBaseCommand
4
4
 
5
5
  def entities
6
- repositories.page.all
6
+ repositories.page.all.map do |entity|
7
+ next if skip?(entity)
8
+ entity
9
+ end.compact
7
10
  end
8
11
 
9
12
  def decorate(entity)
@@ -67,6 +70,14 @@ module Locomotive::Wagon
67
70
  end
68
71
  end
69
72
 
73
+ def skip?(entity)
74
+ return false if @only_entities.blank?
75
+
76
+ _path = entity.template_path[default_locale].gsub('./app/views/pages/', '')
77
+
78
+ !@only_entities.any? { |regexp| regexp.match(_path) }
79
+ end
80
+
70
81
  end
71
82
 
72
83
  end
@@ -6,8 +6,9 @@ module Locomotive::Wagon
6
6
 
7
7
  def entities
8
8
  repositories.theme_asset.all.map do |entity|
9
+ next if skip?(entity)
9
10
  decorated = ThemeAssetDecorator.new(entity)
10
- end.sort { |a, b| a.priority <=> b.priority }
11
+ end.compact.sort { |a, b| a.priority <=> b.priority }
11
12
  end
12
13
 
13
14
  def decorate(entity)
@@ -88,6 +89,14 @@ module Locomotive::Wagon
88
89
  @sprockets_env ||= Locomotive::Steam::SprocketsEnvironment.new(File.join(path, 'public'), minify: true)
89
90
  end
90
91
 
92
+ def skip?(entity)
93
+ return false if @only_entities.blank?
94
+
95
+ _source = entity.source.gsub('./public/', '')
96
+
97
+ !@only_entities.any? { |regexp| regexp.match(_source) }
98
+ end
99
+
91
100
  end
92
101
 
93
102
  end
@@ -45,11 +45,14 @@ module Locomotive
45
45
  end
46
46
 
47
47
  def decorate_date_time_field(value)
48
+ value.utc.try(:iso8601)
49
+ end
50
+
51
+ def decorate_date_field(value)
48
52
  value.try(:iso8601)
49
53
  end
50
54
 
51
55
  alias :decorate_time_field :decorate_date_time_field
52
- alias :decorate_date_field :decorate_date_time_field
53
56
 
54
57
  def to_hash
55
58
  if (hash = super).keys == [:_slug]
@@ -20,6 +20,10 @@ module Locomotive
20
20
  super
21
21
  end
22
22
 
23
+ def comment_gemfile
24
+ false
25
+ end
26
+
23
27
  end
24
28
  end
25
29
  end
@@ -0,0 +1,86 @@
1
+ # Original source code: https://raw.githubusercontent.com/alexch/rerun/master/lib/rerun/glob.rb
2
+ # License here: https://github.com/alexch/rerun/blob/master/LICENSE
3
+ #
4
+ # based on http://cpan.uwinnipeg.ca/htdocs/Text-Glob/Text/Glob.pm.html#glob_to_regex_string-
5
+ #
6
+ module Locomotive
7
+ module Wagon
8
+ class Glob
9
+
10
+ NO_LEADING_DOT = '(?=[^\.])' # todo
11
+ START_OF_FILENAME = '(\A|\/)' # beginning of string or a slash
12
+ END_OF_STRING = '\z'
13
+
14
+ def initialize(glob_string)
15
+ @glob_string = glob_string
16
+ end
17
+
18
+ def to_regexp_string
19
+ chars = @glob_string.split('')
20
+ chars = smoosh(chars)
21
+
22
+ START_OF_FILENAME + parse(chars) + END_OF_STRING
23
+ end
24
+
25
+ def to_regexp
26
+ Regexp.new(to_regexp_string)
27
+ end
28
+
29
+ def smoosh(chars)
30
+ [].tap do |out|
31
+ until chars.empty?
32
+ char = chars.shift
33
+ if char == "*" and chars.first == "*"
34
+ chars.shift
35
+ chars.shift if chars.first == "/"
36
+ out.push("**")
37
+ else
38
+ out.push(char)
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ protected
45
+
46
+ def parse(chars)
47
+ curlies, escaping = 0, false
48
+ chars.map do |char|
49
+ if escaping
50
+ escaping = false
51
+ char
52
+ else
53
+ case char
54
+ when '**' then "([^/]+/)*"
55
+ when '*' then ".*"
56
+ when "?" then "."
57
+ when "." then "\\."
58
+ when "{"
59
+ curlies += 1
60
+ "("
61
+ when "}"
62
+ if curlies > 0
63
+ curlies -= 1
64
+ ")"
65
+ else
66
+ char
67
+ end
68
+ when ","
69
+ if curlies > 0
70
+ "|"
71
+ else
72
+ char
73
+ end
74
+ when "\\"
75
+ escaping = true
76
+ "\\"
77
+ else
78
+ char
79
+ end
80
+ end
81
+ end.join
82
+ end
83
+
84
+ end
85
+ end
86
+ end
@@ -1,5 +1,5 @@
1
1
  module Locomotive
2
2
  module Wagon
3
- VERSION = '2.0.0.rc6'
3
+ VERSION = '2.0.0.rc7'
4
4
  end
5
5
  end
@@ -28,7 +28,7 @@ Gem::Specification.new do |gem|
28
28
 
29
29
  gem.add_dependency 'locomotivecms_common', '~> 0.0.5'
30
30
  gem.add_dependency 'locomotivecms_coal', '~> 1.0.0.rc4'
31
- gem.add_dependency 'locomotivecms_steam', '~> 1.0.0.rc9'
31
+ gem.add_dependency 'locomotivecms_steam', '~> 1.0.0.rc10'
32
32
 
33
33
  gem.add_dependency 'listen', '~> 3.0.4'
34
34
  gem.add_dependency 'rack-livereload', '~> 0.3.16'
@@ -27,16 +27,16 @@ http_interactions:
27
27
  Cache-Control:
28
28
  - no-cache
29
29
  X-Request-Id:
30
- - 1eeb9688-e4f0-4a25-8bbb-8f79f152e003
30
+ - 6a1f30ca-31f3-42cd-87c1-36cc0f7d9afc
31
31
  X-Runtime:
32
- - '0.019606'
32
+ - '0.030310'
33
33
  Content-Length:
34
34
  - '40'
35
35
  body:
36
36
  encoding: UTF-8
37
37
  string: '{"message":"Invalid email or password."}'
38
38
  http_version:
39
- recorded_at: Fri, 04 Dec 2015 14:21:16 GMT
39
+ recorded_at: Tue, 05 Jan 2016 02:33:23 GMT
40
40
  - request:
41
41
  method: post
42
42
  uri: http://localhost:3000/locomotive/api/v3/my_account.json
@@ -60,20 +60,20 @@ http_interactions:
60
60
  Content-Type:
61
61
  - application/json
62
62
  Etag:
63
- - W/"7d05e74769a4e3a32ddc19de535ace0d"
63
+ - W/"47c61faa89c576c552d7d76a2d254b73"
64
64
  Cache-Control:
65
65
  - max-age=0, private, must-revalidate
66
66
  X-Request-Id:
67
- - 14d9561a-97bf-4b9f-adad-488353d1dc13
67
+ - 327b70a6-11e6-4a17-b7cb-6c4218b7fb03
68
68
  X-Runtime:
69
- - '0.070429'
69
+ - '0.045889'
70
70
  Content-Length:
71
71
  - '250'
72
72
  body:
73
73
  encoding: UTF-8
74
- string: '{"_id":"5661a15c87f64302c9000043","created_at":"2015-12-04T14:21:16Z","updated_at":"2015-12-04T14:21:16Z","name":"John","email":"john@doe.net","locale":"en","api_key":"bebc2256830ef12eae85623a39158267e12e49c3","super_admin":false,"local_admin":false}'
74
+ string: '{"_id":"568b2b74c36511390b0000c7","created_at":"2016-01-05T02:33:24Z","updated_at":"2016-01-05T02:33:24Z","name":"John","email":"john@doe.net","locale":"en","api_key":"f8d1951148b1c5881dda922708155e429f5dd6d1","super_admin":false,"local_admin":false}'
75
75
  http_version:
76
- recorded_at: Fri, 04 Dec 2015 14:21:16 GMT
76
+ recorded_at: Tue, 05 Jan 2016 02:33:24 GMT
77
77
  - request:
78
78
  method: post
79
79
  uri: http://localhost:3000/locomotive/api/v3/tokens.json
@@ -97,23 +97,23 @@ http_interactions:
97
97
  Content-Type:
98
98
  - application/json
99
99
  Etag:
100
- - W/"9ad33576c3616b662c8993aff5fb3c0e"
100
+ - W/"a4a0edc4d3d366b03b86b123b06c0a86"
101
101
  Cache-Control:
102
102
  - max-age=0, private, must-revalidate
103
103
  X-Request-Id:
104
- - 03f2dcd0-5c95-4859-b556-dd95643dbc07
104
+ - a15f71d8-757e-4c98-b5b5-4f4b57cb36c3
105
105
  X-Runtime:
106
- - '0.018220'
106
+ - '0.019165'
107
107
  Content-Length:
108
108
  - '32'
109
109
  body:
110
110
  encoding: UTF-8
111
- string: '{"token":"N-ddi-7z-19pXmkRRgq_"}'
111
+ string: '{"token":"kyprbq3YxVS4jMLXrjAK"}'
112
112
  http_version:
113
- recorded_at: Fri, 04 Dec 2015 14:21:16 GMT
113
+ recorded_at: Tue, 05 Jan 2016 02:33:24 GMT
114
114
  - request:
115
115
  method: get
116
- uri: http://localhost:3000/locomotive/api/v3/my_account.json?auth_token=N-ddi-7z-19pXmkRRgq_
116
+ uri: http://localhost:3000/locomotive/api/v3/my_account.json?auth_token=kyprbq3YxVS4jMLXrjAK
117
117
  body:
118
118
  encoding: US-ASCII
119
119
  string: ''
@@ -123,7 +123,7 @@ http_interactions:
123
123
  X-Locomotive-Account-Email:
124
124
  - admin@locomotivecms.com
125
125
  X-Locomotive-Account-Token:
126
- - N-ddi-7z-19pXmkRRgq_
126
+ - kyprbq3YxVS4jMLXrjAK
127
127
  Accept-Encoding:
128
128
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
129
129
  User-Agent:
@@ -136,23 +136,23 @@ http_interactions:
136
136
  Content-Type:
137
137
  - application/json
138
138
  Etag:
139
- - W/"46c8dfee2ff366b7a6ec27cea9505afb"
139
+ - W/"213b4ad78c990c366b689c2ab41e7c48"
140
140
  Cache-Control:
141
141
  - max-age=0, private, must-revalidate
142
142
  X-Request-Id:
143
- - b43a45a2-0e95-4f9a-8abf-39b098fc98fc
143
+ - b62c3e97-56fe-4768-99c8-31b072a638e4
144
144
  X-Runtime:
145
- - '0.028692'
145
+ - '0.020263'
146
146
  Content-Length:
147
147
  - '261'
148
148
  body:
149
149
  encoding: UTF-8
150
- string: '{"_id":"5661a14f87f643077a000000","created_at":"2015-12-04T14:21:03Z","updated_at":"2015-12-04T14:21:03Z","name":"Admin","email":"admin@locomotivecms.com","locale":"en","api_key":"d49cd50f6f0d2b163f48fc73cb249f0244c37074","super_admin":false,"local_admin":true}'
150
+ string: '{"_id":"568b2aa2c3651138ee000000","created_at":"2016-01-05T02:29:54Z","updated_at":"2016-01-05T02:29:54Z","name":"Admin","email":"admin@locomotivecms.com","locale":"en","api_key":"d49cd50f6f0d2b163f48fc73cb249f0244c37074","super_admin":false,"local_admin":true}'
151
151
  http_version:
152
- recorded_at: Fri, 04 Dec 2015 14:21:16 GMT
152
+ recorded_at: Tue, 05 Jan 2016 02:33:24 GMT
153
153
  - request:
154
154
  method: get
155
- uri: http://localhost:3000/locomotive/api/v3/my_account.json?auth_token=N-ddi-7z-19pXmkRRgq_
155
+ uri: http://localhost:3000/locomotive/api/v3/my_account.json?auth_token=kyprbq3YxVS4jMLXrjAK
156
156
  body:
157
157
  encoding: US-ASCII
158
158
  string: ''
@@ -162,7 +162,7 @@ http_interactions:
162
162
  X-Locomotive-Account-Email:
163
163
  - admin@locomotivecms.com
164
164
  X-Locomotive-Account-Token:
165
- - N-ddi-7z-19pXmkRRgq_
165
+ - kyprbq3YxVS4jMLXrjAK
166
166
  Accept-Encoding:
167
167
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
168
168
  User-Agent:
@@ -175,18 +175,18 @@ http_interactions:
175
175
  Content-Type:
176
176
  - application/json
177
177
  Etag:
178
- - W/"46c8dfee2ff366b7a6ec27cea9505afb"
178
+ - W/"213b4ad78c990c366b689c2ab41e7c48"
179
179
  Cache-Control:
180
180
  - max-age=0, private, must-revalidate
181
181
  X-Request-Id:
182
- - a6cc68eb-4757-4dc3-a9ca-bb2652068468
182
+ - 34abc7af-671f-48d5-ad42-041701b492c6
183
183
  X-Runtime:
184
- - '0.017889'
184
+ - '0.019356'
185
185
  Content-Length:
186
186
  - '261'
187
187
  body:
188
188
  encoding: UTF-8
189
- string: '{"_id":"5661a14f87f643077a000000","created_at":"2015-12-04T14:21:03Z","updated_at":"2015-12-04T14:21:03Z","name":"Admin","email":"admin@locomotivecms.com","locale":"en","api_key":"d49cd50f6f0d2b163f48fc73cb249f0244c37074","super_admin":false,"local_admin":true}'
189
+ string: '{"_id":"568b2aa2c3651138ee000000","created_at":"2016-01-05T02:29:54Z","updated_at":"2016-01-05T02:29:54Z","name":"Admin","email":"admin@locomotivecms.com","locale":"en","api_key":"d49cd50f6f0d2b163f48fc73cb249f0244c37074","super_admin":false,"local_admin":true}'
190
190
  http_version:
191
- recorded_at: Fri, 04 Dec 2015 14:21:16 GMT
192
- recorded_with: VCR 2.9.3
191
+ recorded_at: Tue, 05 Jan 2016 02:33:24 GMT
192
+ recorded_with: VCR 3.0.0