mint 0.5.1 → 0.7.1

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.
Files changed (50) hide show
  1. data/Gemfile +18 -0
  2. data/README.md +3 -3
  3. data/bin/mint +27 -27
  4. data/bin/mint-epub +6 -6
  5. data/config/syntax.yaml +12 -12
  6. data/{templates → config/templates}/base/style.sass +11 -4
  7. data/config/templates/default/css/style.css +158 -0
  8. data/config/templates/default/layout.haml +8 -0
  9. data/{templates → config/templates}/default/style.sass +0 -0
  10. data/{templates/default → config/templates/protocol}/layout.haml +0 -0
  11. data/config/templates/protocol/style.sass +20 -0
  12. data/config/templates/reset.css +92 -0
  13. data/config/templates/zen/css/style.css +145 -0
  14. data/{templates/pro → config/templates/zen}/layout.haml +0 -0
  15. data/config/templates/zen/style.sass +24 -0
  16. data/features/config.feature +21 -0
  17. data/features/publish.feature +3 -3
  18. data/features/support/env.rb +9 -27
  19. data/features/templates.feature +79 -0
  20. data/lib/mint.rb +11 -11
  21. data/lib/mint/{commandline.rb → command_line.rb} +96 -80
  22. data/lib/mint/css.rb +43 -34
  23. data/lib/mint/document.rb +99 -93
  24. data/lib/mint/helpers.rb +21 -17
  25. data/lib/mint/layout.rb +1 -1
  26. data/lib/mint/mint.rb +92 -36
  27. data/lib/mint/plugin.rb +5 -5
  28. data/lib/mint/plugins/epub.rb +51 -51
  29. data/lib/mint/resource.rb +2 -2
  30. data/lib/mint/style.rb +2 -2
  31. data/lib/mint/version.rb +1 -1
  32. data/spec/command_line_spec.rb +87 -0
  33. data/spec/css_spec.rb +46 -0
  34. data/spec/document_spec.rb +38 -40
  35. data/spec/helpers_spec.rb +101 -83
  36. data/spec/layout_spec.rb +1 -1
  37. data/spec/mint_spec.rb +184 -60
  38. data/spec/plugin_spec.rb +61 -67
  39. data/spec/plugins/epub_spec.rb +47 -47
  40. data/spec/resource_spec.rb +9 -9
  41. data/spec/spec_helper.rb +20 -93
  42. data/spec/style_spec.rb +6 -8
  43. data/spec/support/fixtures/content.md +16 -0
  44. data/spec/support/fixtures/dynamic.sass +3 -0
  45. data/spec/support/fixtures/layout.haml +3 -0
  46. data/spec/support/fixtures/static.css +3 -0
  47. data/spec/support/matchers.rb +15 -0
  48. metadata +160 -70
  49. data/spec/commandline_spec.rb +0 -91
  50. data/templates/pro/style.sass +0 -0
@@ -1,91 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Mint
4
- describe CommandLine do
5
- describe "#options" do
6
- it "provides default options" do
7
- CommandLine.options['template']['long'].should == 'template'
8
- CommandLine.options['layout']['long'].should == 'layout'
9
- CommandLine.options['style']['long'].should == 'style'
10
- end
11
- end
12
-
13
- describe "#parser" do
14
- it "provides a default option parser" do
15
- fake_argv = ['--layout', 'pro']
16
-
17
- options = {}
18
- CommandLine.parser {|k, p| options[k] = p }.parse!(fake_argv)
19
- options[:layout].should == 'pro'
20
- end
21
-
22
- it "provides an option parser based on a formatted hash" do
23
- fake_argv = ['--novel', 'novel']
24
- formatted_options = {
25
- # Option keys must be formatted as strings, so we
26
- # use hash-bang syntax
27
- novel: {
28
- 'short' => 'n',
29
- 'long' => 'novel',
30
- 'parameter' => true,
31
- 'description' => ''
32
- }
33
- }
34
-
35
- options = {}
36
-
37
- CommandLine.parser(formatted_options) do |k, p|
38
- options[k] = p
39
- end.parse!(fake_argv)
40
-
41
- options[:novel].should == 'novel'
42
- end
43
- end
44
-
45
- describe "#configuration" do
46
- context "when no config syntax file is loaded" do
47
- it "returns nil" do
48
- CommandLine.configuration(nil).should be_nil
49
- end
50
- end
51
-
52
- context "when a config syntax file is loaded but there is no .config file" do
53
- it "returns a default set of options" do
54
- expected_map = {
55
- layout: 'default',
56
- style: 'default',
57
- destination: nil,
58
- style_destination: nil
59
- }
60
-
61
- CommandLine.configuration.should == expected_map
62
- end
63
- end
64
-
65
- context "when a config syntax file is loaded and there is a .config file" do
66
- before do
67
- FileUtils.mkdir_p '.mint/config'
68
- File.open('.mint/config/config.yaml', 'w') do |file|
69
- file << 'layout: pro'
70
- end
71
- end
72
-
73
- after do
74
- File.delete '.mint/config/config.yaml'
75
- end
76
-
77
- it "merges all specified options with precedence according to scope" do
78
- CommandLine.configuration[:layout].should == 'pro'
79
- end
80
- end
81
- end
82
-
83
- it "displays the sum of all configuration files with other options added"
84
- it "prints a help message"
85
- it "installs a template file to the correct scope"
86
- it "pulls up a named template file in the user's editor"
87
- it "writes options to the correct file for the scope specified"
88
- it "sets and stores a scoped configuration variable"
89
- it "publishes a set of files"
90
- end
91
- end
File without changes