shopify_toolkit 0.4.0 → 0.5.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1d6624a536a67ce6e7861ae95c0eed57e2713974b4901b9eca1720ecbd063ad
4
- data.tar.gz: ee1bffe4a027352bdf58a39d9aa4412c5c0151da4784b56006c62b3b8b33dd30
3
+ metadata.gz: 101513a4e3028e85086e96c5fc36b992df1fd77804dcf6f55207a3f3d3761582
4
+ data.tar.gz: 10eff581de2567092a710ad7fd0533c51d74c6ead9c1003a0467941806624dda
5
5
  SHA512:
6
- metadata.gz: a3b3b9d85c5cd37f51531f433bd039f6830bdab42c2bc4a4b52a8b6b4cc7f6ec22cd2a52bc2faec59c5777077b6f615651987afffc8c468aa6b34563cd46c9be
7
- data.tar.gz: 58b3102b6915f4344e532d2d329b3cabce6028412ccf5676eafc174a0479222320f1bd63af972a8613442c9f9c4c72a0db05e3b407040b4a624e369926da1e1c
6
+ metadata.gz: '08b4bd6ee54f7764ce9999dd01b438f0ac89c440c3c5dba2e4cf684de40350fc6e3a4f018942f2b9fee484fc4dfb89b1ca585548812de39c4cf04aa31e51cf57'
7
+ data.tar.gz: 0d52e249d1abecea1643a2109a984290216c7babe61bd036f241168246ee1a796380747e7f767c23b9593ff044862fcdf7fe0b0507778fdfcde714377712a9e6
data/README.md CHANGED
@@ -12,8 +12,13 @@ A toolkit for working with Custom Shopify Apps built on Rails.
12
12
 
13
13
  - [x] Shopify/Matrixify CSV tools
14
14
  - [x] Metafield/Metaobject migrations (just like ActiveRecord migrations, but for Shopify!)
15
- - [x] Metafield Definitions management API
16
- - [x] Metaobject Definitions management API
15
+ - [x] Metafield Definitions management API
16
+ - [x] Metaobject Definitions management API
17
+ - [x] Create
18
+ - [x] Update
19
+ - [x] Find
20
+ - [ ] Delete
21
+ - [ ] Metaobject Instances management API
17
22
  - [ ] GraphQL Admin API code generation (syntax checking, etc)
18
23
  - [ ] GraphQL Admin API client with built-in rate limiting
19
24
  - [ ] GraphQL Admin API client with built-in caching
@@ -35,7 +40,7 @@ bundle add shopify_toolkit
35
40
  Within a Rails application created with ShopifyApp, generate a new migration file:
36
41
 
37
42
  ```bash
38
- touch config/shopify/migrate/20250528130134_add_product_press_releases.rb
43
+ bundle exec shopify-toolkit generate migration AddProductPressReleases
39
44
  ```
40
45
 
41
46
  Then, add the following code to the migration file:
@@ -1,9 +1,12 @@
1
1
  require 'csv'
2
2
  require 'active_record'
3
3
  require 'thor'
4
+ require 'thor/actions'
4
5
  require 'tmpdir'
5
6
 
6
7
  class ShopifyToolkit::CommandLine < Thor
8
+ include Thor::Actions
9
+
7
10
  RESERVED_COLUMN_NAMES = %w[select type id]
8
11
 
9
12
  class Result < ActiveRecord::Base
@@ -59,8 +62,8 @@ class ShopifyToolkit::CommandLine < Thor
59
62
  ::Shop.sole.with_shopify_session { ShopifyToolkit::Migrator.new.up }
60
63
  end
61
64
 
62
- desc "down", "Run migrations down"
63
- def down
65
+ desc "rollback", "Rollback last migration"
66
+ def rollback
64
67
  require "./config/environment"
65
68
  ::Shop.sole.with_shopify_session { ShopifyToolkit::Migrator.new.down }
66
69
  end
@@ -83,6 +86,31 @@ class ShopifyToolkit::CommandLine < Thor
83
86
  ::Shop.sole.with_shopify_session { ShopifyToolkit::Schema.dump! }
84
87
  end
85
88
 
89
+ desc "generate_migration NAME", "Generate a migration with the given NAME"
90
+ def generate_migration(name)
91
+ require "./config/environment"
92
+ migrations_dir = Rails.root.join("config/shopify/migrate")
93
+ file_name = "#{Time.now.utc.strftime('%Y%m%d%H%M%S')}_#{name.underscore}.rb"
94
+
95
+ if migrations_dir.entries.map(&:to_s).grep(/\A\d+_#{Regexp.escape name.underscore}\.rb\z/).any?
96
+ raise Thor::Error, "Migration class already exists: #{file_name}"
97
+ end
98
+
99
+ create_file migrations_dir.join(file_name) do
100
+ <<~RUBY
101
+ class #{name.camelize} < ShopifyToolkit::Migration
102
+ def up
103
+ # Add your migration code here
104
+ end
105
+
106
+ def down
107
+ # Add your rollback code here
108
+ end
109
+ end
110
+ RUBY
111
+ end
112
+ end
113
+
86
114
  def self.exit_on_failure?
87
115
  true
88
116
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ShopifyToolkit
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elia Schito
8
8
  - Nebulab Team
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-27 00:00:00.000000000 Z
11
+ date: 2025-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties