nimbu 0.5.1 → 0.5.2
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.
- data/lib/nimbu/command/themes.rb +25 -15
- data/lib/nimbu/helpers.rb +4 -4
- data/lib/nimbu/version.rb +1 -1
- metadata +3 -3
data/lib/nimbu/command/themes.rb
CHANGED
@@ -64,15 +64,22 @@ class Nimbu::Command::Themes < Nimbu::Command::Base
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
#
|
67
|
+
# push
|
68
68
|
#
|
69
|
-
#
|
69
|
+
# push all layouts, templates and assets
|
70
|
+
# --liquid, --liquid-only # only push template code
|
71
|
+
# --css, --css-only # only push template code
|
72
|
+
# --js, --js-only # only push template code
|
73
|
+
# --images-only # only push new images
|
70
74
|
#
|
71
75
|
def push
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
+
liquid_only = options[:liquid]
|
77
|
+
css_only = options[:css]
|
78
|
+
js_only = options[:js]
|
79
|
+
images_only = options[:images_only]
|
80
|
+
|
81
|
+
puts options
|
82
|
+
puts images_only
|
76
83
|
|
77
84
|
# if !input.to_s.strip.empty?
|
78
85
|
# theme = input.to_s.strip
|
@@ -88,13 +95,13 @@ class Nimbu::Command::Themes < Nimbu::Command::Base
|
|
88
95
|
snippets_glob = Dir.glob("#{Dir.pwd}/snippets/**/*.liquid")
|
89
96
|
snippets_files = snippets_glob.map {|dir| dir.gsub("#{Dir.pwd}/snippets/","")}
|
90
97
|
|
91
|
-
if !(css_only || js_only)
|
98
|
+
if !(css_only || js_only || images_only)
|
92
99
|
print "\nLayouts:\n"
|
93
100
|
layouts_files.each do |layout|
|
94
101
|
file = "#{Dir.pwd}/layouts/#{layout}"
|
95
102
|
next if File.directory?(file)
|
96
103
|
print " - layouts/#{layout}"
|
97
|
-
nimbu.
|
104
|
+
nimbu.themes(:subdomain => Nimbu::Auth.site).layouts(:theme_id => theme).create({:name => layout, :content => IO.read(file)})
|
98
105
|
print " (ok)\n"
|
99
106
|
end
|
100
107
|
|
@@ -103,7 +110,7 @@ class Nimbu::Command::Themes < Nimbu::Command::Base
|
|
103
110
|
file = "#{Dir.pwd}/templates/#{template}"
|
104
111
|
next if File.directory?(file)
|
105
112
|
print " - templates/#{template}"
|
106
|
-
nimbu.
|
113
|
+
nimbu.themes(:subdomain => Nimbu::Auth.site).templates(:theme_id => theme).create({:name => template, :content => IO.read(file)})
|
107
114
|
print " (ok)\n"
|
108
115
|
end
|
109
116
|
|
@@ -112,7 +119,7 @@ class Nimbu::Command::Themes < Nimbu::Command::Base
|
|
112
119
|
file = "#{Dir.pwd}/snippets/#{snippet}"
|
113
120
|
next if File.directory?(file)
|
114
121
|
print " - snippets/#{snippet}"
|
115
|
-
nimbu.
|
122
|
+
nimbu.themes(:subdomain => Nimbu::Auth.site).snippets(:theme_id => theme).create({:name => snippet, :content => IO.read(file)})
|
116
123
|
print " (ok)\n"
|
117
124
|
end
|
118
125
|
end
|
@@ -120,12 +127,13 @@ class Nimbu::Command::Themes < Nimbu::Command::Base
|
|
120
127
|
if !liquid_only
|
121
128
|
css_glob = Dir.glob("#{Dir.pwd}/stylesheets/**/*.css")
|
122
129
|
css_files = css_glob.map {|dir| dir.gsub("#{Dir.pwd}/stylesheets/","")}
|
123
|
-
if !js_only
|
130
|
+
if !(js_only || images_only)
|
124
131
|
print "\nStylesheet:\n"
|
125
132
|
css_files.each do |css|
|
126
133
|
file = "#{Dir.pwd}/stylesheets/#{css}"
|
127
134
|
next if File.directory?(file) || (!anyFileWithWord?(layouts_glob,css) && !anyFileWithWord?(templates_glob,css))
|
128
|
-
|
135
|
+
io = Faraday::UploadIO.new(File.open(file), 'application/octet-stream', File.basename(file))
|
136
|
+
nimbu.themes(:subdomain => Nimbu::Auth.site).assets(:theme_id => theme).create({:name => "stylesheets/#{css}", :file => io})
|
129
137
|
print " - stylesheets/#{css}"
|
130
138
|
print " (ok)\n"
|
131
139
|
end
|
@@ -133,12 +141,13 @@ class Nimbu::Command::Themes < Nimbu::Command::Base
|
|
133
141
|
|
134
142
|
js_glob = Dir.glob("#{Dir.pwd}/javascripts/**/*.js")
|
135
143
|
js_files = js_glob.map {|dir| dir.gsub("#{Dir.pwd}/javascripts/","")}
|
136
|
-
if !css_only
|
144
|
+
if !(css_only || images_only)
|
137
145
|
print "\nJavascripts:\n"
|
138
146
|
js_files.each do |js|
|
139
147
|
file = "#{Dir.pwd}/javascripts/#{js}"
|
140
148
|
next if File.directory?(file) || (!anyFileWithWord?(layouts_glob,js) && !anyFileWithWord?(templates_glob,js))
|
141
|
-
|
149
|
+
io = Faraday::UploadIO.new(File.open(file), 'application/octet-stream', File.basename(file))
|
150
|
+
nimbu.themes(:subdomain => Nimbu::Auth.site).assets(:theme_id => theme).create({:name => "javascripts/#{js}", :file => io})
|
142
151
|
print " - javascripts/#{js}"
|
143
152
|
print " (ok)\n"
|
144
153
|
end
|
@@ -150,7 +159,8 @@ class Nimbu::Command::Themes < Nimbu::Command::Base
|
|
150
159
|
image_files.each do |image|
|
151
160
|
file = "#{Dir.pwd}/images/#{image}"
|
152
161
|
next if File.directory?(file) || (!anyFileWithWord?(css_glob,image) && !anyFileWithWord?(js_glob,image) && !anyFileWithWord?(layouts_glob,image) && !anyFileWithWord?(templates_glob,image))
|
153
|
-
|
162
|
+
io = Faraday::UploadIO.new(File.open(file), 'application/octet-stream', File.basename(file))
|
163
|
+
nimbu.themes(:subdomain => Nimbu::Auth.site).assets(:theme_id => theme).create({:name => "images/#{image}", :file => io})
|
154
164
|
print " - images/#{image}"
|
155
165
|
print " (ok)\n"
|
156
166
|
end
|
data/lib/nimbu/helpers.rb
CHANGED
@@ -374,8 +374,8 @@ module Nimbu
|
|
374
374
|
def format_error(error, message='Nimbu client internal error.')
|
375
375
|
formatted_error = []
|
376
376
|
formatted_error << " ! #{message}"
|
377
|
-
formatted_error << ' ! Search for help at: https://help.
|
378
|
-
formatted_error << ' ! Or report a bug at: https://github.com/
|
377
|
+
formatted_error << ' ! Search for help at: https://help.nimbu.io'
|
378
|
+
formatted_error << ' ! Or report a bug at: https://github.com/nimbu/nimbu/issues/new'
|
379
379
|
formatted_error << ''
|
380
380
|
formatted_error << " Error: #{error.message} (#{error.class})"
|
381
381
|
formatted_error << " Backtrace: #{error.backtrace.first}"
|
@@ -392,8 +392,8 @@ module Nimbu
|
|
392
392
|
arg
|
393
393
|
end
|
394
394
|
end.join(' ')
|
395
|
-
formatted_error << " Command:
|
396
|
-
require '
|
395
|
+
formatted_error << " Command: nimbu #{command}"
|
396
|
+
require 'nimbu/auth'
|
397
397
|
unless Nimbu::Auth.host == Nimbu::Auth.default_host
|
398
398
|
formatted_error << " Host: #{Nimbu::Auth.host}"
|
399
399
|
end
|
data/lib/nimbu/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: nimbu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Zenjoy BVBA
|
@@ -292,7 +292,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
292
292
|
- !ruby/object:Gem::Version
|
293
293
|
segments:
|
294
294
|
- 0
|
295
|
-
hash:
|
295
|
+
hash: 4235793488753484692
|
296
296
|
version: '0'
|
297
297
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
298
298
|
none: false
|
@@ -301,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
301
|
- !ruby/object:Gem::Version
|
302
302
|
segments:
|
303
303
|
- 0
|
304
|
-
hash:
|
304
|
+
hash: 4235793488753484692
|
305
305
|
version: '0'
|
306
306
|
requirements: []
|
307
307
|
rubyforge_project:
|