soup 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require "rubygems"
2
- require "rake/gempackagetask"
3
- require "rake/rdoctask"
2
+ require "rubygems/package_task"
3
+ require "rdoc/task"
4
4
 
5
5
  task :default => :test
6
6
 
@@ -18,10 +18,10 @@ end
18
18
  # http://rubygems.org/read/chapter/20
19
19
  #
20
20
  spec = Gem::Specification.new do |s|
21
-
21
+
22
22
  # Change these as appropriate
23
23
  s.name = "soup"
24
- s.version = "1.0.9"
24
+ s.version = "1.0.10"
25
25
  s.summary = "A super-simple data store"
26
26
  s.author = "James Adam"
27
27
  s.email = "james@lazyatom.com"
@@ -33,15 +33,15 @@ spec = Gem::Specification.new do |s|
33
33
 
34
34
  # Add any extra files to include in the gem
35
35
  s.files = %w(Manifest Rakefile README) + Dir.glob("{test,lib}/**/*")
36
-
36
+
37
37
  s.require_paths = ["lib"]
38
-
38
+
39
39
  # If you want to depend on other gems, add them here, along with any
40
40
  # relevant versions
41
41
  # s.add_dependency("some_other_gem", "~> 0.1.0")
42
-
42
+
43
43
  # If your tests use any gems, include them here
44
- s.add_development_dependency("kintama", ">= 0.1.8")
44
+ s.add_development_dependency("kintama", ">= 0.1.11")
45
45
  s.add_development_dependency("rake")
46
46
  end
47
47
 
@@ -49,7 +49,7 @@ end
49
49
  # .gemspec file, which is useful if something (i.e. GitHub) will
50
50
  # be automatically building a gem for this project. If you're not
51
51
  # using GitHub, edit as appropriate.
52
- Rake::GemPackageTask.new(spec) do |pkg|
52
+ Gem::PackageTask.new(spec) do |pkg|
53
53
  pkg.gem_spec = spec
54
54
  end
55
55
 
@@ -61,6 +61,18 @@ end
61
61
 
62
62
  task :package => :gemspec
63
63
 
64
+ # Generate documentation
65
+ Rake::RDocTask.new do |rd|
66
+ rd.main = "README"
67
+ rd.rdoc_files.include("README", "lib/**/*.rb")
68
+ rd.rdoc_dir = "rdoc"
69
+ end
70
+
71
+ desc 'Clear out RDoc and generated packages'
72
+ task :clean => [:clobber_rdoc, :clobber_package] do
73
+ rm "#{spec.name}.gemspec"
74
+ end
75
+
64
76
  desc 'Tag the repository in git with gem version number'
65
77
  task :tag => [:gemspec, :package] do
66
78
  if `git diff --cached`.empty?
@@ -77,19 +89,7 @@ task :tag => [:gemspec, :package] do
77
89
  end
78
90
  end
79
91
 
80
- desc 'Release the gem to gemcutter and tag the repo'
81
- task :release => [:tag] do
92
+ desc "Tag and publish the gem to rubygems.org"
93
+ task :publish => :tag do
82
94
  `gem push pkg/#{spec.name}-#{spec.version}.gem`
83
95
  end
84
-
85
- # Generate documentation
86
- Rake::RDocTask.new do |rd|
87
- rd.main = "README"
88
- rd.rdoc_files.include("README", "lib/**/*.rb")
89
- rd.rdoc_dir = "rdoc"
90
- end
91
-
92
- desc 'Clear out RDoc and generated packages'
93
- task :clean => [:clobber_rdoc, :clobber_package] do
94
- rm "#{spec.name}.gemspec"
95
- end
@@ -26,7 +26,7 @@ class Soup
26
26
  File.open(path_for(attributes[:name], attributes[:extension]), 'w') do |f|
27
27
  attributes_without_content = attributes.dup
28
28
  f.write attributes_without_content.delete(:content)
29
- f.write attributes_without_content.to_yaml.gsub(/^---\s/, "\n") if attributes_without_content.any?
29
+ f.write attributes_without_content.to_yaml.gsub(/^---\s/, "\n\n") if attributes_without_content.any?
30
30
  end
31
31
  Snip.new(attributes, self)
32
32
  end
@@ -81,4 +81,4 @@ class Soup
81
81
  end
82
82
  end
83
83
  end
84
- end
84
+ end
@@ -11,7 +11,7 @@ class Soup
11
11
 
12
12
  def method_missing(*args)
13
13
  @backends.each do |backend|
14
- if result = backend.respond_to?(args.first) ? backend.__send__(*args) : nil
14
+ if result = (backend.respond_to?(args.first) ? backend.__send__(*args) : nil)
15
15
  return result
16
16
  end
17
17
  end
@@ -27,4 +27,4 @@ class Soup
27
27
  end
28
28
  end
29
29
  end
30
- end
30
+ end
@@ -36,7 +36,7 @@ class Soup
36
36
  File.open(path_for(attributes[:name]), 'w') do |f|
37
37
  attributes_without_content = attributes.dup
38
38
  f.write attributes_without_content.delete(:content)
39
- f.write attributes_without_content.to_yaml.gsub(/^---\s/, ATTRIBUTE_TOKEN) if attributes_without_content.any?
39
+ f.write attributes_without_content.to_yaml.gsub(/^---\s/, ATTRIBUTE_TOKEN + "\n") if attributes_without_content.any?
40
40
  end
41
41
  Snip.new(attributes, self)
42
42
  end
@@ -64,4 +64,4 @@ class Soup
64
64
  end
65
65
  end
66
66
  end
67
- end
67
+ end
data/lib/soup/snip.rb CHANGED
@@ -27,6 +27,10 @@ class Soup
27
27
  self == other
28
28
  end
29
29
 
30
+ def !=(other)
31
+ !eql?(other)
32
+ end
33
+
30
34
  def inspect
31
35
  keys = @attributes.keys.dup
32
36
  keys.delete(:name)
@@ -1,5 +1,5 @@
1
1
  require "test_helper"
2
- require "ftools"
2
+ require "fileutils"
3
3
  require "time"
4
4
 
5
5
  context "The file-based backend" do
@@ -83,4 +83,4 @@ of the snip
83
83
  def write_snip(name, content)
84
84
  File.open(path_for(name), "w") { |f| f.write content.strip }
85
85
  end
86
- end
86
+ end
@@ -2,7 +2,7 @@ require "test_helper"
2
2
 
3
3
  context "A Soup with multiple backends" do
4
4
  setup do
5
- @basic_soup_backend_one = Soup::Backends::YAMLBackend.new(File.join(@base_path, "soup_one"))
5
+ @basic_soup_backend_one = Soup::Backends::Memory.new
6
6
  @basic_soup_backend_two = Soup::Backends::FileBackend.new(File.join(@base_path, "soup_two"))
7
7
  @soup_one = Soup.new(@basic_soup_backend_one)
8
8
  @soup_two = Soup.new(@basic_soup_backend_two)
@@ -77,4 +77,4 @@ context "A Soup with multiple backends" do
77
77
  assert_equal 2, @soup.all_snips.length
78
78
  assert_equal %w(alpha beta), @soup.all_snips.map { |s| s.name }
79
79
  end
80
- end
80
+ end
data/test/soup_test.rb CHANGED
@@ -29,7 +29,7 @@ def each_backend(&block)
29
29
  backends = [
30
30
  yaml_backend = Soup::Backends::YAMLBackend.new(base_path),
31
31
  file_backend = Soup::Backends::FileBackend.new(base_path),
32
- Soup::Backends::MultiSoup.new(yaml_backend),
32
+ Soup::Backends::MultiSoup.new(file_backend),
33
33
  Soup::Backends::Memory.new
34
34
  ]
35
35
  backends.each do |backend|
@@ -90,4 +90,4 @@ each_backend do
90
90
  @soup['test'].destroy
91
91
  assert @soup['test'].nil?
92
92
  end
93
- end
93
+ end
data/test/test_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
- # require 'rubygems'
2
- $LOAD_PATH.unshift "/Users/james/Code/lazyatom/jtest/lib"
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
3
  require 'kintama'
4
4
  require 'soup'
5
5
 
metadata CHANGED
@@ -1,62 +1,55 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: soup
3
- version: !ruby/object:Gem::Version
4
- hash: 5
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.10
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 9
10
- version: 1.0.9
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - James Adam
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-07-29 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
12
+ date: 2012-11-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: kintama
16
+ requirement: !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 11
28
- segments:
29
- - 0
30
- - 1
31
- - 8
32
- version: 0.1.8
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.1.11
33
22
  type: :development
34
23
  prerelease: false
35
- requirement: *id001
36
- name: kintama
37
- - !ruby/object:Gem::Dependency
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.1.11
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
47
38
  type: :development
48
39
  prerelease: false
49
- requirement: *id002
50
- name: rake
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
51
46
  description:
52
47
  email: james@lazyatom.com
53
48
  executables: []
54
-
55
49
  extensions: []
56
-
57
- extra_rdoc_files:
50
+ extra_rdoc_files:
58
51
  - README
59
- files:
52
+ files:
60
53
  - Manifest
61
54
  - Rakefile
62
55
  - README
@@ -77,40 +70,36 @@ files:
77
70
  - lib/soup/snip.rb
78
71
  - lib/soup/test_helper.rb
79
72
  - lib/soup.rb
80
- has_rdoc: true
81
73
  homepage: http://lazyatom.com
82
74
  licenses: []
83
-
84
75
  post_install_message:
85
- rdoc_options:
76
+ rdoc_options:
86
77
  - --main
87
78
  - README
88
- require_paths:
79
+ require_paths:
89
80
  - lib
90
- required_ruby_version: !ruby/object:Gem::Requirement
81
+ required_ruby_version: !ruby/object:Gem::Requirement
91
82
  none: false
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- hash: 3
96
- segments:
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ segments:
97
88
  - 0
98
- version: "0"
99
- required_rubygems_version: !ruby/object:Gem::Requirement
89
+ hash: 2212562329042645875
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
91
  none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- hash: 3
105
- segments:
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ segments:
106
97
  - 0
107
- version: "0"
98
+ hash: 2212562329042645875
108
99
  requirements: []
109
-
110
100
  rubyforge_project:
111
- rubygems_version: 1.4.1
101
+ rubygems_version: 1.8.23
112
102
  signing_key:
113
103
  specification_version: 3
114
104
  summary: A super-simple data store
115
105
  test_files: []
116
-