hasmenu 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/hasmenu.gemspec +2 -1
- data/lib/hasmenu/builder.rb +6 -5
- data/lib/hasmenu/formatter.rb +2 -2
- data/lib/hasmenu/reporter.rb +10 -5
- data/lib/hasmenu/spellchecker.rb +2 -2
- data/lib/hasmenu/validator.rb +2 -2
- data/lib/hasmenu/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4c67d0fda35a2b5479df296c04e0e183f47e6bf
|
4
|
+
data.tar.gz: 90b6934689ac3cdde699ca838c594c7e7d33bc67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdd4ac6dfe539f6a62cf97391c71c4abd19c83782203bd671eaf13efdb085588af34bb04bb266ec683d787e152fe07b87b300b77accace3ceccf50c1289eb256
|
7
|
+
data.tar.gz: 8e60ef41d057082196c9a190f35cfc5262da56d1de6cf9907a539b103576a330d8b910d641cf413f554a588ffb30bae88b3364705ef9e970c645181de64942bf
|
data/README.md
CHANGED
@@ -8,6 +8,12 @@ A utility to collect and process data for Has.Menu
|
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
|
11
|
+
### Format Files
|
12
|
+
|
13
|
+
hasmenu format chains <chains-file>
|
14
|
+
hasmenu format restaurants <restaurants-file>
|
15
|
+
hasmenu format menu <chain-or-restaurant-menu>
|
16
|
+
|
11
17
|
### Spellcheck Menu
|
12
18
|
|
13
19
|
You can spellcheck an individual file
|
data/hasmenu.gemspec
CHANGED
@@ -19,9 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency "
|
22
|
+
spec.add_dependency "activesupport"
|
23
23
|
spec.add_dependency "colorize"
|
24
24
|
spec.add_dependency "json_schema"
|
25
|
+
spec.add_dependency "thor"
|
25
26
|
|
26
27
|
spec.add_development_dependency "bundler", "~> 1.8"
|
27
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/hasmenu/builder.rb
CHANGED
@@ -14,15 +14,15 @@ module Hasmenu
|
|
14
14
|
|
15
15
|
output["restaurant"] = restaurant
|
16
16
|
|
17
|
-
chain
|
18
|
-
menus
|
19
|
-
pattern = File.join(
|
17
|
+
chain = restaurant["chain"]
|
18
|
+
menus = menu_uid ? "#{menu_uid}.yml" : "*.yml"
|
19
|
+
pattern = File.join(@location, "data", "menu", "chain", chain, menus)
|
20
20
|
|
21
21
|
Dir.glob(pattern).each do |menu|
|
22
22
|
chain_menu = YAML.load_file(menu)
|
23
23
|
output["restaurant"]["menus"] = chain_menu["chain"]["menus"]
|
24
24
|
|
25
|
-
restaurant_dir = File.join(@location, "menu", "restaurant", restaurant["uid"])
|
25
|
+
restaurant_dir = File.join(@location, "data", "menu", "restaurant", restaurant["uid"])
|
26
26
|
FileUtils.mkdir_p(restaurant_dir) unless File.directory?(restaurant_dir)
|
27
27
|
|
28
28
|
menu_file = File.join(restaurant_dir, File.basename(menu))
|
@@ -32,7 +32,7 @@ module Hasmenu
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def build(uid, menu_uid)
|
35
|
-
restaurants_yml =
|
35
|
+
restaurants_yml = File.join(@location, "data", "restaurants.yml")
|
36
36
|
unless File.exist? restaurants_yml
|
37
37
|
print_invalid_path
|
38
38
|
return
|
@@ -48,6 +48,7 @@ module Hasmenu
|
|
48
48
|
restaurants
|
49
49
|
else
|
50
50
|
print_invalid_build
|
51
|
+
return
|
51
52
|
end
|
52
53
|
|
53
54
|
print_build_start
|
data/lib/hasmenu/formatter.rb
CHANGED
@@ -5,7 +5,7 @@ module Hasmenu
|
|
5
5
|
include Printer
|
6
6
|
|
7
7
|
def initialize(type, options)
|
8
|
-
@type = type
|
8
|
+
@type = type.chomp("/")
|
9
9
|
@location = options[:location] || Dir.pwd
|
10
10
|
end
|
11
11
|
|
@@ -32,7 +32,7 @@ module Hasmenu
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def format_files(path)
|
35
|
-
Dir.glob(path
|
35
|
+
Dir.glob(File.join(path, "**", "*.yml")) do |file|
|
36
36
|
format_file file
|
37
37
|
end
|
38
38
|
end
|
data/lib/hasmenu/reporter.rb
CHANGED
@@ -19,11 +19,16 @@ module Hasmenu
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def load_data
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
chains = File.join(@location, "data", "chains.yml")
|
23
|
+
restaurants = File.join(@location, "data", "restaurants.yml")
|
24
|
+
chain_menus = File.join(@location, "data", "menu", "chain", "**", "*.yml")
|
25
|
+
restaurant_menus = File.join(@location, "data", "menu", "restaurant", "**", "*.yml")
|
26
|
+
|
27
|
+
@yaml_chains = get_data chains, "uid"
|
28
|
+
@yaml_restaurants = get_data restaurants, "uid"
|
29
|
+
@restaurant_chains = get_data restaurants, "chain"
|
30
|
+
@file_chains = get_folder Dir.glob(chain_menus)
|
31
|
+
@file_restaurants = get_folder Dir.glob(restaurant_menus)
|
27
32
|
end
|
28
33
|
|
29
34
|
def report_chains
|
data/lib/hasmenu/spellchecker.rb
CHANGED
@@ -15,7 +15,7 @@ module Hasmenu
|
|
15
15
|
include Printer
|
16
16
|
|
17
17
|
def initialize(options)
|
18
|
-
@dictd = options[:dicts] || File.join(Dir.pwd, "
|
18
|
+
@dictd = options[:dicts] || File.join(Dir.pwd, "dict")
|
19
19
|
@xcept = options[:except]
|
20
20
|
@dicts = []
|
21
21
|
end
|
@@ -56,7 +56,7 @@ module Hasmenu
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def spell_check_all(path)
|
59
|
-
Dir.glob(path
|
59
|
+
Dir.glob(File.join(path, "**", "*.yml")) do |file|
|
60
60
|
spell_check file
|
61
61
|
end
|
62
62
|
end
|
data/lib/hasmenu/validator.rb
CHANGED
@@ -14,7 +14,7 @@ module Hasmenu
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def load_schema
|
17
|
-
file = File.join(@schemad, "#{@type}
|
17
|
+
file = File.join(@schemad, "#{@type}.json")
|
18
18
|
|
19
19
|
if File.file? file
|
20
20
|
schema_data = JSON.parse File.read(file)
|
@@ -96,7 +96,7 @@ module Hasmenu
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def validate_all(path)
|
99
|
-
Dir.glob(path
|
99
|
+
Dir.glob(File.join(path, "**", "*.yml")) do |file|
|
100
100
|
validate file
|
101
101
|
end
|
102
102
|
end
|
data/lib/hasmenu/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hasmenu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geordee Naliyath
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: thor
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|