install_theme 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,8 @@
1
+ === 0.7.2 / 2009-10-10
2
+
3
+ * CLI shows a useful error message when --partial argument is incorrectly formatted
4
+ * added History link to README
5
+
1
6
  === 0.7.1 / 2009-10-08
2
7
 
3
8
  Major:
@@ -2,6 +2,7 @@
2
2
 
3
3
  * http://drnicwilliams.com/2009/10/06/install-any-html-themetemplate-into-your-rails-app/
4
4
  * http://github.com/drnic/install_theme
5
+ * http://github.com/drnic/install_theme/raw/master/History.txt
5
6
 
6
7
  == DESCRIPTION:
7
8
 
@@ -10,7 +10,7 @@ require 'sass/css'
10
10
  require 'haml/exec'
11
11
 
12
12
  class InstallTheme
13
- VERSION = "0.7.1"
13
+ VERSION = "0.7.2"
14
14
 
15
15
  attr_reader :template_root, :rails_root, :index_path, :template_type
16
16
  attr_reader :layout_name
@@ -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, css_path = arg.split(/\s*:\s*/)[0..1]
22
- options[:partials][key.strip] = css_path.strip
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.1
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-08 00:00:00 +10:00
12
+ date: 2009-10-10 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency