binda-shopify 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +31 -0
- data/Rakefile +36 -0
- data/app/controllers/binda/shopify/application_controller.rb +7 -0
- data/app/controllers/binda/shopify/imports_controller.rb +18 -0
- data/app/helpers/binda/shopify/application_helper.rb +6 -0
- data/app/jobs/binda/shopify/application_job.rb +6 -0
- data/app/mailers/binda/shopify/application_mailer.rb +8 -0
- data/app/models/binda/shopify/application_record.rb +7 -0
- data/app/overrides/head.rb +5 -0
- data/app/overrides/main_sidebar.rb +4 -0
- data/app/views/layouts/binda/shopify/application.html.erb +14 -0
- data/app/views/shared/_javascript.html.erb +36 -0
- data/app/views/shared/_synchronize.html.erb +5 -0
- data/config/database.yml.travis +3 -0
- data/config/locales/en.yml +6 -0
- data/config/locales/it.yml +6 -0
- data/config/routes.rb +5 -0
- data/lib/binda/shopify/collection.rb +9 -0
- data/lib/binda/shopify/engine.rb +12 -0
- data/lib/binda/shopify/importer.rb +89 -0
- data/lib/binda/shopify/installer.rb +49 -0
- data/lib/binda/shopify/item.rb +28 -0
- data/lib/binda/shopify/product.rb +36 -0
- data/lib/binda/shopify/product_type.rb +20 -0
- data/lib/binda/shopify/version.rb +5 -0
- data/lib/binda/shopify.rb +35 -0
- data/lib/generators/binda/shopify/install_generator.rb +44 -0
- data/lib/tasks/binda/shopify_tasks.rake +4 -0
- metadata +225 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0de8e1630d6d3ca6fe0992c338bf2f1183969b48
|
4
|
+
data.tar.gz: 2a4d86220701a66cd14003d69d2d2cf57493c196
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 67f93ad5bbe7a74860849871ec3d6235306eda5af4d82416cdc8acfe20335ed6fd3c482e93b82ac804704133b78e1daf66df726a408250d08b16d46c349e8798
|
7
|
+
data.tar.gz: 931d0fb4afeb6bf8f970f9a37e8e311dfae2673836d63a62f4c6f0129708955adfc200438610eca4d33d1948389a52f29fae2c1a3b74ceb215c7933a48c786e0
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2018 Marco Crepaldi
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Binda Shopify
|
2
|
+
Extension that lets you import your Shopify products into your Binda application.
|
3
|
+
|
4
|
+
**Binda** is a headless CMS with an intuitive out-of-the-box interface which makes very easy creating application infrastructures. For more info about Binda structure please visit the [official documentation](http://www.rubydoc.info/gems/binda)
|
5
|
+
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/00f7b3a4bb33ea7637c2/maintainability)](https://codeclimate.com/github/lacolonia/binda-shopify/maintainability)
|
7
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/00f7b3a4bb33ea7637c2/test_coverage)](https://codeclimate.com/github/lacolonia/binda-shopify/test_coverage)
|
8
|
+
|
9
|
+
# Installation
|
10
|
+
|
11
|
+
Install Binda via terminal
|
12
|
+
|
13
|
+
Just add the gem to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'binda-shopify', github: 'lacolonia/binda-shopify'
|
17
|
+
```
|
18
|
+
|
19
|
+
Then, run:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
bundle install
|
23
|
+
```
|
24
|
+
|
25
|
+
After that, you need to setup your connection to Shopify and create `Binda::Structures` where your data will be imported.
|
26
|
+
|
27
|
+
```bash
|
28
|
+
bundle exec rails generate binda:shopify:install
|
29
|
+
```
|
30
|
+
|
31
|
+
Now you are good to go!
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Binda::Shopify'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
require 'bundler/gem_tasks'
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'test'
|
31
|
+
t.pattern = 'test/**/*_test.rb'
|
32
|
+
t.verbose = false
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
task default: :test
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_dependency "binda/application_controller"
|
2
|
+
|
3
|
+
module Binda
|
4
|
+
module Shopify
|
5
|
+
class ImportsController < ::Binda::ApplicationController
|
6
|
+
def import
|
7
|
+
importer = ::Binda::Shopify::Importer.new
|
8
|
+
importer.run!
|
9
|
+
|
10
|
+
structure_name = STRUCTURES.keys.first
|
11
|
+
settings = ::Binda::Structure.find_by(slug: 'shopify-settings').board
|
12
|
+
structure_slug = settings.get_string("#{settings.slug}-#{structure_name.to_s.gsub('_', '-')}").strip.parameterize
|
13
|
+
structure = ::Binda::Structure.find_by slug: structure_slug
|
14
|
+
redirect_to binda.structure_components_path( structure ), notice: 'Import was succesful!'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Binda shopify</title>
|
5
|
+
<%= stylesheet_link_tag "binda/shopify/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "binda/shopify/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<script>
|
2
|
+
$(function(){
|
3
|
+
$( window ).on('beforeunload', function(){
|
4
|
+
if($('.popup-warning').css('opacity') == '1'){
|
5
|
+
return 'Please, wait until popup is closed.';
|
6
|
+
}
|
7
|
+
});
|
8
|
+
|
9
|
+
$('.main-sidebar--nav').on("click", ".synch-with-shopify", function(){
|
10
|
+
var $this = $(this);
|
11
|
+
var $popup = $(".popup-warning");
|
12
|
+
var $loader = $(".popup-warning--loader");
|
13
|
+
var $message = $(".popup-warning--message");
|
14
|
+
var $success = $(".popup-warning--success");
|
15
|
+
var synch_url = $this.attr('href');
|
16
|
+
|
17
|
+
if($loader.hasClass('popup-warning--loader--hidden')){
|
18
|
+
$loader.removeClass('popup-warning--loader--hidden');
|
19
|
+
}
|
20
|
+
if(!$success.hasClass('popup-warning--loader--hidden')){
|
21
|
+
$success.addClass('popup-warning--success--hidden');
|
22
|
+
}
|
23
|
+
$message.text($this.data("message"));
|
24
|
+
$popup.removeClass("popup-warning--hidden");
|
25
|
+
$.get(synch_url, function(data){
|
26
|
+
$message.text($this.data("success"));
|
27
|
+
$loader.addClass('popup-warning--loader--hidden');
|
28
|
+
$(".popup-warning--success").removeClass('popup-warning--success--hidden');
|
29
|
+
window.setTimeout(function(){
|
30
|
+
$(".popup-warning").addClass("popup-warning--hidden");
|
31
|
+
}, 2000);
|
32
|
+
})
|
33
|
+
return false;
|
34
|
+
});
|
35
|
+
});
|
36
|
+
</script>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<li>
|
2
|
+
<a class="synch-with-shopify" data-message="<%= I18n.t('binda.shopify.loading') %>" data-success="<%= I18n.t('binda.shopify.success') %>" href="<%= shopify_import_path %>">
|
3
|
+
<i class="fas fa-sync"></i> <%= I18n.t('binda.shopify.synch_with_shopify') %>
|
4
|
+
</a>
|
5
|
+
</li>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'shopify_api'
|
2
|
+
|
3
|
+
module Binda
|
4
|
+
module Shopify
|
5
|
+
class Importer
|
6
|
+
attr_accessor :client, :settings
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
settings_slug = 'shopify-settings'
|
10
|
+
@settings = ::Binda::Structure.find_by(slug: 'shopify-settings').board
|
11
|
+
api_key, password, shared_secret, shop_name = ::Binda::Shopify::CONNECTION_KEYS.map{|field| settings.get_string("#{settings_slug}-#{field.to_s.gsub('_', '-')}").strip }
|
12
|
+
|
13
|
+
@client = ::ShopifyAPI
|
14
|
+
@client::Base.site = "https://#{api_key}:#{password}@#{shop_name}.myshopify.com/admin"
|
15
|
+
@client::Session.setup(api_key: api_key, secret: shared_secret)
|
16
|
+
end
|
17
|
+
|
18
|
+
def run!
|
19
|
+
start_time = Time.now
|
20
|
+
::Binda::Shopify::STRUCTURES.each do |name, structure_fields|
|
21
|
+
structure_slug = settings.get_string("#{@settings.slug}-#{name.to_s.gsub('_', '-')}").strip.parameterize
|
22
|
+
structure = ::Binda::Structure.find_by slug: structure_slug
|
23
|
+
send("fetch_#{name.to_s.pluralize}").each do |item|
|
24
|
+
if item.id.present?
|
25
|
+
component = ::Binda::Component.find_or_initialize_by slug: item.id, structure: structure
|
26
|
+
component.name ||= item.title
|
27
|
+
component.publish_state = 'published'
|
28
|
+
component.updated_at = Time.now
|
29
|
+
component.save
|
30
|
+
structure_fields.each do |field_group_slug, fields|
|
31
|
+
field_group_slug = "#{structure_slug}-#{field_group_slug}"
|
32
|
+
field_group = structure.field_groups.find_by slug: field_group_slug
|
33
|
+
if field_group
|
34
|
+
fields.each do |field_slug_and_type, method|
|
35
|
+
field_slug, type = field_slug_and_type.split(':')
|
36
|
+
type ||= 'string'
|
37
|
+
|
38
|
+
field_setting = field_group.field_settings.find_by(slug: "#{field_group_slug}-#{field_slug}")
|
39
|
+
field_type_association = type.pluralize
|
40
|
+
if ::Binda::Component.reflections.keys.include? field_type_association
|
41
|
+
component.send(field_type_association).find_by(field_setting_id: field_setting.id).update content: item.send(method) if field_setting
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
structure.components.where("updated_at < ?", start_time).update_all publish_state: 'draft'
|
49
|
+
end
|
50
|
+
|
51
|
+
::Binda::Shopify::STRUCTURES.keys
|
52
|
+
end
|
53
|
+
|
54
|
+
def fetch_collections
|
55
|
+
items = []
|
56
|
+
number_of_pages = (@client::CustomCollection.count / 250.0).ceil
|
57
|
+
number_of_pages.times do |i|
|
58
|
+
@client::CustomCollection.find(:all, params: { limit: 250, page: i+1}).each do |p|
|
59
|
+
items << ::Binda::Shopify::Collection.new(p, shop)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
items
|
64
|
+
end
|
65
|
+
|
66
|
+
def fetch_products
|
67
|
+
items = []
|
68
|
+
number_of_pages = (@client::Product.count / 250.0).ceil
|
69
|
+
number_of_pages.times do |i|
|
70
|
+
@client::Product.find(:all, params: { limit: 250, page: i+1}).each do |p|
|
71
|
+
items << ::Binda::Shopify::Product.new(p, shop)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
items
|
76
|
+
end
|
77
|
+
|
78
|
+
def fetch_product_types
|
79
|
+
products = fetch_products
|
80
|
+
product_types = products.map(&:product_type).uniq
|
81
|
+
product_types.map{|p| ::Binda::Shopify::ProductType.new(p, shop) }
|
82
|
+
end
|
83
|
+
|
84
|
+
def shop
|
85
|
+
@shop ||= @client::Shop.current
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Binda
|
2
|
+
module Shopify
|
3
|
+
class Installer
|
4
|
+
def create_settings_board values
|
5
|
+
raise ArgumentError.new 'You must provide an array or hash of settings values' unless values.is_a?(Array) || values.is_a?(Hash)
|
6
|
+
values = Hash[(CONNECTION_KEYS+STRUCTURES.keys).zip(values)] if values.is_a? Array
|
7
|
+
structure = Binda::Structure.find_or_create_by( name: 'Shopify Settings', slug: 'shopify-settings', instance_type: 'board' )
|
8
|
+
board = structure.board
|
9
|
+
field_settings = structure.field_groups.first.field_settings
|
10
|
+
CONNECTION_KEYS.each do |field_name|
|
11
|
+
field_value = values[field_name]
|
12
|
+
slug = [structure.slug, field_name.to_s.parameterize].join('-').gsub('_', '-')
|
13
|
+
field = field_settings.find_or_create_by( name: field_name.to_s.titleize, slug: slug, field_type: 'string' )
|
14
|
+
board.strings.find_or_create_by( field_setting_id: field.id ).update_attribute('content', field_value.strip)
|
15
|
+
end
|
16
|
+
|
17
|
+
STRUCTURES.keys.each do |structure_name|
|
18
|
+
field_value = values[structure_name]
|
19
|
+
slug = [structure.slug, structure_name.to_s.parameterize].join('-').gsub('_', '-')
|
20
|
+
field = field_settings.find_or_create_by( name: structure_name.to_s.titleize, slug: slug, field_type: 'string' )
|
21
|
+
board.strings.find_or_create_by( field_setting_id: field.id ).update_attribute('content', field_value.strip)
|
22
|
+
end
|
23
|
+
|
24
|
+
board
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_item_structure structure_name, name
|
28
|
+
structure_slug = name.parameterize
|
29
|
+
structure = Binda::Structure.find_or_create_by name: name, slug: structure_slug, instance_type: 'component', has_categories: false
|
30
|
+
Binda::Shopify::STRUCTURES[structure_name.to_sym].each do |field_group_slug, fields|
|
31
|
+
field_group = structure.field_groups.find_by slug: "#{structure_slug}-#{field_group_slug}"
|
32
|
+
if field_group.nil?
|
33
|
+
field_group = structure.field_groups.create! name: field_group_slug.titleize, slug: "#{structure_slug}-#{field_group_slug}"
|
34
|
+
end
|
35
|
+
fields.each do |name_and_type, mapping|
|
36
|
+
name, type = name_and_type.split(':')
|
37
|
+
type ||= 'string'
|
38
|
+
humanized_name = name.humanize(keep_id_suffix: true).gsub('-', ' ')
|
39
|
+
field_group.field_settings.create! name: humanized_name, field_type: type, read_only: true
|
40
|
+
end
|
41
|
+
field_group.save
|
42
|
+
end
|
43
|
+
|
44
|
+
structure
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Binda
|
2
|
+
module Shopify
|
3
|
+
class Item
|
4
|
+
attr_accessor :item, :shop
|
5
|
+
|
6
|
+
def initialize item, shop
|
7
|
+
@item = item
|
8
|
+
@shop = shop
|
9
|
+
end
|
10
|
+
|
11
|
+
def id
|
12
|
+
item.id
|
13
|
+
end
|
14
|
+
|
15
|
+
def edit_url
|
16
|
+
"https://#{shop.domain}/admin/#{item.model_name.element.pluralize}/#{item.id}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def method_missing name, params = nil, &block
|
20
|
+
if item.respond_to? name
|
21
|
+
item.send(name, params)
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Binda
|
2
|
+
module Shopify
|
3
|
+
class Product
|
4
|
+
attr_accessor :product, :shop
|
5
|
+
def initialize product, shop
|
6
|
+
@product = product
|
7
|
+
@shop = shop
|
8
|
+
end
|
9
|
+
|
10
|
+
def id
|
11
|
+
product.id
|
12
|
+
end
|
13
|
+
|
14
|
+
def inventory_item_id
|
15
|
+
variant = variants.first
|
16
|
+
if variant.respond_to? :inventory_item_id
|
17
|
+
variant.inventory_item_id if !variant.nil?
|
18
|
+
else
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def edit_url
|
24
|
+
"https://#{shop.domain}/admin/products/#{product.id}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def method_missing name, params = nil, &block
|
28
|
+
if product.respond_to? name
|
29
|
+
product.send(name, params)
|
30
|
+
else
|
31
|
+
super
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'digest'
|
2
|
+
|
3
|
+
module Binda
|
4
|
+
module Shopify
|
5
|
+
class ProductType
|
6
|
+
attr_accessor :name
|
7
|
+
def initialize name, shop
|
8
|
+
@name = name
|
9
|
+
end
|
10
|
+
|
11
|
+
def title
|
12
|
+
name
|
13
|
+
end
|
14
|
+
|
15
|
+
def id
|
16
|
+
Digest::MD5.hexdigest self.title if self.title.present?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'binda'
|
2
|
+
require "binda/shopify/engine"
|
3
|
+
require 'binda/shopify/importer'
|
4
|
+
require 'binda/shopify/item'
|
5
|
+
require 'binda/shopify/product'
|
6
|
+
require 'binda/shopify/collection'
|
7
|
+
require 'binda/shopify/product_type'
|
8
|
+
require 'deface'
|
9
|
+
|
10
|
+
module Binda
|
11
|
+
module Shopify
|
12
|
+
CONNECTION_KEYS = %i(api_key password shared_secret shop_name)
|
13
|
+
STRUCTURES = {
|
14
|
+
product: {
|
15
|
+
'shopify-details' => {
|
16
|
+
'handle' => 'handle',
|
17
|
+
'edit-product-url' => 'edit_url',
|
18
|
+
'inventory-item-id' => 'inventory_item_id'
|
19
|
+
}
|
20
|
+
},
|
21
|
+
collection: {
|
22
|
+
'shopify-details' => {
|
23
|
+
'edit-collection-url' => 'edit_url',
|
24
|
+
'handle' => 'handle',
|
25
|
+
'sorted-products:text' => 'sorted_products'
|
26
|
+
}
|
27
|
+
},
|
28
|
+
product_type: {
|
29
|
+
'shopify-details' => {
|
30
|
+
'handle' => 'name'
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Binda
|
2
|
+
module Shopify
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates',__FILE__)
|
5
|
+
attr_accessor :structure
|
6
|
+
|
7
|
+
def start
|
8
|
+
puts "Ok, let'do this!"
|
9
|
+
end
|
10
|
+
|
11
|
+
def create_shopify_settings
|
12
|
+
puts "1) Setting up Shopify Connection"
|
13
|
+
@installer = Installer.new
|
14
|
+
@settings = {}
|
15
|
+
Binda::Shopify::CONNECTION_KEYS.each do |field_name|
|
16
|
+
STDOUT.puts "What is your Shopify #{field_name.to_s.titleize}?"
|
17
|
+
@settings[field_name] = STDIN.gets.strip
|
18
|
+
end
|
19
|
+
Binda::Shopify::STRUCTURES.each do |structure_name, structure_fields|
|
20
|
+
default_name = "Shopify #{structure_name.to_s.titleize}"
|
21
|
+
puts "How would you like to name your #{structure_name} structure? ['#{default_name}']"
|
22
|
+
@settings[structure_name] = STDIN.gets.strip.presence || default_name
|
23
|
+
end
|
24
|
+
@settings_board = @installer.create_settings_board @settings
|
25
|
+
puts
|
26
|
+
end
|
27
|
+
|
28
|
+
def setup_structures
|
29
|
+
Binda::Shopify::STRUCTURES.each.with_index do |(structure_name, structure_fields), index|
|
30
|
+
name = @settings[structure_name].presence || structure_name.to_s.titleize
|
31
|
+
puts "#{index+2}) Setting up #{name} Structure"
|
32
|
+
@installer.create_item_structure structure_name, name
|
33
|
+
puts
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def finish
|
38
|
+
puts "Done!"
|
39
|
+
puts
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
metadata
ADDED
@@ -0,0 +1,225 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: binda-shopify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marco Crepaldi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: binda
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.9
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.9
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: shopify_api
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.11'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: deface
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pg
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.5'
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '3.8'
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '3.5'
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '3.8'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: byebug
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '10.0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '10.0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: factory_bot_rails
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '4.8'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '4.8'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: database_cleaner
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '1.6'
|
138
|
+
- - "<"
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '2'
|
141
|
+
type: :development
|
142
|
+
prerelease: false
|
143
|
+
version_requirements: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '1.6'
|
148
|
+
- - "<"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '2'
|
151
|
+
- !ruby/object:Gem::Dependency
|
152
|
+
name: shopify-mock
|
153
|
+
requirement: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - "~>"
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: 0.1.2
|
158
|
+
type: :development
|
159
|
+
prerelease: false
|
160
|
+
version_requirements: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - "~>"
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 0.1.2
|
165
|
+
description: ''
|
166
|
+
email:
|
167
|
+
- marco.crepaldi@gmail.com
|
168
|
+
executables: []
|
169
|
+
extensions: []
|
170
|
+
extra_rdoc_files: []
|
171
|
+
files:
|
172
|
+
- MIT-LICENSE
|
173
|
+
- README.md
|
174
|
+
- Rakefile
|
175
|
+
- app/controllers/binda/shopify/application_controller.rb
|
176
|
+
- app/controllers/binda/shopify/imports_controller.rb
|
177
|
+
- app/helpers/binda/shopify/application_helper.rb
|
178
|
+
- app/jobs/binda/shopify/application_job.rb
|
179
|
+
- app/mailers/binda/shopify/application_mailer.rb
|
180
|
+
- app/models/binda/shopify/application_record.rb
|
181
|
+
- app/overrides/head.rb
|
182
|
+
- app/overrides/main_sidebar.rb
|
183
|
+
- app/views/layouts/binda/shopify/application.html.erb
|
184
|
+
- app/views/shared/_javascript.html.erb
|
185
|
+
- app/views/shared/_synchronize.html.erb
|
186
|
+
- config/database.yml.travis
|
187
|
+
- config/locales/en.yml
|
188
|
+
- config/locales/it.yml
|
189
|
+
- config/routes.rb
|
190
|
+
- lib/binda/shopify.rb
|
191
|
+
- lib/binda/shopify/collection.rb
|
192
|
+
- lib/binda/shopify/engine.rb
|
193
|
+
- lib/binda/shopify/importer.rb
|
194
|
+
- lib/binda/shopify/installer.rb
|
195
|
+
- lib/binda/shopify/item.rb
|
196
|
+
- lib/binda/shopify/product.rb
|
197
|
+
- lib/binda/shopify/product_type.rb
|
198
|
+
- lib/binda/shopify/version.rb
|
199
|
+
- lib/generators/binda/shopify/install_generator.rb
|
200
|
+
- lib/tasks/binda/shopify_tasks.rake
|
201
|
+
homepage: http://lacolonia.studio
|
202
|
+
licenses:
|
203
|
+
- MIT
|
204
|
+
metadata: {}
|
205
|
+
post_install_message:
|
206
|
+
rdoc_options: []
|
207
|
+
require_paths:
|
208
|
+
- lib
|
209
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - ">="
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - ">="
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '0'
|
219
|
+
requirements: []
|
220
|
+
rubyforge_project:
|
221
|
+
rubygems_version: 2.6.12
|
222
|
+
signing_key:
|
223
|
+
specification_version: 4
|
224
|
+
summary: Binda plugin that lets you import products from your Shopify store.
|
225
|
+
test_files: []
|