octodmin 0.3.2 → 0.3.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: 25769485b174a543c10c85b8cb1ebf99ca8c91ab
4
- data.tar.gz: b76e24969e9b7af79ae149d8afc5f6cb38993f44
3
+ metadata.gz: 207917c44b0ad259fd325ac59a1ef6b87acb50dc
4
+ data.tar.gz: 28f2f2ec10f07ae8b2d6429050de0fb9a540064c
5
5
  SHA512:
6
- metadata.gz: ebbe2421ce23ccb9d75d5e34219a033af078ff00d1b874c96744349ae76bf6d9914109107863aa2f0c29b6e4e3b41059d5136e048760370f12342f6d946522c7
7
- data.tar.gz: 754ba99ebfbfc6dd7100963895c96da4703c2587bee523b99a614584bfdd969eeeb9d83b574c92491a825306b25626e7b15e1d10fc6f0ce67265b0696d555147
6
+ metadata.gz: 53ec4a89d232f58233bffb16a074df6031a5d0ae015667dced1fe2e5525dd4547f87258fd4ac7bf66a9ca0232fdc40b13890038df500e85ead94ce3c5c768c05
7
+ data.tar.gz: dc14442b02b80843460ac4863b711e2a9662a69546478baebb8db7f751ce2741cdac15846da77d9fe79362836c546b4ac8805cf6afd5f5e07ccc0e0224fc1bbd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ v0.3.3
2
+ ------
3
+
4
+ * Make sync really delete files
5
+
1
6
  v0.3.2
2
7
  ------
3
8
 
@@ -16,7 +16,7 @@ module Octodmin::Controllers::Syncs
16
16
  git.pull
17
17
 
18
18
  # Commit and push changes if any
19
- commit(site, git)
19
+ sync(site, git)
20
20
  rescue Git::GitExecuteError => e
21
21
  halt 400, JSON.dump(errors: [e.message])
22
22
  ensure
@@ -25,12 +25,15 @@ module Octodmin::Controllers::Syncs
25
25
 
26
26
  private
27
27
 
28
+ def deleted(site)
29
+ site.status.deleted.keys.map { |path| File.join(Octodmin::App.dir, path) }
30
+ end
31
+
28
32
  def stage(site, git)
29
33
  # Posts
30
- deleted = site.status.deleted.keys.map { |path| File.join(Octodmin::App.dir, path) }
31
34
  site.posts.each do |post|
32
35
  path = File.join(site.source, post.path)
33
- git.add(path) unless deleted.include?(path)
36
+ git.add(path) unless deleted(site).include?(path)
34
37
  end
35
38
 
36
39
  # Uploads
@@ -47,13 +50,14 @@ module Octodmin::Controllers::Syncs
47
50
  end
48
51
  end
49
52
 
50
- def commit(site, git)
53
+ def sync(site, git)
51
54
  staged = paths(site, git)
52
55
 
53
56
  if staged.any?
54
57
  @message = "Octodmin sync for #{staged.count} file#{"s" if staged.count > 1}"
55
58
  @message += "\n\n#{staged.join("\n")}"
56
59
 
60
+ deleted(site).each { |path| File.delete(path) }
57
61
  git.commit(@message)
58
62
  git.push
59
63
  else
@@ -1,3 +1,3 @@
1
1
  module Octodmin
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -79,6 +79,8 @@ end
79
79
  subject { parse_json(last_response.body)["syncs"] }
80
80
 
81
81
  it "returns syncs" do
82
+ expect(File.exists?("sample/_posts/2015-01-29-welcome-to-jekyll.markdown")).to be_falsey
83
+
82
84
  expect(subject).to eql([[
83
85
  "Octodmin sync for 4 files\n",
84
86
  "octodmin/2015-01-30-test/ear.png",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octodmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Krasnoukhov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-11 00:00:00.000000000 Z
11
+ date: 2015-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octopress