hx 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/hx/commandline.rb +19 -18
  3. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.1
@@ -115,39 +115,40 @@ def self.do_gen(site, update_only)
115
115
  end
116
116
  end
117
117
 
118
- def self.cmd_editup(site, pathspec)
119
- cmd_edit(site, pathspec)
118
+ def self.cmd_editup(site, entry_spec)
119
+ cmd_edit(site, entry_spec)
120
120
  cmd_upgen(site)
121
121
  end
122
122
 
123
- def self.cmd_postup(site, pathspec)
124
- cmd_post(site, pathspec)
123
+ def self.cmd_postup(site, entry_spec)
124
+ cmd_post(site, entry_spec)
125
125
  cmd_upgen(site)
126
126
  end
127
127
 
128
- def self.cmd_edit(site, pathspec)
129
- do_edit(site, pathspec, nil)
128
+ def self.parse_entry_spec(entry_spec)
129
+ source_name, path = entry_spec.split(':', 2)
130
+ raise "Invalid entry specification #{entry_spec}" unless path
131
+ return source_name, path
130
132
  end
131
133
 
132
- def self.cmd_post(site, pathspec)
134
+ def self.cmd_edit(site, entry_spec)
135
+ source_name, path = parse_entry_spec(entry_spec)
136
+ do_edit(site, source_name, path, nil)
137
+ end
138
+
139
+ def self.cmd_post(site, entry_spec)
140
+ source_name, path = parse_entry_spec(entry_spec)
133
141
  prototype = {
134
142
  'title' => Hx.make_default_title(site.options, path),
135
143
  'author' => Hx.get_default_author(site.options),
136
144
  'content' => ""
137
145
  }
138
- do_edit(site, pathspec, prototype)
146
+ do_edit(site, source_name, path, prototype)
139
147
  end
140
148
 
141
- def self.do_edit(site, pathspec, prototype)
142
- source_name, path = pathspec.split(':', 2)
143
- raise "Invalid entry specification #{pathspec}" unless path
144
-
145
- if source_name
146
- source = site.sources[source_name]
147
- raise ArgumentError, "No such source #{source_name}" unless source
148
- else
149
- source = site
150
- end
149
+ def self.do_edit(site, source_name, path, prototype)
150
+ source = site.sources[source_name]
151
+ raise ArgumentError, "No such source #{source_name}" unless source
151
152
 
152
153
  catch(:unchanged) do
153
154
  begin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - MenTaLguY