social_snippet-supports-mongoid 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Nzg1OTYwYmMzNDU5NmI3ZjdlNmU0ZmJhNmRiMGRmOWI2YzJhNGQ0YQ==
4
+ ZTQwZTg5ODU3MzliOTA2OTFlMzhmODVhNGZlZTY2NzlmNGI4ZjU3MQ==
5
5
  data.tar.gz: !binary |-
6
- ODg3NzQ5ZjU3YzdmMmZiMzc0ODdhZDE1ODg2MmU5MGM5ODMxN2FhMw==
6
+ ZGZiYmZiMTFiNTg5NjY4OGNmZDM0NWYxZTJmOGNjMWYzZDY5ZTYxOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmUwNWIxMDJhZWFlOWUxMjU2ZjNkZGRhY2ViYTk0YTk1YTlkYzI3NjQ4OGE5
10
- YWVhZDE1NGViNzE5MDI2ZGEzYWQ0MjE3OGUwOWUxY2Y4MTk2YWE0NGFjODZi
11
- MjhjN2VlNjJhYzVlMDI2YWM4NzI5NjM3ZmUyMzk3OTUzMjRiZjk=
9
+ M2I1YTllMzU5OTk2MWJjNjdkMjI2ZDM5MjRiNGZhMjU4NWNmMzFjMzIxMGYy
10
+ ZDQ3YjJkY2NlMzQ2OGM2YmU4NjI4NzQ5MTJiMzIyOGI3ZmFjNDJlODA4Yjcz
11
+ ODg1OTczMTc1NzFkOGFiZDUyNjQ4YmU5NDAyZDAwMGNmNGUxNmE=
12
12
  data.tar.gz: !binary |-
13
- YzFjNDJlYWNiZmFlMGQ3YjkwNTg2NTcyODc1ZGU0N2MyOGEwNDVmNTgxZTg4
14
- YzY3MzA1NjIxZjg5NDk1ZGMxZjM2MGYzOGNiOTNmNTZiNTVhMTZlZGIyYWE1
15
- YjE5MWQzMmVlNWM5NjU0MTAwMWM3Y2M1ODNlM2YxNmMxMjQ5MWQ=
13
+ OWY2ZjYwY2ZhMWVjMDU4MzVkZGQ4MTFkYTgzMjQ1YmRjNzFhODA5NjIxMmQ0
14
+ MzI4MThjMjVhMWNhOTllNWNhYWJjNzZkNTBlOGFiM2M1YjdlMTBmYzVmYTA1
15
+ ZGJjNjJlZGNhMDEzNWU3MjAyN2YwNTkwMjg3OTQ3MmFmMmY0MWM=
data/.travis.yml CHANGED
@@ -17,6 +17,17 @@ install:
17
17
  script:
18
18
  - bundle exec rake spec
19
19
 
20
+ # test shell access
21
+ - bundle exec ./test/bin/sspm_mongo install example-repo#1.0.0
22
+ - echo "// @snip <example-repo:func.cpp>" | bundle exec ./test/bin/ssnip_mongo
23
+ - echo "// @snip <example-repo:func.cpp>" | bundle exec ssnip || echo ok
24
+
25
+ - bundle exec ./test/bin/sspm_mongo update
26
+ - echo "// @snip <example-repo:func.cpp>" | bundle exec ./test/bin/ssnip_mongo
27
+ - echo "// @snip <example-repo:func.cpp>" | bundle exec ssnip || echo ok
28
+
29
+ - bundle exec ./test/bin/sspm_mongo update
30
+
20
31
  deploy:
21
32
  provider: rubygems
22
33
  api_key:
@@ -16,6 +16,7 @@ module SocialSnippet::StorageBackend
16
16
  end
17
17
 
18
18
  def cd(path)
19
+ raise ::Errno::ENOENT unless exists?(path)
19
20
  if absolute?(path)
20
21
  @workdir = normalize(path)
21
22
  else
@@ -24,6 +25,7 @@ module SocialSnippet::StorageBackend
24
25
  end
25
26
 
26
27
  def touch(path)
28
+ raise ::Errno::ENOENT unless exists?(::File.dirname path)
27
29
  realpath = resolve(path)
28
30
  add_path realpath
29
31
  end
@@ -41,9 +43,13 @@ module SocialSnippet::StorageBackend
41
43
  def read(path)
42
44
  realpath = resolve(path)
43
45
  raise ::Errno::EISDIR if directory?(path)
44
- file = File.find_by(
45
- :path => realpath,
46
- )
46
+ begin
47
+ file = File.find_by(
48
+ :path => realpath,
49
+ )
50
+ rescue ::Mongoid::Errors::DocumentNotFound
51
+ raise ::Errno::ENOENT
52
+ end
47
53
  file.content
48
54
  end
49
55
 
@@ -66,11 +72,13 @@ module SocialSnippet::StorageBackend
66
72
  end
67
73
 
68
74
  def rm(path)
75
+ raise ::Errno::ENOENT unless exists?(path)
69
76
  realpath = resolve(path)
70
77
  delete_path realpath
71
78
  end
72
79
 
73
80
  def rm_r(path)
81
+ raise ::Errno::ENOENT unless exists?(path)
74
82
  realpath = resolve(path)
75
83
  paths.each do |tmp_path|
76
84
  delete_path tmp_path if tmp_path.start_with?(realpath)
@@ -112,11 +120,13 @@ module SocialSnippet::StorageBackend
112
120
  private
113
121
 
114
122
  def add_dir(path)
123
+ return if exists?(path)
115
124
  add_path path
116
125
  add_path dirpath(path)
117
126
  end
118
127
 
119
128
  def add_parent_dir(path)
129
+ return if exists?(path)
120
130
  items = path.split(::File::SEPARATOR)
121
131
  items.pop
122
132
  items.inject(::Array.new) do |tmp, item|
@@ -1,7 +1,7 @@
1
1
  module SocialSnippet
2
2
  module Supports
3
3
  module Mongoid
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_snippet-supports-mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroyuki Sano
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2015-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid