mint 0.1.4 → 0.1.5

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.
data/bin/mint CHANGED
@@ -11,25 +11,9 @@ module Mint
11
11
  # A map of all options that OptParse will accept from the commandline.
12
12
  # All other arguments are taken to be filenames.
13
13
  def self.options
14
- {
15
- # These options take parameters
16
- template: ['t', 'template', true, 'Specify the template (layout + style).'],
17
- layout: ['l', 'layout', true, 'Specify only the layout.'],
18
- style: ['s', 'style', true, 'Specify only the style.'],
19
- root: ['w', 'root', true, 'Specify a root outside the current directory.'],
20
- destination: ['d', 'destination', true,
21
- 'Specify a destination directory, relative to the root.'],
22
- style_destination: ['n', 'style-destination', true,
23
- 'Specify a destination directory for stylesheets, or nil to link in place'],
24
-
25
- # These options do not take parameters
26
- global: ['G', 'global', false, 'Specify config changes on a global level.'],
27
- user: ['U', 'user', false, 'Specify config changes on a user-wide level.'],
28
- local: ['L', 'local', false, 'Specify config changes on a project-specific level.'],
29
- force: ['f', 'force', false, 'Force file overwrite without prompt.'],
30
- verbose: ['v', 'verbose', false, 'Verbose output.'],
31
- simulation: ['s', 'simulation', false, 'Simulate transformation without actually creating files.']
32
- }
14
+ # Options file, relative to this one
15
+ options_file = '../../config/options.yaml'
16
+ YAML.load_file File.expand_path(options_file, __FILE__)
33
17
  end
34
18
 
35
19
  def self.config_options
@@ -42,7 +26,7 @@ module Mint
42
26
  select(&:exist?).
43
27
  map {|p| YAML.load_file p }.
44
28
  reverse.
45
- reduce(Hash.new) {|r,p| r.merge p }
29
+ reduce(Mint.default_options) {|r,p| r.merge p }
46
30
  end
47
31
 
48
32
  def self.full_options_with(commandline_options)
@@ -102,19 +86,19 @@ commandline_options = {}
102
86
  optparse = OptionParser.new do |opts|
103
87
  opts.banner = 'Usage: mint [command] files [options]'
104
88
 
105
- Mint::Commandline.options.each do |k,v|
106
- has_param = v[2]
89
+ Mint::CommandLine.options.each do |k,v|
90
+ has_param = v['parameter']
107
91
 
108
- v[0] = "-#{v[0]}"
109
- v[1] = "--#{v[1]}"
92
+ v['short'] = "-#{v['short']}"
93
+ v['long'] = "--#{v['long']}"
110
94
 
111
95
  if has_param
112
- v[1] << " PARAM"
113
- opts.on v[0], v[1], v[3] do |p|
114
- commandline_options[k] = p
96
+ v['long'] << " PARAM"
97
+ opts.on v['short'], v['long'], v['description'] do |p|
98
+ commandline_options[k.to_sym] = p
115
99
  end
116
100
  else
117
- opts.on v[0], v[1], v[3] do
101
+ opts.on v['short'], v['long'], v['description'] do
118
102
  commandline_options[k] = true
119
103
  end
120
104
  end
@@ -0,0 +1,72 @@
1
+ template:
2
+ short: t
3
+ long: template
4
+ parameter: true
5
+ description: 'Specify the template (layout + style).'
6
+
7
+ layout:
8
+ short: l
9
+ long: layout
10
+ parameter: true
11
+ description: 'Specify only the style'
12
+
13
+ style:
14
+ short: s
15
+ long: style
16
+ parameter: true
17
+ description: 'Specify only the style.'
18
+
19
+ root:
20
+ short: w
21
+ long: r
22
+ parameter: true
23
+ description: 'Specify a root outside the current directory.'
24
+
25
+ destination:
26
+ short: d
27
+ long: destination
28
+ parameter: true
29
+ description: 'Specify a destination directory, relative to the root.'
30
+
31
+ style_destination:
32
+ short: n
33
+ long: style-destination
34
+ parameter: true
35
+ description: 'Specify a destination directory for stylesheets, or nil to link in place'
36
+
37
+ global:
38
+ short: G
39
+ long: global
40
+ parameter: false
41
+ description: 'Specify config changes on a global level.'
42
+
43
+ user:
44
+ short: U
45
+ long: user
46
+ parameter: false
47
+ description: 'Specify config changes on a user-wide level.'
48
+
49
+
50
+ local:
51
+ short: L
52
+ long: local
53
+ parameter: false
54
+ description: 'Specify config changes on a project-specific level.'
55
+
56
+ force:
57
+ short: f
58
+ long: force
59
+ parameter: false
60
+ description: 'Force file overwrite without prompt.'
61
+
62
+ verbose:
63
+ short: v
64
+ long: verbose
65
+ parameter: false
66
+ description: 'Verbose output.'
67
+
68
+ simulation:
69
+ short: s
70
+ long: simulation
71
+ parameter: false
72
+ description: 'Simulate transformation without actually creating files.'
@@ -1,2 +1,3 @@
1
+ require 'mint/helpers'
1
2
  require 'mint/mint'
2
3
  require 'mint/version'
@@ -1,7 +1,6 @@
1
1
  require 'pathname'
2
2
  require 'fileutils'
3
3
  require 'tilt'
4
- require 'helpers'
5
4
 
6
5
  module Mint
7
6
 
@@ -11,7 +10,7 @@ module Mint
11
10
  Tilt.register 'html', Tilt::ERBTemplate
12
11
  Tilt.register 'css', Tilt::LessTemplate
13
12
 
14
- def root
13
+ def self.root
15
14
  Pathname.new(__FILE__).realpath.dirname + '../..'
16
15
  end
17
16
 
@@ -20,7 +19,8 @@ module Mint
20
19
  # Either way, earlier/higher paths take precedence. And is considered to
21
20
  # be the directory for "local" config options, templates, etc.
22
21
  def self.path
23
- mint_path = ENV['MINT_PATH'] || "#{Dir.getwd}/.mint:~/.mint:#{MINT_DIR}"
22
+ mint_path = ENV['MINT_PATH'] ||
23
+ "#{Dir.getwd}/.mint:~/.mint:#{Mint.root}"
24
24
  mint_path.split(':').map {|p| Pathname.new(p).expand_path }
25
25
  end
26
26
 
@@ -0,0 +1,3 @@
1
+ module Mint
2
+ VERSION = '0.1.5'
3
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - David Jacobs
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-01 00:00:00 -05:00
17
+ date: 2011-02-02 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -44,6 +44,8 @@ files:
44
44
  - lib/mint.rb
45
45
  - lib/mint/mint.rb
46
46
  - lib/mint/helpers.rb
47
+ - lib/mint/version.rb
48
+ - config/options.yaml
47
49
  has_rdoc: true
48
50
  homepage: http://github.com/davejacobs/mint
49
51
  licenses: []