hx 0.6.0 → 0.6.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.
- data/VERSION +1 -1
- data/lib/hx/commandline.rb +19 -18
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
data/lib/hx/commandline.rb
CHANGED
@@ -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,
|
119
|
-
cmd_edit(site,
|
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,
|
124
|
-
cmd_post(site,
|
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.
|
129
|
-
|
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.
|
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,
|
146
|
+
do_edit(site, source_name, path, prototype)
|
139
147
|
end
|
140
148
|
|
141
|
-
def self.do_edit(site,
|
142
|
-
|
143
|
-
raise "
|
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
|