install_theme 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/README.rdoc +1 -0
- data/lib/install_theme.rb +1 -1
- data/lib/install_theme/cli.rb +14 -2
- data/spec/install_theme_cli_spec.rb +11 -0
- metadata +2 -2
data/History.txt
CHANGED
data/README.rdoc
CHANGED
data/lib/install_theme.rb
CHANGED
data/lib/install_theme/cli.rb
CHANGED
@@ -18,8 +18,13 @@ class InstallTheme
|
|
18
18
|
"Example using CSS path: --partial header:#header",
|
19
19
|
"Example using XPath: --partial \"header://div[@id='header']\"") do |arg|
|
20
20
|
options[:partials] ||= {}
|
21
|
-
key,
|
22
|
-
|
21
|
+
key, path = arg.split(/\s*:\s*/)[0..1]
|
22
|
+
if key && path
|
23
|
+
options[:partials][key.strip] = path.strip
|
24
|
+
else
|
25
|
+
stdout.puts partial_format_error(arg)
|
26
|
+
exit
|
27
|
+
end
|
23
28
|
end
|
24
29
|
opts.on("-l", "--layout application", String,
|
25
30
|
"Set the layout file name.",
|
@@ -53,5 +58,12 @@ class InstallTheme
|
|
53
58
|
end
|
54
59
|
theme.apply_to_target
|
55
60
|
end
|
61
|
+
|
62
|
+
def self.partial_format_error(partial_argument)
|
63
|
+
<<-EOS.gsub(/^ /, '')
|
64
|
+
ERROR: Incorrect format for --partial argument "#{partial_argument}".
|
65
|
+
Correct format is: --partial label:path
|
66
|
+
EOS
|
67
|
+
end
|
56
68
|
end
|
57
69
|
end
|
@@ -43,4 +43,15 @@ describe InstallTheme::CLI, "execute" do
|
|
43
43
|
InstallTheme::CLI.execute(stdout_io, %w[path/to/rails_app path/to/template])
|
44
44
|
end
|
45
45
|
end
|
46
|
+
|
47
|
+
it "shows useful error message for poorly formatted --partial argument" do
|
48
|
+
@stdout = stdout do |stdout_io|
|
49
|
+
lambda do
|
50
|
+
InstallTheme::CLI.execute(stdout_io, %w[path/to/rails_app path/to/template -p .just_dom])
|
51
|
+
end.should raise_error(Exception)
|
52
|
+
end
|
53
|
+
@stdout.should =~ /incorrect format for --partial argument ".just_dom"/i
|
54
|
+
@stdout.should =~ /correct format/i
|
55
|
+
@stdout.should =~ /label:path/i
|
56
|
+
end
|
46
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: install_theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dr Nic Williams
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-10 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|