locomotivecms_wagon 2.0.0.rc1 → 2.0.0.rc2

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: d6e7813188667f8439421a837787f0ca5e85b1bf
4
- data.tar.gz: d7846774d2eb77655e96b1e7b57e98393b6147c1
3
+ metadata.gz: d8337c60f659368556c38fcd040e21f64f63250c
4
+ data.tar.gz: 508e6cd9b6c55ef13ea3cfdf4df75d64bc4db220
5
5
  SHA512:
6
- metadata.gz: d7e950c87f45d9a67d6512183940e5a06af167fcc4e8fe87b195f672cbceb6de795e93099c5865868b9191a6eec6f2f867531e8fef2c1fb2d39343c64f2a5f88
7
- data.tar.gz: 7daa31a931589f899b29dbdd480d4324fb4e5e34e475a841b7267540a0eee64457c2907f925faba9e601fe5dcc7e86938629acc17918ddef65da127b5ffe2626
6
+ metadata.gz: 2d4496dd11d6731b1170dde9609d113f8db0a6411604c9cfb44682d26ea93cd64763b2a4f96bb71243b5f4aabb66633965eaf63110589ebe2dec7bb20559be6f
7
+ data.tar.gz: 0bd4423b848e6dd6d0fffb5b97206d1afbabf1a6f0ef32ad028df7db27bf01ae11519c4c373fa961293ffa4da7d00ee420e8554e5df9eb09ebd68b836657f974
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: 'c487443', require: false
11
+ # gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: '25e6852', 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
 
@@ -17,5 +17,5 @@ end
17
17
  group :misc do
18
18
  # Add your extra gems here
19
19
  # gem 'susy', require: 'susy'
20
- # gem 'redcarpet', require: 'redcarpet'
20
+ # gem 'bourbon', require: 'bourbon'
21
21
  end
@@ -17,5 +17,5 @@ end
17
17
  group :misc do
18
18
  # Add your extra gems here
19
19
  # gem 'susy', require: 'susy'
20
- # gem 'redcarpet', require: 'redcarpet'
21
- end
20
+ # gem 'bourbon', require: 'bourbon'
21
+ end
@@ -17,5 +17,5 @@ end
17
17
  group :misc do
18
18
  # Add your extra gems here
19
19
  # gem 'susy', require: 'susy'
20
- # gem 'redcarpet', require: 'redcarpet'
21
- end
20
+ # gem 'bourbon', require: 'bourbon'
21
+ end
@@ -17,5 +17,5 @@ end
17
17
  group :misc do
18
18
  # Add your extra gems here
19
19
  # gem 'susy', require: 'susy'
20
- # gem 'redcarpet', require: 'redcarpet'
21
- end
20
+ # gem 'bourbon', require: 'bourbon'
21
+ end
@@ -17,5 +17,5 @@ end
17
17
  group :misc do
18
18
  # Add your extra gems here
19
19
  # gem 'susy', require: 'susy'
20
- # gem 'redcarpet', require: 'redcarpet'
21
- end
20
+ # gem 'bourbon', require: 'bourbon'
21
+ end
@@ -32,6 +32,8 @@ module Locomotive::Wagon
32
32
  def push
33
33
  PushLogger.new if options[:verbose]
34
34
 
35
+ require_misc_gems
36
+
35
37
  api_client = build_api_site_client(connection_information)
36
38
 
37
39
  validate!
@@ -143,6 +145,11 @@ module Locomotive::Wagon
143
145
  @remote_site = SiteDecorator.new(_site)
144
146
  end
145
147
 
148
+ def require_misc_gems
149
+ require 'bundler'
150
+ Bundler.require 'misc'
151
+ end
152
+
146
153
  end
147
154
 
148
155
  end
@@ -15,6 +15,8 @@ module Locomotive::Wagon
15
15
  end
16
16
 
17
17
  def persist(decorated_entity)
18
+ return if decorated_entity.realname.starts_with?('_')
19
+
18
20
  precompile(decorated_entity)
19
21
 
20
22
  if (_entity = remote_entity(decorated_entity)).nil?
@@ -13,7 +13,9 @@ module Locomotive
13
13
  def __attributes__
14
14
  %i(name slug description label_field_name fields
15
15
  order_by order_direction group_by
16
- public_submission_enabled public_submission_accounts
16
+ public_submission_enabled
17
+ public_submission_accounts
18
+ public_submission_title_template
17
19
  entry_template display_settings)
18
20
  end
19
21
 
@@ -52,6 +54,10 @@ module Locomotive
52
54
  self[:public_submission_accounts]
53
55
  end
54
56
 
57
+ def public_submission_title_template
58
+ self[:public_submission_title_template]
59
+ end
60
+
55
61
  def entry_template
56
62
  self[:entry_template]
57
63
  end
@@ -5,6 +5,17 @@ module Locomotive
5
5
 
6
6
  include ToHashConcern
7
7
 
8
+ EXTENSIONS_TABLE = {
9
+ '.scss' => '.css',
10
+ '.css.scss' => '.css',
11
+ '.sass' => '.css',
12
+ '.css.sass' => '.css',
13
+ '.less' => '.css',
14
+ '.css.less' => '.css',
15
+ '.coffee' => '.js',
16
+ '.js.coffee' => '.js'
17
+ }.freeze
18
+
8
19
  def __attributes__
9
20
  %i(source folder checksum)
10
21
  end
@@ -18,13 +29,23 @@ module Locomotive
18
29
  end
19
30
 
20
31
  def stylesheet_or_javascript?
21
- File.extname(realname) =~ /^(\.css|\.js)/
32
+ File.extname(realname) =~ /^\.(css|scss|less|js|coffee)/
22
33
  end
23
34
 
24
35
  def checksum
25
36
  Digest::MD5.hexdigest(File.read(filepath))
26
37
  end
27
38
 
39
+ # - memoize it because it will not change even if we change the filepath (or source)
40
+ # - we keep the first extension and drop the others (.coffee, .scss, ...etc)
41
+ def realname
42
+ return @realname if @realname
43
+
44
+ filename = File.basename(filepath)
45
+
46
+ @realname = _realname(filename, 2) || _realname(filename, 1) || filename
47
+ end
48
+
28
49
  def relative_url
29
50
  "#{folder.gsub('\\', '/')}/#{realname}"
30
51
  end
@@ -33,16 +54,6 @@ module Locomotive
33
54
  relative_url[/^(javascripts|stylesheets|fonts)\/(.*)$/, 2]
34
55
  end
35
56
 
36
- def realname
37
- # - memoize it because it will not change even if we change the filepath (or source)
38
- # - we keep the first extension and drop the others (.coffee, .scss, ...etc)
39
- @realname ||= if Sprockets.engine_extensions.include?(File.extname(filepath))
40
- File.basename(filepath).split('.')[0..1].join('.')
41
- else
42
- File.basename(filepath)
43
- end
44
- end
45
-
46
57
  def filepath
47
58
  __getobj__.source
48
59
  end
@@ -51,6 +62,16 @@ module Locomotive
51
62
  __getobj__[:source] = path
52
63
  end
53
64
 
65
+ private
66
+
67
+ def _realname(filename, length)
68
+ extension = '.' + filename.split('.').last(length).join('.')
69
+
70
+ if new_extension = EXTENSIONS_TABLE[extension]
71
+ File.basename(filename, extension) + new_extension
72
+ end
73
+ end
74
+
54
75
  end
55
76
 
56
77
  end
@@ -1,5 +1,5 @@
1
1
  module Locomotive
2
2
  module Wagon
3
- VERSION = '2.0.0.rc1'
3
+ VERSION = '2.0.0.rc2'
4
4
  end
5
5
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
26
26
  gem.add_dependency 'netrc', '~> 0.10.3'
27
27
 
28
28
  gem.add_dependency 'locomotivecms_coal', '~> 1.0.0.rc1'
29
- gem.add_dependency 'locomotivecms_steam', '~> 1.0.0.rc1'
29
+ gem.add_dependency 'locomotivecms_steam', '~> 1.0.0.rc2'
30
30
 
31
31
  gem.add_dependency 'listen', '~> 2.10.0'
32
32
  gem.add_dependency 'rack-livereload', '~> 0.3.15'
@@ -0,0 +1,79 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require 'ostruct'
5
+
6
+ require 'locomotive/wagon/decorators/concerns/to_hash_concern'
7
+ require 'locomotive/wagon/decorators/theme_asset_decorator'
8
+
9
+ describe Locomotive::Wagon::ThemeAssetDecorator do
10
+
11
+ let(:filepath) { '/somewhere/mysite/public/stylesheets/application.css' }
12
+ let(:asset) { instance_double('Asset', source: filepath) }
13
+ let(:decorator) { described_class.new(asset) }
14
+
15
+ describe '#realname' do
16
+
17
+ subject { decorator.realname }
18
+
19
+ describe 'no extension' do
20
+ let(:filepath) { '/somewhere/mysite/public/stylesheets/application' }
21
+ it { is_expected.to eq 'application' }
22
+ end
23
+
24
+ describe 'css' do
25
+
26
+ it { is_expected.to eq 'application.css' }
27
+
28
+ describe 'scss extension' do
29
+ let(:filepath) { '/somewhere/mysite/public/stylesheets/application.scss' }
30
+ it { is_expected.to eq 'application.css' }
31
+ end
32
+
33
+ describe 'css.scss extension' do
34
+ let(:filepath) { '/somewhere/mysite/public/stylesheets/application.css.scss' }
35
+ it { is_expected.to eq 'application.css' }
36
+ end
37
+
38
+ describe 'sass extension' do
39
+ let(:filepath) { '/somewhere/mysite/public/stylesheets/application.sass' }
40
+ it { is_expected.to eq 'application.css' }
41
+ end
42
+
43
+ describe 'css.sass extension' do
44
+ let(:filepath) { '/somewhere/mysite/public/stylesheets/application.css.sass' }
45
+ it { is_expected.to eq 'application.css' }
46
+ end
47
+
48
+ describe 'less extension' do
49
+ let(:filepath) { '/somewhere/mysite/public/stylesheets/application.less' }
50
+ it { is_expected.to eq 'application.css' }
51
+ end
52
+
53
+ describe 'css.less extension' do
54
+ let(:filepath) { '/somewhere/mysite/public/stylesheets/application.css.less' }
55
+ it { is_expected.to eq 'application.css' }
56
+ end
57
+
58
+ end
59
+
60
+ describe 'js' do
61
+
62
+ let(:filepath) { '/somewhere/mysite/public/javascripts/application.js' }
63
+ it { is_expected.to eq 'application.js' }
64
+
65
+ describe 'coffee extension' do
66
+ let(:filepath) { '/somewhere/mysite/public/javascripts/application.coffee' }
67
+ it { is_expected.to eq 'application.js' }
68
+ end
69
+
70
+ describe 'js.coffee extension' do
71
+ let(:filepath) { '/somewhere/mysite/public/javascripts/application.js.coffee' }
72
+ it { is_expected.to eq 'application.js' }
73
+ end
74
+
75
+ end
76
+
77
+ end
78
+
79
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotivecms_wagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc1
4
+ version: 2.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-14 00:00:00.000000000 Z
12
+ date: 2015-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -101,14 +101,14 @@ dependencies:
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: 1.0.0.rc1
104
+ version: 1.0.0.rc2
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: 1.0.0.rc1
111
+ version: 1.0.0.rc2
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: listen
114
114
  requirement: !ruby/object:Gem::Requirement
@@ -658,6 +658,7 @@ files:
658
658
  - spec/support/vcr.rb
659
659
  - spec/unit/commands/pull_sub_commands/concerns/assets_concern_spec.rb
660
660
  - spec/unit/decorators/site_decorator_spec.rb
661
+ - spec/unit/decorators/theme_asset_decorator_spec.rb
661
662
  homepage: http://www.locomotivecms.com
662
663
  licenses: []
663
664
  metadata: {}
@@ -783,3 +784,4 @@ test_files:
783
784
  - spec/support/vcr.rb
784
785
  - spec/unit/commands/pull_sub_commands/concerns/assets_concern_spec.rb
785
786
  - spec/unit/decorators/site_decorator_spec.rb
787
+ - spec/unit/decorators/theme_asset_decorator_spec.rb