caboose-cms 0.8.40 → 0.8.41

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: 22b48d7ce6d1545a3e67e1fa703b71738911a7e3
4
- data.tar.gz: 1817cf46b3229a1f6952fd9827655831547caa00
3
+ metadata.gz: 945c437e933d397c1638c61f648474f9144bfaa5
4
+ data.tar.gz: 32696496ae665b5937f15cb846227c5db9ad4df9
5
5
  SHA512:
6
- metadata.gz: c020e9dc6acc89b63678f551792d44b393a4771056b126d03d9b9952bbf57b8f0c4b4b8154032a8ecc6ace54e868ac4b22d4dc663c8e76b2bffed5582c856ac9
7
- data.tar.gz: 6198d93c11ec8cbcc22984d2c65519de2b649207616072a26cc9961291525e1c2899af98da61bed77b5b7d4d5db90c99569d4d9ed7806b5f9c7cd6a0bcad6ef9
6
+ metadata.gz: 2d9873f6add7c68e6bc4c398c9cf7849e824f9dc285dcd1cd8a1fbcd4a54b5d2cd67b3c6aaee813f7cc23e90a29a1288604fdc5bfcc1771609727db90e6f30f0
7
+ data.tar.gz: 9f8b80d544fb73d64a31fd18e89d7f3683e64493ff535cf27a5c3ed8667b0ad24a6c3248d0c7660bff5a1a6136abe88a2c2fc39695786545f55add7d85403dd3
@@ -8,7 +8,7 @@ module Caboose
8
8
 
9
9
  @find_page = true
10
10
 
11
- def before_before_action
11
+ def before_before_action
12
12
 
13
13
  # Modify the built-in params array with URL params if necessary
14
14
  parse_url_params if Caboose.use_url_params
@@ -28,6 +28,7 @@ module Caboose
28
28
  f2 = File.open(file, "r")
29
29
 
30
30
  domains = []
31
+ domains_constrainer = false
31
32
  module_name = nil
32
33
  class_name = nil
33
34
  class_priority = 20
@@ -44,9 +45,14 @@ module Caboose
44
45
  class_name = line.gsub(/^(.*?)class (.*?)Controller(.*?)$/, '\2').gsub(/([A-Z])/, '_\1').downcase
45
46
  class_name[0] = '' if class_name[0] == '_'
46
47
  class_name = "#{module_name}::#{class_name}" if module_name
47
- elsif line =~ /# @route_domain (.*?)$/
48
- domain = line.gsub(/# @route_domain (.*?)$/, '\1')
49
- domains << domain if !domains.include?(domain)
48
+ elsif line =~ /# @route_domain (.*?)$/
49
+ # Ignore if we have a domain constrainer
50
+ if domains.is_a?(Array)
51
+ domain = line.gsub(/# @route_domain (.*?)$/, '\1')
52
+ domains << domain if !domains.include?(domain)
53
+ end
54
+ elsif line =~ /# @route_domain_constrainer (.*?)$/
55
+ domains = line.gsub(/# @route_domain_constrainer (.*?)$/, '\1')
50
56
  elsif line =~ /# @route_constraints (.*?)$/
51
57
  constraints = line.gsub(/# @route_constraints (.*?)$/, '\1')
52
58
  uris.last[1] = constraints if uris.length > 0
@@ -67,7 +73,7 @@ module Caboose
67
73
  elsif line =~ /# @route DELETE (.*?)/ then uris << ["delete \"#{line.gsub(/# @route DELETE (.*?)/ , '\1').strip}\"", nil]
68
74
  end
69
75
  end
70
- ds = domains.count > 0 ? domains.sort.join(' ') : 'zzz_all_domains'
76
+ ds = domains.is_a?(Array) ? (domains.count > 0 ? domains.sort.join(' ') : 'zzz_all_domains') : "CONSTRAIN #{domains}"
71
77
  classes[ds] = [] if classes[ds].nil?
72
78
  classes[ds] << [class_name, actions, class_priority]
73
79
  end
@@ -76,9 +82,14 @@ module Caboose
76
82
  routes = []
77
83
  classes.sort_by{ |domain, domain_classes| domain }.to_h.each do |domain, domain_classes|
78
84
 
79
- if domain != 'zzz_all_domains'
80
- domains = domain.split(' ').collect{ |d| "'#{d}'" }.join(', ')
81
- routes << "constraints Caboose::DomainConstraint.new([#{domains}]) do"
85
+ if domain != 'zzz_all_domains'
86
+ if domain.starts_with?('CONSTRAIN ')
87
+ constrainer = domain.gsub('CONSTRAIN ', '')
88
+ routes << "constraints #{constrainer}.new do"
89
+ else
90
+ domains = domain.split(' ').collect{ |d| "'#{d}'" }.join(', ')
91
+ routes << "constraints Caboose::DomainConstraint.new([#{domains}]) do"
92
+ end
82
93
  end
83
94
  domain_classes.sort_by{ |arr| arr[2] }.each do |carr|
84
95
 
@@ -1,5 +1,5 @@
1
1
  class Caboose::DomainConstraint
2
- def initialize(domains)
2
+ def initialize(domains)
3
3
  @domains = domains.is_a?(Array) ? domains.flatten : [domains].flatten
4
4
  end
5
5
 
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.8.40'
2
+ VERSION = '0.8.41'
3
3
  end
@@ -188,32 +188,34 @@ namespace :caboose do
188
188
  puts "Create a new Nine Lite site\n"
189
189
  puts "--------------------------------------------------------------------------------\n"
190
190
 
191
- input = ''
192
- STDOUT.puts "What is the name of the site?"
193
- input = STDIN.gets.chomp
194
- puts "\n"
195
-
196
- input2 = ''
197
- STDOUT.puts "What is the ID of the home page?"
198
- input2 = STDIN.gets.chomp
191
+ site_name = ''
192
+ while site_name.nil? || site_name.strip.length == 0 do
193
+ STDOUT.puts "What is the name of the site?"
194
+ site_name = STDIN.gets.chomp
195
+ end
199
196
  puts "\n"
200
-
201
- input3 = ''
202
- STDOUT.puts "E-commerce? (y/n)"
203
- input3 = STDIN.gets.chomp
197
+
198
+ use_store = ''
199
+ while use_store.nil? || (use_store.downcase != 'y' && use_store.downcase != 'n') do
200
+ STDOUT.puts "E-commerce? (y/n)"
201
+ use_store = STDIN.gets.chomp
202
+ end
204
203
  puts "\n"
205
-
206
- if !input.blank? && !input2.blank? && !input3.blank?
207
- helper = SiteHelper.new(input,input2,input3)
208
- helper.create_site
209
-
210
- puts "\n"
211
- puts "--------------------------------------------------------------------------------\n"
212
- puts "Choo! Choo! Your site is set up!\n"
213
- puts "--------------------------------------------------------------------------------\n"
214
- else
215
- puts "Invalid site name or home page ID"
204
+
205
+ use_mls = ''
206
+ while use_mls.nil? || (use_mls.downcase != 'y' && use_mls.downcase != 'n') do
207
+ STDOUT.puts "MLS? (y/n)"
208
+ use_mls = STDIN.gets.chomp
216
209
  end
210
+ puts "\n"
211
+
212
+ helper = SiteHelper.new
213
+ helper.create_site(site_name, use_store.downcase == 'y', use_mls.downcase == 'y')
214
+
215
+ puts "\n"
216
+ puts "--------------------------------------------------------------------------------\n"
217
+ puts "Choo! Choo! Your site is set up!\n"
218
+ puts "--------------------------------------------------------------------------------\n"
217
219
  end
218
220
 
219
221
  desc "Create blocks for new site"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.40
4
+ version: 0.8.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-10 00:00:00.000000000 Z
11
+ date: 2016-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg