jekyll-staging 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 998fa4dd69ea57ee2a2e9603bac9efc3db466569
4
- data.tar.gz: fcf22ca82c1782191fa89828822895a952b8eb8a
3
+ metadata.gz: d74d3f0315b7ebb1a323c30803583d65e7d86350
4
+ data.tar.gz: 376e454356e4352d0940aba35412539e77a82d77
5
5
  SHA512:
6
- metadata.gz: d890ece7c923187574281ba72cb05407ec23c844c8286acbf73b1e77c9b08935d5e56b642de5fb5cd0fc09a1d2a9d0d2246d3f4f029ee51019836d0f65beb87b
7
- data.tar.gz: 8e9180ba87fa2aeb5b149db51a5a02064a52cb34f10a0e0607e0ea6dcecf2155bc51d21577f733c47457f33f042b76ba1cc7f916f1c9250cb78bcd573fa8f1f0
6
+ metadata.gz: 24c7e96adf27cbc5e50b78ebb33818cb8b2bc987caeefc858176aeda19386815e3767e69fe8f03a49ee7f4906c18f129c697fe50d8ec2ad03d8aede12409b153
7
+ data.tar.gz: a3e1e1c4c019c7db2a2e41324bd3dfa69ea26fc5d7c4a70bdefc57f362c113c6285fa46ec67eb83176f34542d79f7fa10bc8913c2a2c17c068d81f8f631b14eb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-staging (1.0.2)
4
+ jekyll-staging (1.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.markdown CHANGED
@@ -46,11 +46,11 @@ Basically:
46
46
 
47
47
  You don't need to specify full paths, because it'll be looking in your drafts folder anyway. Feel free to use partial filenames, and shell glob patterns. If there's more than one match, it'll use the first one, and it'll output the full list of matches as well as the filename it chose.
48
48
 
49
- Let's say you had a draft whose filename was `got-a-new-iphone.markdown`. A typical workflow would be:
49
+ Let's say you had a draft whose filename was `my-new-iphone.markdown`. A typical workflow would be as follows. It assumes you're already in your Jekyll site's root directory.
50
50
 
51
51
  1. **`stage iphone`** (stage the draft for Jekyll)
52
52
 
53
- 2. **`jekyll serve`** (start the built-in web server, changing to your Jekyll directory first)
53
+ 2. **`jekyll serve`** (start the built-in web server)
54
54
 
55
55
  3. Edit your post as you see fit, and view it in your browser. When you're done, kill Jekyll's web server.
56
56
 
@@ -61,7 +61,7 @@ You can then decide whether to publish the post, and build and deploy your site
61
61
 
62
62
  ## Where does it temporarily put my other posts?
63
63
 
64
- In a directory called "`_stash`", in your Jekyll site's local root directory. The directory will be created if necessary. You can set a configuration option to make it use a different directory, if you want.
64
+ In a directory called "`_stash`", in your Jekyll site's local root directory. The directory will be created if necessary.
65
65
 
66
66
 
67
67
  ## Should I run it on my server?
data/bin/stage CHANGED
@@ -239,10 +239,27 @@ def unstage_file(the_filename_glob)
239
239
  end
240
240
 
241
241
 
242
+ def staging_in_progress()
243
+ # Try to determine if file(s) are already staged.
244
+
245
+ in_progress = false
246
+ if directory_exists($stash_dir)
247
+ Dir.chdir($stash_dir)
248
+ matches = Dir.glob("*.#{$file_extension}")
249
+ if matches.count > 0
250
+ # Posts are in the stash directory. We're probably staging.
251
+ in_progress = true
252
+ end
253
+ end
254
+
255
+ return in_progress
256
+ end
257
+
258
+
242
259
  def show_help()
243
- puts "`#{$0} FILENAME_GLOB` stages the first matching draft."
244
- puts "`#{$0} #{$unstage_flag}` unstages the first staged post."
245
- puts "`#{$0} #{$unstage_flag} FILENAME_GLOB` unstages the first matching staged post."
260
+ puts "`stage FILENAME_GLOB` stages the first matching draft."
261
+ puts "`stage #{$unstage_flag}` unstages the first staged post."
262
+ puts "`stage #{$unstage_flag} FILENAME_GLOB` unstages the first matching staged post."
246
263
  end
247
264
 
248
265
 
@@ -310,6 +327,19 @@ if directory_exists($stash_dir) == false
310
327
  end
311
328
  end
312
329
 
330
+ # Check whether we should proceed.
331
+ if !unstage and staging_in_progress()
332
+ puts "It looks like files are already staged. You should unstage them first (stage #{$unstage_flag})."
333
+ puts "Do you want to proceed anyway? (y/n) [n]"
334
+ proceed = STDIN.gets.strip.downcase.slice(0,1)
335
+ if !proceed or proceed != "y"
336
+ puts "Aborting."
337
+ exit
338
+ else
339
+ puts "Proceeding anyway."
340
+ end
341
+ end
342
+
313
343
  # Get the job done. It's a bit anticlimactic, really.
314
344
  if unstage
315
345
  unstage_file(filename_glob)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "jekyll-staging"
5
- spec.version = "1.0.2"
5
+ spec.version = "1.0.3"
6
6
  spec.authors = ["Matt Gemmell"]
7
7
  spec.email = ["matt@mattgemmell.com"]
8
8
  spec.summary = %q{Stage and unstage draft posts in Jekyll.}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-staging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Gemmell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-07 00:00:00.000000000 Z
11
+ date: 2015-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler