guard-shopifytheme 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +18 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +103 -0
- data/Rakefile +7 -0
- data/guard-shopifytheme.gemspec +25 -0
- data/lib/guard/shopifytheme.rb +106 -0
- data/lib/guard/shopifytheme/templates/Guardfile +8 -0
- data/lib/guard/shopifytheme/version.rb +5 -0
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d31aefcef6082c67442abeb7ead176cf5874ae7
|
4
|
+
data.tar.gz: 7af764a6789900ada1b510888928ee158e21ac92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6146e260185493196ad50ad8fdf35c616194b6246a22ebc3555fab3c77def87078961a9d64741c01f1e067ac89e6fc7c9e47aa199d3665a9237093c629c7105
|
7
|
+
data.tar.gz: a1815f08dda82184467371259a4fa6b4c1bfcacd88aa2a50b437c023735433fccd1472a75f0e2664c388506c2a8a0906a2780df3bcea635f46b69a5be3d91bf0
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Danny Smith
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# Guard::Shopifytheme
|
2
|
+
[![Build Status](https://travis-ci.org/dannysmith/guard-shopifytheme.png?branch=master)](https://travis-ci.org/dannysmith/guard-shopifytheme) [![Gem Version](https://badge.fury.io/rb/guard-shopifytheme.png)](http://badge.fury.io/rb/guard-shopifytheme)
|
3
|
+
|
4
|
+
Uses [Guard](https://github.com/guard/guard) to watch for changes and update Shopify when a file is changed. Very similar functionality to [guard-shopify](https://github.com/1337807/guard-shopify), except that it uses the [shopify_theme](https://github.com/Shopify/shopify_theme) gem to do most of the work. This has a couple of advantages:
|
5
|
+
|
6
|
+
* shopify_theme is maintained by Shopify, so will usually be up-to-date.
|
7
|
+
* The config settings are stored in the project directory (rather than in `~/.guard_shopify`, as with guatd-shopify)
|
8
|
+
* If you choose to use the `theme watch` command provided by shopify_theme instead of Guard, then everything will still work properly – you don't need to maintain two sets of config files.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
Make sure you have installed [Guard](https://github.com/guard/guard).
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'guard-shopifytheme'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself with:
|
22
|
+
|
23
|
+
$ gem install guard-shopifytheme
|
24
|
+
|
25
|
+
If you don't already have [shopify_theme](https://github.com/Shopify/shopify_theme) set up, create a `config.yml` file in your project directory (see [here](https://github.com/Shopify/shopify_theme#usage)):
|
26
|
+
|
27
|
+
````yaml
|
28
|
+
---
|
29
|
+
:api_key: YOUR_API_KEY
|
30
|
+
:password: YOUR_PASSWORD
|
31
|
+
:store: YOURSHOP.myshopify.com
|
32
|
+
:theme_id: 'YOUR_THEME_ID'
|
33
|
+
:ignore_files:
|
34
|
+
- README.md
|
35
|
+
- CHANGELOG.md
|
36
|
+
````
|
37
|
+
|
38
|
+
Add the Guard definition to your Guardfile with:
|
39
|
+
|
40
|
+
$ guard init guard-shopifytheme
|
41
|
+
|
42
|
+
## Usage
|
43
|
+
There aren't any options, so usage is pretty simple:
|
44
|
+
|
45
|
+
````ruby
|
46
|
+
# Upload Changes to Shopify
|
47
|
+
guard :shopifytheme do
|
48
|
+
watch(/assets\/.*/)
|
49
|
+
watch(/config\/.*/)
|
50
|
+
watch(/layout\/.*/)
|
51
|
+
watch(/snippets\/.*/)
|
52
|
+
watch(/templates\/.*/)
|
53
|
+
end
|
54
|
+
````
|
55
|
+
|
56
|
+
|
57
|
+
## An Alternative
|
58
|
+
If you don't want to install this gem, you can just add this to your Guardfile:
|
59
|
+
|
60
|
+
````ruby
|
61
|
+
require 'guard/plugin'
|
62
|
+
|
63
|
+
module ::Guard
|
64
|
+
class ShopifyTheme < ::Guard::Plugin
|
65
|
+
def run_all
|
66
|
+
end
|
67
|
+
|
68
|
+
def start
|
69
|
+
end
|
70
|
+
|
71
|
+
def run_on_changes(paths)
|
72
|
+
paths.each do |path|
|
73
|
+
system "theme upload #{path}"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def run_on_removals(paths)
|
78
|
+
paths.each do |path|
|
79
|
+
system "theme remove #{path}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
````
|
85
|
+
|
86
|
+
## Contributing
|
87
|
+
1. Fork it
|
88
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
89
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
90
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
91
|
+
5. Create new Pull Request
|
92
|
+
|
93
|
+
## Todo
|
94
|
+
- Add some tests
|
95
|
+
- Improve `start()` to ask for your shopify API details and write them to config.yml
|
96
|
+
|
97
|
+
## Author
|
98
|
+
- Danny Smith ([@dannysmith](http://github.com/dannysmith))
|
99
|
+
- Shopfy_Theme by Shopify ([@shopify](https://github.com/Shopify))
|
100
|
+
|
101
|
+
|
102
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/dannysmith/guard-shopifytheme/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
103
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'guard/shopifytheme/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "guard-shopifytheme"
|
8
|
+
spec.version = Guard::ShopifythemeVersion::VERSION
|
9
|
+
spec.authors = ["Danny Smith"]
|
10
|
+
spec.email = ["danny@dasmith.co.uk"]
|
11
|
+
spec.description = %q{Guard::Shopifytheme uses shopify_theme to update shopify when watched files are modified}
|
12
|
+
spec.summary = %q{Guard gem for updating shopify through shopify_theme}
|
13
|
+
spec.homepage = "http://github.com/dannysmith/guard-shopifytheme"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_path = 'lib'
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_dependency "shopify_theme", '>= 0.0.13'
|
24
|
+
spec.add_dependency "guard", '~> 2.0'
|
25
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'guard'
|
2
|
+
require 'guard/plugin'
|
3
|
+
# require "guard/shopifytheme/version"
|
4
|
+
|
5
|
+
|
6
|
+
module Guard
|
7
|
+
class Shopifytheme < Plugin
|
8
|
+
|
9
|
+
#VERSION = "0.0.1"
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
# Called once when Guard starts. Please override initialize method to init stuff.
|
16
|
+
#
|
17
|
+
# @raise [:task_has_failed] when start has failed
|
18
|
+
# @return [Object] the task result
|
19
|
+
#
|
20
|
+
def start
|
21
|
+
if File.exist? 'config.yml'
|
22
|
+
Notifier.notify "Watching for changes to Shopify Theme"
|
23
|
+
else
|
24
|
+
data = <<-EOF
|
25
|
+
---
|
26
|
+
:api_key: YOUR_API_KEY
|
27
|
+
:password: YOUR_PASSWORD
|
28
|
+
:store: YOURSHOP.myshopify.com
|
29
|
+
:theme_id: 'YOUR_THEME_ID'
|
30
|
+
:ignore_files:
|
31
|
+
- README.md
|
32
|
+
- CHANGELOG.md
|
33
|
+
EOF
|
34
|
+
File.open('./config.yml', "w") { |file| file.write data }
|
35
|
+
Notifier.notify "Created config.yml. Remember to add your Shopify details to it."
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
|
40
|
+
#
|
41
|
+
# @raise [:task_has_failed] when stop has failed
|
42
|
+
# @return [Object] the task result
|
43
|
+
#
|
44
|
+
# def stop
|
45
|
+
# end
|
46
|
+
|
47
|
+
# Called when `reload|r|z + enter` is pressed.
|
48
|
+
# This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
|
49
|
+
#
|
50
|
+
# @raise [:task_has_failed] when reload has failed
|
51
|
+
# @return [Object] the task result
|
52
|
+
#
|
53
|
+
# def reload
|
54
|
+
# end
|
55
|
+
|
56
|
+
# Called when just `enter` is pressed
|
57
|
+
# This method should be principally used for long action like running all specs/tests/...
|
58
|
+
#
|
59
|
+
# @raise [:task_has_failed] when run_all has failed
|
60
|
+
# @return [Object] the task result
|
61
|
+
#
|
62
|
+
# def run_all
|
63
|
+
# end
|
64
|
+
|
65
|
+
# Default behaviour on file(s) changes that the Guard plugin watches.
|
66
|
+
# @param [Array<String>] paths the changes files or paths
|
67
|
+
# @raise [:task_has_failed] when run_on_change has failed
|
68
|
+
# @return [Object] the task result
|
69
|
+
#
|
70
|
+
def run_on_changes(paths)
|
71
|
+
paths.each do |path|
|
72
|
+
system "theme upload #{path}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Called on file(s) additions that the Guard plugin watches.
|
77
|
+
#
|
78
|
+
# @param [Array<String>] paths the changes files or paths
|
79
|
+
# @raise [:task_has_failed] when run_on_additions has failed
|
80
|
+
# @return [Object] the task result
|
81
|
+
#
|
82
|
+
# def run_on_additions(paths)
|
83
|
+
# end
|
84
|
+
|
85
|
+
# Called on file(s) modifications that the Guard plugin watches.
|
86
|
+
#
|
87
|
+
# @param [Array<String>] paths the changes files or paths
|
88
|
+
# @raise [:task_has_failed] when run_on_modifications has failed
|
89
|
+
# @return [Object] the task result
|
90
|
+
#
|
91
|
+
# def run_on_modifications(paths)
|
92
|
+
# end
|
93
|
+
|
94
|
+
# Called on file(s) removals that the Guard plugin watches.
|
95
|
+
#
|
96
|
+
# @param [Array<String>] paths the changes files or paths
|
97
|
+
# @raise [:task_has_failed] when run_on_removals has failed
|
98
|
+
# @return [Object] the task result
|
99
|
+
#
|
100
|
+
def run_on_removals(paths)
|
101
|
+
paths.each do |path|
|
102
|
+
system "theme remove #{path}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-shopifytheme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,7 +73,17 @@ email:
|
|
73
73
|
executables: []
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
|
-
files:
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- .travis.yml
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- guard-shopifytheme.gemspec
|
84
|
+
- lib/guard/shopifytheme.rb
|
85
|
+
- lib/guard/shopifytheme/templates/Guardfile
|
86
|
+
- lib/guard/shopifytheme/version.rb
|
77
87
|
homepage: http://github.com/dannysmith/guard-shopifytheme
|
78
88
|
licenses:
|
79
89
|
- MIT
|