rusic 1.3.2 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -1
- data/lib/rusic.rb +2 -0
- data/lib/rusic/cli.rb +1 -0
- data/lib/rusic/theme_file.rb +5 -0
- data/lib/rusic/uploaders/base.rb +6 -2
- data/lib/rusic/uploaders/custom_attributes.rb +45 -0
- data/lib/rusic/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6f8c44f95dfca47eec4f79d391f7c6e30284f9f
|
4
|
+
data.tar.gz: 593ab314eca20d6f4b1e7a7304fa00e3a249e7b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5e0490020dc8ed773ba45cc8bf09b1c5a00e7d415667911afcbfdb4177c2ffc223557c2f08ceaa8880bed6962c75e2c9cd85a8b2ab0f7f080fa3f921dc14ee4
|
7
|
+
data.tar.gz: fa3505f1b7cfa0cb23a39186a807ab5855045b11ef0404a561fab43c4cec8e28820acc6982f4c66421a41bf0a93b897062c627ad88f66942db9c5d4ca531978a
|
data/README.md
CHANGED
@@ -116,7 +116,7 @@ Saved layouts/subdomain.html.liquid
|
|
116
116
|
|
117
117
|
### Deploy using a `.rusic` file
|
118
118
|
|
119
|
-
You can add a
|
119
|
+
You can add a `.rusic.yml` file to your project directory and set your environments
|
120
120
|
settings within this file. This file should be valid
|
121
121
|
[YAML](http://www.yaml.org/start.html) and looks like this -
|
122
122
|
|
@@ -143,6 +143,21 @@ This also works with `--watch`
|
|
143
143
|
$ rusic deploy production --watch
|
144
144
|
```
|
145
145
|
|
146
|
+
### Custom Attributes
|
147
|
+
|
148
|
+
You can create and maintain your themes custom attributes by creating the
|
149
|
+
`attributes.yml` file in the root of your theme. Then declare your attributes like so:
|
150
|
+
|
151
|
+
```yaml
|
152
|
+
my_custom_attribute_key:
|
153
|
+
value: "Custom attributes rule!!"
|
154
|
+
help_text: "Declare how much you admire custom attributes"
|
155
|
+
```
|
156
|
+
|
157
|
+
If the key does not exist it will be created, if the key already exists the
|
158
|
+
`value` and `help_text` will be updated. If you need to delete a custom attribute
|
159
|
+
you should do that from the theme settings page on Rusic.
|
160
|
+
|
146
161
|
MIT Licenced
|
147
162
|
|
148
163
|
Copyright © 2011–2014, Simpleweb Ltd.
|
data/lib/rusic.rb
CHANGED
@@ -2,6 +2,7 @@ require 'rusic/version'
|
|
2
2
|
|
3
3
|
require 'rest_client'
|
4
4
|
require 'command_line_reporter'
|
5
|
+
require 'json'
|
5
6
|
|
6
7
|
module Rusic
|
7
8
|
require 'rusic/cli'
|
@@ -12,4 +13,5 @@ module Rusic
|
|
12
13
|
require 'rusic/uploaders/asset'
|
13
14
|
require 'rusic/uploaders/editable_asset'
|
14
15
|
require 'rusic/uploaders/template'
|
16
|
+
require 'rusic/uploaders/custom_attributes'
|
15
17
|
end
|
data/lib/rusic/cli.rb
CHANGED
data/lib/rusic/theme_file.rb
CHANGED
data/lib/rusic/uploaders/base.rb
CHANGED
@@ -14,11 +14,11 @@ module Rusic
|
|
14
14
|
@api_host = options.fetch('api_host')
|
15
15
|
@theme = options.fetch('theme')
|
16
16
|
|
17
|
-
report(message:
|
17
|
+
report(message: message, complete: '', type: 'inline', indent_size: 2) do
|
18
18
|
begin
|
19
19
|
perform
|
20
20
|
print(' [done]'.green)
|
21
|
-
rescue RestClient::UnprocessableEntity
|
21
|
+
rescue RestClient::UnprocessableEntity, RestClient::Exception
|
22
22
|
print(' [failed]'.red)
|
23
23
|
end
|
24
24
|
end
|
@@ -34,6 +34,10 @@ module Rusic
|
|
34
34
|
|
35
35
|
protected
|
36
36
|
|
37
|
+
def message
|
38
|
+
"Uploading #{file.descriptor}"
|
39
|
+
end
|
40
|
+
|
37
41
|
def client
|
38
42
|
headers = {
|
39
43
|
'X-API-Key' => api_key,
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Rusic
|
2
|
+
module Uploaders
|
3
|
+
class CustomAttributes < Base
|
4
|
+
def perform
|
5
|
+
client["themes/#{theme}"].put(params)
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def message
|
11
|
+
"Updating custom attributes"
|
12
|
+
end
|
13
|
+
|
14
|
+
def params
|
15
|
+
params_hash = {
|
16
|
+
'theme' => {
|
17
|
+
'custom_attributes_attributes' => {}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
attributes_from_file.each_with_index do |(key, options), i|
|
22
|
+
params_hash['theme']['custom_attributes_attributes'][i] = {
|
23
|
+
'key' => key,
|
24
|
+
'value' => options.fetch('value'),
|
25
|
+
'help_text' => options.fetch('help_text', '')
|
26
|
+
}
|
27
|
+
|
28
|
+
if e_attr = existing_attributes[key]
|
29
|
+
params_hash['theme']['custom_attributes_attributes'][i]['id'] = e_attr['id']
|
30
|
+
end
|
31
|
+
end
|
32
|
+
params_hash
|
33
|
+
end
|
34
|
+
|
35
|
+
def existing_attributes
|
36
|
+
@existing_attributes ||= JSON.parse(client["themes/#{theme}"].get)
|
37
|
+
Hash[@existing_attributes.fetch('custom_attributes', []).map {|i| [i['key'], i] }]
|
38
|
+
end
|
39
|
+
|
40
|
+
def attributes_from_file
|
41
|
+
::YAML::load_file(file.file) || {}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/rusic/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rusic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Mytton
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: thor
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- lib/rusic/theme_file.rb
|
123
123
|
- lib/rusic/uploaders/asset.rb
|
124
124
|
- lib/rusic/uploaders/base.rb
|
125
|
+
- lib/rusic/uploaders/custom_attributes.rb
|
125
126
|
- lib/rusic/uploaders/editable_asset.rb
|
126
127
|
- lib/rusic/uploaders/template.rb
|
127
128
|
- lib/rusic/version.rb
|