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 +4 -4
- data/CHANGELOG.md +5 -0
- data/app/controllers/syncs/create.rb +8 -4
- data/lib/octodmin/version.rb +1 -1
- data/spec/api/syncs_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 207917c44b0ad259fd325ac59a1ef6b87acb50dc
|
4
|
+
data.tar.gz: 28f2f2ec10f07ae8b2d6429050de0fb9a540064c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53ec4a89d232f58233bffb16a074df6031a5d0ae015667dced1fe2e5525dd4547f87258fd4ac7bf66a9ca0232fdc40b13890038df500e85ead94ce3c5c768c05
|
7
|
+
data.tar.gz: dc14442b02b80843460ac4863b711e2a9662a69546478baebb8db7f751ce2741cdac15846da77d9fe79362836c546b4ac8805cf6afd5f5e07ccc0e0224fc1bbd
|
data/CHANGELOG.md
CHANGED
@@ -16,7 +16,7 @@ module Octodmin::Controllers::Syncs
|
|
16
16
|
git.pull
|
17
17
|
|
18
18
|
# Commit and push changes if any
|
19
|
-
|
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
|
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
|
data/lib/octodmin/version.rb
CHANGED
data/spec/api/syncs_spec.rb
CHANGED
@@ -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.
|
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
|
+
date: 2015-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress
|