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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc4f1d3dd3fe8a08c94ee2b3d2045d54908786ec
4
- data.tar.gz: 8c772941d955ead4c437f182f4393f6e28cf6230
3
+ metadata.gz: f4c67d0fda35a2b5479df296c04e0e183f47e6bf
4
+ data.tar.gz: 90b6934689ac3cdde699ca838c594c7e7d33bc67
5
5
  SHA512:
6
- metadata.gz: f2c5b2526513ebb22363b73cbe17a56b3907e31386a95ba6838f38c840aac12f98fa102aec7cc2a9106e353842460e780d6501d53b084a44a39927a0935d7903
7
- data.tar.gz: 7b2a8e855e3310bc7aeab0ffa8c570525ae8cff4b882da9c634a8c0a345fb5a9bdffa2ec03b94ce08d5b796321cfd9658808f42fe7e3bd67f84dc043369ab71c
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 "thor"
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"
@@ -14,15 +14,15 @@ module Hasmenu
14
14
 
15
15
  output["restaurant"] = restaurant
16
16
 
17
- chain = restaurant["chain"]
18
- menus = menu_uid ? "#{menu_uid}.yml" : "*.yml"
19
- pattern = File.join("#{@location}/menu/chain/#{chain}/#{menus}")
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 = "#{@location}/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
@@ -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 + "/**/*.yml") do |file|
35
+ Dir.glob(File.join(path, "**", "*.yml")) do |file|
36
36
  format_file file
37
37
  end
38
38
  end
@@ -19,11 +19,16 @@ module Hasmenu
19
19
  end
20
20
 
21
21
  def load_data
22
- @yaml_chains = get_data "chains.yml", "uid"
23
- @yaml_restaurants = get_data "restaurants.yml", "uid"
24
- @restaurant_chains = get_data "restaurants.yml", "chain"
25
- @file_chains = get_folder Dir.glob("#{@location}/menu/chain/**/*.yml")
26
- @file_restaurants = get_folder Dir.glob("#{@location}/menu/restaurant/**/*.yml")
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
@@ -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, ".meta", "dicts")
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 + "/**/*.yml") do |file|
59
+ Dir.glob(File.join(path, "**", "*.yml")) do |file|
60
60
  spell_check file
61
61
  end
62
62
  end
@@ -14,7 +14,7 @@ module Hasmenu
14
14
  end
15
15
 
16
16
  def load_schema
17
- file = File.join(@schemad, "#{@type}-v4.json")
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 + "/**/*.yml") do |file|
99
+ Dir.glob(File.join(path, "**", "*.yml")) do |file|
100
100
  validate file
101
101
  end
102
102
  end
@@ -1,3 +1,3 @@
1
1
  module Hasmenu
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
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.6
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-18 00:00:00.000000000 Z
11
+ date: 2015-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: thor
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