shopifydev 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/shopifydev/faker.rb +49 -0
- data/lib/shopifydev/version.rb +1 -1
- data/lib/shopifydev.rb +1 -0
- data/shopifydev.gemspec +4 -0
- data/spec/shopifydev/faker_spec.rb +5 -0
- metadata +23 -4
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'ffaker'
|
2
|
+
require 'shopify_api'
|
3
|
+
module Shopifydev
|
4
|
+
module Faker
|
5
|
+
extend ::Faker::ModuleUtils
|
6
|
+
extend self
|
7
|
+
|
8
|
+
|
9
|
+
def metafield(owner=nil, opts={})
|
10
|
+
owner_resource = owner && owner.class.element_name
|
11
|
+
owner_id = owner && owner.id
|
12
|
+
metafield = ::ShopifyAPI::Metafield.new(
|
13
|
+
{
|
14
|
+
owner_resource: owner_resource,
|
15
|
+
owner_id: owner_id,
|
16
|
+
namespace: opts[:namespace] || namespace,
|
17
|
+
key: opts[:key] || key,
|
18
|
+
value_type: 'string',
|
19
|
+
value: opts[:value] || value
|
20
|
+
}
|
21
|
+
)
|
22
|
+
metafield.save! if owner_id
|
23
|
+
metafield
|
24
|
+
end
|
25
|
+
|
26
|
+
def namespace
|
27
|
+
s = ''
|
28
|
+
loop do
|
29
|
+
word = ::Faker::Lorem.word[0..rand(10)].downcase
|
30
|
+
word = '.' + word if s.length > 0
|
31
|
+
if (s.length + word.length) < 21
|
32
|
+
s += word
|
33
|
+
else
|
34
|
+
break
|
35
|
+
end
|
36
|
+
end
|
37
|
+
s
|
38
|
+
end
|
39
|
+
|
40
|
+
def key
|
41
|
+
::Faker::Lorem.word.downcase
|
42
|
+
end
|
43
|
+
|
44
|
+
def value
|
45
|
+
::Faker::Lorem.sentence(rand(10))
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
data/lib/shopifydev/version.rb
CHANGED
data/lib/shopifydev.rb
CHANGED
@@ -4,6 +4,7 @@ require_relative "shopifydev/shop"
|
|
4
4
|
require_relative "shopifydev/template"
|
5
5
|
require_relative "shopifydev/asset"
|
6
6
|
require_relative "shopifydev/commands"
|
7
|
+
require_relative "shopifydev/faker"
|
7
8
|
require_relative "shopifydev/railtie" if defined?(Rails)
|
8
9
|
|
9
10
|
module Shopifydev
|
data/shopifydev.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopifydev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shopify_api
|
@@ -187,6 +187,22 @@ dependencies:
|
|
187
187
|
- - ! '>='
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0'
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: ffaker
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
type: :runtime
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
190
206
|
description: Tools for using SCM with shopify.
|
191
207
|
email:
|
192
208
|
- lastobelus@mac.com
|
@@ -216,6 +232,7 @@ files:
|
|
216
232
|
- lib/shopifydev/commands.rb
|
217
233
|
- lib/shopifydev/config.rb
|
218
234
|
- lib/shopifydev/console.rb
|
235
|
+
- lib/shopifydev/faker.rb
|
219
236
|
- lib/shopifydev/generators/shop.rb
|
220
237
|
- lib/shopifydev/generators/templates/Gemfile
|
221
238
|
- lib/shopifydev/generators/templates/gitignore
|
@@ -231,6 +248,7 @@ files:
|
|
231
248
|
- shopifydev.gemspec
|
232
249
|
- spec/shopifydev/config_spec.rb
|
233
250
|
- spec/shopifydev/console_spec.rb
|
251
|
+
- spec/shopifydev/faker_spec.rb
|
234
252
|
- spec/shopifydev/generators/shopifydev/shopifydev_generator_spec.rb
|
235
253
|
- spec/shopifydev/pry/commands_spec.rb
|
236
254
|
- spec/shopifydev/railtie_spec.rb
|
@@ -250,7 +268,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
250
268
|
version: '0'
|
251
269
|
segments:
|
252
270
|
- 0
|
253
|
-
hash: -
|
271
|
+
hash: -1387855071331690382
|
254
272
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
255
273
|
none: false
|
256
274
|
requirements:
|
@@ -259,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
277
|
version: '0'
|
260
278
|
segments:
|
261
279
|
- 0
|
262
|
-
hash: -
|
280
|
+
hash: -1387855071331690382
|
263
281
|
requirements: []
|
264
282
|
rubyforge_project:
|
265
283
|
rubygems_version: 1.8.25
|
@@ -270,6 +288,7 @@ summary: Abstract out and port to ruby the functionality of the shopify textmate
|
|
270
288
|
test_files:
|
271
289
|
- spec/shopifydev/config_spec.rb
|
272
290
|
- spec/shopifydev/console_spec.rb
|
291
|
+
- spec/shopifydev/faker_spec.rb
|
273
292
|
- spec/shopifydev/generators/shopifydev/shopifydev_generator_spec.rb
|
274
293
|
- spec/shopifydev/pry/commands_spec.rb
|
275
294
|
- spec/shopifydev/railtie_spec.rb
|