decko 0.9.5 → 0.9.6

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
  SHA256:
3
- metadata.gz: f4018b7131885e48e51f584ef71b01136360e459aa14f8e68902d93b7d4ca2d9
4
- data.tar.gz: 25fe31c5e4d15e9e859f3ba7bd24fcc05e05f36d799f09044cd4393ec56ee2ae
3
+ metadata.gz: 2a17a0150b6449cc689a0c12a358b7e5fbd826c2bd77cd2afc35e7fb9f7e176a
4
+ data.tar.gz: ed5a8517dca15772ac1ff9e13c3b55f419ab4f8b6fcbfe4f838240129c33ea05
5
5
  SHA512:
6
- metadata.gz: bfe7ffdf0f311d98016428ebb9fc6bba09917793eae1551df5661776d808a335d752388619ae8625231da39bbdb8b044498c6059274fed1a0ca0877fe766b2da
7
- data.tar.gz: 76a42b154b15c65575b63cab3ea021dab962aad73ff856663156110aed001f826227c9e0249f1ea0c62f16957e715f6366d273d0f15fe24c7b2abc35356491c5
6
+ metadata.gz: cc0429cd9c292009503a422005a8fdd12e39c1b3464ac3b9be786025e00e18362c234a0da075331fa3feed65c862b1a4f98a70df82a738cd36b84484b85073d2
7
+ data.tar.gz: 380832ea3ac521b77ffae9ee57b577917676fa9436a8e262768464be3103fffb6954e9e4ada389e8cf95c78acc0905c9e3a4f334bfdd2768955d1ba809786818
@@ -5,21 +5,22 @@ module Decko
5
5
  module Commands
6
6
  class RspecCommand
7
7
  class Parser < OptionParser
8
- def initialize opts
9
- super() do |parser|
10
- parser.banner = "Usage: decko rspec [DECKO ARGS] -- [RSPEC ARGS]\n\n" \
11
- "RSPEC ARGS"
12
- parser.separator <<-EOT
8
+ RSPEC_PATH_MESSAGE = <<-EOT
13
9
 
14
10
  DECKO ARGS
15
11
 
16
- You don't have to give a full path for FILENAME, the basename is enough
17
- If FILENAME does not include '_spec' rspec searches for the
18
- corresponding spec file.
19
- The line number always referes to example in the (corresponding) spec
20
- file.
12
+ You don't have to give a full path for FILENAME; the basename is enough.
13
+ If FILENAME does not include '_spec', then rspec searches for the
14
+ corresponding spec file.
15
+ The line number always refers to the example in the spec file.
16
+
17
+ EOT
21
18
 
22
- EOT
19
+ def initialize opts
20
+ super() do |parser|
21
+ parser.banner = "Usage: decko rspec [DECKO ARGS] -- [RSPEC ARGS]\n\n" \
22
+ "RSPEC ARGS"
23
+ parser.separator RSPEC_PATH_MESSAGE
23
24
 
24
25
  parser.on("-d", "--spec FILENAME(:LINE)",
25
26
  "Run spec for a Decko deck file") do |file|
@@ -31,42 +32,53 @@ module Decko
31
32
  end
32
33
  parser.on("-m", "--mod MODNAME",
33
34
  "Run all specs for a mod or matching a mod") do |file|
34
- opts[:files] =
35
- if File.exist?("mod/#{file}")
36
- "#{Cardio.gem_root}/mod/#{file}"
37
- elsif File.exist?("#{Cardio.gem_root}/mod/#{file}")
38
- "#{Cardio.gem_root}/mod/#{file}"
39
- elsif (files = find_spec_file(file, "mod")) && files.present?
40
- files
41
- else
42
- find_spec_file(file, "#{Cardio.gem_root}/mod")
43
- end
35
+ opts[:files] = find_mod_file(file, Cardio.gem_root)
44
36
  end
45
37
  parser.on("-s", "--[no-]simplecov", "Run with simplecov") do |s|
46
38
  opts[:simplecov] = s ? "" : "COVERAGE=false"
47
39
  end
48
40
  parser.on("--rescue", "Run with pry-rescue") do
49
- if opts[:executer] == "spring"
50
- puts "Disabled pry-rescue. Not compatible with spring."
51
- else
52
- opts[:rescue] = "rescue "
53
- end
41
+ process_rescue_opts opts
54
42
  end
55
43
  parser.on("--[no-]spring", "Run with spring") do |spring|
56
- if spring
57
- opts[:executer] = "spring"
58
- if opts[:rescue]
59
- opts[:rescue] = ""
60
- puts "Disabled pry-rescue. Not compatible with spring."
61
- end
62
- else
63
- opts[:executer] = "bundle exec"
64
- end
44
+ process_spring_opts spring, opts
65
45
  end
66
46
  parser.separator "\n"
67
47
  end
68
48
  end
69
49
 
50
+ private
51
+
52
+ def process_rescue_opts opts
53
+ if opts[:executer] == "spring"
54
+ puts "Disabled pry-rescue. Not compatible with spring."
55
+ else
56
+ opts[:rescue] = "rescue "
57
+ end
58
+ end
59
+
60
+ def process_spring_opts spring, opts
61
+ if spring
62
+ opts[:executer] = "spring"
63
+ if opts[:rescue]
64
+ opts[:rescue] = ""
65
+ puts "Disabled pry-rescue. Not compatible with spring."
66
+ end
67
+ else
68
+ opts[:executer] = "bundle exec"
69
+ end
70
+ end
71
+
72
+ def find_mod_file filename, base_dir
73
+ if File.exist?("mod/#{filename}") || File.exist?("#{base_dir}/mod/#{filename}")
74
+ "#{base_dir}/mod/#{filename}"
75
+ elsif (files = find_spec_file(filename, "mod"))&.present?
76
+ files
77
+ else
78
+ find_spec_file(file, "#{base_dir}/mod")
79
+ end
80
+ end
81
+
70
82
  def find_spec_file filename, base_dir
71
83
  file, line = filename.split(":")
72
84
  if file.include?("_spec.rb") && File.exist?(file)
@@ -21,3 +21,5 @@ CardSpecLoader.each_run do
21
21
  end
22
22
 
23
23
  CardSpecLoader.helper
24
+
25
+ Decko::ModsSpecHelper = :needs_a_value_so_spring_loader_is_happy
@@ -1,6 +1,10 @@
1
1
  module Decko
2
2
  # methods for managing decko responses
3
3
  module Response
4
+ def response_format
5
+ @response_format ||= format_name_from_params
6
+ end
7
+
4
8
  private
5
9
  def respond format, result, status
6
10
  if status.in? [302, 303]
@@ -94,7 +98,7 @@ module Decko
94
98
 
95
99
  def load_format
96
100
  request.format = :html if implicit_html?
97
- card.format format_name_from_params
101
+ card.format response_format
98
102
  end
99
103
 
100
104
  def implicit_html?
@@ -139,7 +143,7 @@ module Decko
139
143
  end
140
144
 
141
145
  def home_mark
142
- Card.global_setting(:home) || "Home"
146
+ Card::Rule.global_setting(:home) || "Home"
143
147
  end
144
148
 
145
149
  def view_does_not_require_name?
@@ -128,6 +128,7 @@ class CardController < ApplicationController
128
128
  show error.class.view, error.class.status_code
129
129
  end
130
130
 
131
+ # TODO: move to exception object
131
132
  def debug_exception? e
132
133
  !e.is_a?(Card::Error::UserError) &&
133
134
  !e.is_a?(ActiveRecord::RecordInvalid) &&
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decko
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-03-16 00:00:00.000000000 Z
14
+ date: 2020-06-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: card
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 1.99.5
22
+ version: 1.99.6
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.99.5
29
+ version: 1.99.6
30
30
  description: a wiki approach to stuctured data, dynamic interaction, and web design
31
31
  email:
32
32
  - info@decko.org