disco_app 0.9.4 → 0.9.5

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
  SHA256:
3
- metadata.gz: 7b67b4667e899a379d0cc4152f228bfe7a80bef4aa6b35c26f54ee76c20c967f
4
- data.tar.gz: d421b6283198d07e8ddc9a902e71a13320745e84f8fd5b3dbc981e6e88b70062
3
+ metadata.gz: f1b17eb89a3f6a2f3caaa40ec50fb2a17bc8cccbd21722590efb17fce2bcb305
4
+ data.tar.gz: 204dbf1c5ecde8bec93d4383d7a13289a5155fd9162a2e9f1a43947d6a71b8ed
5
5
  SHA512:
6
- metadata.gz: b713f8e47aefe3614a2016bad8046d91fdee669fa5635f3768d167d9c6768622af51ec5f6cb711040f7d712dc2cdac2e9f879f4d752956c008444de52ad326ec
7
- data.tar.gz: df1e8549d1e7474f137bc7d6a483f7e06450f26273181bdb4724b79003d6a3f51e19b4b29c6d0736f2f390e9d2c8dcd922d5b7e1785717166e70f6e152b4ebdd
6
+ metadata.gz: deef290c436235c522ad85d5ecfb337e1d7f156f2b4410cadd73d8e873c06822e46556a1a2a95951ca516d65ee72528fe5301c3866e5c68d112f88795b2d3a7d
7
+ data.tar.gz: f3d12b4672edc1517d712a3ff8071fdb0c48fb43bfbb2d1dd1e4fd164c78d626a4fbb64ae33e14f8ef4f7cee10ec76d6576e6590ddaef4cb45de3664b2254124
@@ -94,7 +94,7 @@ module DiscoApp::Concerns::RendersAssets
94
94
  # Create/replace the asset via the Shopify API.
95
95
  shopify_asset = shop.temp {
96
96
  ShopifyAPI::Asset.create(
97
- key: "assets/#{asset}",
97
+ key: asset,
98
98
  value: render_asset_group_asset(asset, public_urls)
99
99
  )
100
100
  }
@@ -102,7 +102,9 @@ module DiscoApp::Concerns::RendersAssets
102
102
  # Store the public URL to this asset, so that we're able to use it in
103
103
  # subsequent template renders. Adds a .css suffix to .scss assets, so that
104
104
  # we use the Shopify-compiled version of any SCSS stylesheets.
105
- public_urls[asset] = shopify_asset.public_url.gsub(/\.scss\?/, '.scss.css?')
105
+ if shopify_asset.public_url.present?
106
+ public_urls[asset] = shopify_asset.public_url.gsub(/\.scss\?/, '.scss.css?')
107
+ end
106
108
  end
107
109
 
108
110
  # If we specified the creation of any script tags based on newly rendered
@@ -117,7 +119,7 @@ module DiscoApp::Concerns::RendersAssets
117
119
  # Render an individual asset within an asset group.
118
120
  def render_asset_group_asset(asset, public_urls)
119
121
  render_asset_renderer.render_to_string(
120
- template: "assets/#{asset}",
122
+ template: asset,
121
123
  layout: nil,
122
124
  locals: {
123
125
  :"@#{self.class.name.underscore}" => self,
@@ -1,3 +1,3 @@
1
1
  module DiscoApp
2
- VERSION = '0.9.4'
2
+ VERSION = '0.9.5'
3
3
  end
@@ -3,6 +3,6 @@ class JsConfiguration < ActiveRecord::Base
3
3
 
4
4
  belongs_to :shop, class_name: 'DiscoApp::Shop'
5
5
 
6
- renders_assets :js_assets, assets: 'test.js', triggered_by: 'locale'
6
+ renders_assets :js_assets, assets: 'assets/test.js', triggered_by: 'locale'
7
7
 
8
8
  end
@@ -3,8 +3,8 @@ class WidgetConfiguration < ActiveRecord::Base
3
3
 
4
4
  belongs_to :shop, class_name: 'DiscoApp::Shop'
5
5
 
6
- renders_assets :widget_assets, assets: ['widget.scss', 'widget.js'], triggered_by: ['locale', 'background_color']
7
- renders_assets :liquid_assets, assets: 'widget.liquid', triggered_by: ['locale']
8
- renders_assets :script_tag_assets, assets: 'script_tag.js', script_tags: 'script_tag.js'
6
+ renders_assets :widget_assets, assets: ['assets/widget.scss', 'assets/widget.js'], triggered_by: ['locale', 'background_color']
7
+ renders_assets :liquid_assets, assets: 'snippets/widget.liquid', triggered_by: ['locale']
8
+ renders_assets :script_tag_assets, assets: 'assets/script_tag.js', script_tags: 'assets/script_tag.js'
9
9
 
10
10
  end
@@ -1,2 +1,2 @@
1
1
  var locale = '<%= @widget_configuration.locale %>';
2
- var cssUrl = '<%= @public_urls[:'widget.scss'] %>';
2
+ var cssUrl = '<%= @public_urls[:'assets/widget.scss'] %>';
@@ -0,0 +1 @@
1
+ {{ shop.metafields.locales['<%= @widget_configuration.locale %>'] }}
@@ -0,0 +1,6 @@
1
+ {
2
+ "asset":{
3
+ "key":"snippets/widget.liquid",
4
+ "value":"{{ shop.metafields.locales['sv'] }}\n"
5
+ }
6
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "asset": {
3
+ "key": "snippets/widget.liquid",
4
+ "public_url": null,
5
+ "created_at": "2016-06-01T09:17:11-04:00",
6
+ "updated_at": "2016-06-01T09:17:11-04:00",
7
+ "content_type": "text/x-liquid",
8
+ "size": 36,
9
+ "theme_id": 106913286,
10
+ "warnings": []
11
+ }
12
+ }
@@ -61,7 +61,7 @@ class DiscoApp::RendersAssetsTest < ActiveSupport::TestCase
61
61
  ##
62
62
 
63
63
  test 'individual js asset renders correctly' do
64
- assert_equal asset_fixture('test.js'), @js_configuration.send('render_asset_group_asset', 'test.js', {})
64
+ assert_equal asset_fixture('test.js'), @js_configuration.send('render_asset_group_asset', 'assets/test.js', {})
65
65
  end
66
66
 
67
67
  test 'js asset group renders and uploads to shopify' do
@@ -75,6 +75,11 @@ class DiscoApp::RendersAssetsTest < ActiveSupport::TestCase
75
75
  @widget_configuration.render_asset_group(:widget_assets)
76
76
  end
77
77
 
78
+ test 'liquid asset group renders and uploads to shopify' do
79
+ stub_api_request(:put, "#{@shop.admin_url}/assets.json", 'widget_store/assets/create_widget_liquid')
80
+ @widget_configuration.render_asset_group(:liquid_assets)
81
+ end
82
+
78
83
  test 'script tag asset group renders, uploads to shopify and creates new script tag' do
79
84
  stub_api_request(:put, "#{@shop.admin_url}/assets.json", 'widget_store/assets/create_script_tag_js')
80
85
  stub_api_request(:get, "#{@shop.admin_url}/script_tags.json", 'widget_store/assets/get_script_tags_empty')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disco_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Ballard
@@ -547,6 +547,7 @@ files:
547
547
  - test/dummy/app/views/assets/widget.js.erb
548
548
  - test/dummy/app/views/assets/widget.scss.erb
549
549
  - test/dummy/app/views/home/index.html.erb
550
+ - test/dummy/app/views/snippets/widget.liquid.erb
550
551
  - test/dummy/bin/bundle
551
552
  - test/dummy/bin/rails
552
553
  - test/dummy/bin/rake
@@ -591,6 +592,8 @@ files:
591
592
  - test/fixtures/api/widget_store/assets/create_test_js_response.json
592
593
  - test/fixtures/api/widget_store/assets/create_widget_js_request.json
593
594
  - test/fixtures/api/widget_store/assets/create_widget_js_response.json
595
+ - test/fixtures/api/widget_store/assets/create_widget_liquid_request.json
596
+ - test/fixtures/api/widget_store/assets/create_widget_liquid_response.json
594
597
  - test/fixtures/api/widget_store/assets/create_widget_scss_request.json
595
598
  - test/fixtures/api/widget_store/assets/create_widget_scss_response.json
596
599
  - test/fixtures/api/widget_store/assets/get_script_tags_empty_request.json
@@ -699,6 +702,7 @@ test_files:
699
702
  - test/dummy/app/views/assets/widget.scss.erb
700
703
  - test/dummy/app/views/assets/test.js.erb
701
704
  - test/dummy/app/views/assets/widget.js.erb
705
+ - test/dummy/app/views/snippets/widget.liquid.erb
702
706
  - test/dummy/app/views/home/index.html.erb
703
707
  - test/dummy/db/migrate/20160530160739_create_asset_models.rb
704
708
  - test/dummy/db/migrate/20160307182229_create_products.rb
@@ -735,10 +739,12 @@ test_files:
735
739
  - test/fixtures/api/widget_store/assets/create_script_tag_js_response.json
736
740
  - test/fixtures/api/widget_store/assets/create_widget_scss_request.json
737
741
  - test/fixtures/api/widget_store/assets/update_script_tag_response.json
742
+ - test/fixtures/api/widget_store/assets/create_widget_liquid_request.json
738
743
  - test/fixtures/api/widget_store/assets/create_script_tag_js_request.json
739
744
  - test/fixtures/api/widget_store/assets/create_script_tag_request.json
740
745
  - test/fixtures/api/widget_store/assets/get_script_tags_preexisting_response.json
741
746
  - test/fixtures/api/widget_store/assets/create_widget_scss_response.json
747
+ - test/fixtures/api/widget_store/assets/create_widget_liquid_response.json
742
748
  - test/fixtures/api/widget_store/assets/get_script_tags_preexisting_request.json
743
749
  - test/fixtures/api/widget_store/assets/get_script_tags_empty_response.json
744
750
  - test/fixtures/api/widget_store/assets/get_script_tags_empty_request.json