bogy 1.0 → 1.1

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: 5b1ee1ae283a26e39506b06845d4b059f72b94c5
4
- data.tar.gz: 572b8d10e7ee2cefc1e5d0b304b16a8dc20e4e47
3
+ metadata.gz: 7a0162ab0c2ec49013649bcf9f947f8cdab60239
4
+ data.tar.gz: 705d10c8dbf556703c0bb39afff10f468e2dfeb1
5
5
  SHA512:
6
- metadata.gz: f753efd287bc5965420fd58e770fce362059d1f1d8b15cd6f219ac8cc4d784f78644f60e3c8bdc5897924037caa289ce5bce85f4a661b94345537de68bb78aa4
7
- data.tar.gz: b205e53b61e8da6be7856b3a8a726dd7b7e32c89b400093d1995e3a6691b0ef8ff0dd7b890c9eefd67688dcaf7b00119d08309c0f3f89191a577525b4b083c27
6
+ metadata.gz: f8add9e85a503fcd88eb7e3f35d7ffe2fae46308cbecf5aa9c302e5ec596a7567a4c3eb812a724d01ec12da77d0b398c6eb5553dd52702c19fbdec2ae3e97cbd
7
+ data.tar.gz: fc6dce56de9a052b56074e38acec775da200a529ed7baf2167ecac4daa46f31a9dd355b5faab5ce95455f854c899c509fde8933085de8a9da2970c0732ab111e
@@ -1,4 +1,12 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
6
+ - 2.1.1
3
7
  - 2.2.2
8
+ - jruby-19mode # JRuby in 1.9 mode
4
9
  before_install: gem install bundler -v 1.10.6
10
+
11
+ notifications:
12
+ email: false
@@ -0,0 +1,9 @@
1
+ # nehm change log
2
+
3
+ ## 1.1
4
+ * Add support for Ruby 1.9.3, JRuby, rbx
5
+ * Fix critical bugs
6
+ * Add test coverage (RSpec)
7
+
8
+ ## 1.0
9
+ * First version
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2015 Albert Nigmatzianov
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,26 +1,15 @@
1
- # Introduction
1
+ *bogy* is Ruby wrapper for YAML, which provides a little more convenient interaction with YAML
2
2
 
3
- *bogy* is YAML wrapper, which provides a little more convenient interaction with YAML
3
+ [![Gem Version](https://badge.fury.io/rb/bogy.svg)](http://badge.fury.io/rb/bogy)
4
+ [![Build Status](https://travis-ci.org/bogem/bogy.svg?branch=master)](https://travis-ci.org/bogem/bogy)
5
+ [![Dependency Status](https://gemnasium.com/bogem/bogy.svg)](https://gemnasium.com/bogem/bogy)
6
+ [![Code Climate](https://codeclimate.com/github/bogem/bogy/badges/gpa.svg)](https://codeclimate.com/github/bogem/bogy)
4
7
 
5
8
  ## Installation
6
9
 
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'bogy'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
10
  $ gem install bogy
20
11
 
21
- ## Usage
22
-
23
- ### Available methods
12
+ ## Available methods
24
13
  ```ruby
25
14
  # Parsing files
26
15
  path = 'file.yml'
@@ -30,9 +19,9 @@ yaml = Bogy.new(file: path)
30
19
  string = "---\n:a: 1\n:b: 2\n" # Looks {a: 1, b: 2} as hash
31
20
  yaml = Bogy.new(string: string)
32
21
 
33
- yaml[:foo] = 'bar' # => "bar". Automatically writes to file, if you parse file
34
- yaml[:foo] # => "bar"
35
- yaml.delete(:foo) # => "bar". Also automatically writes to file, if you parse file
22
+ yaml['foo'] = 'bar' # => "bar". Automatically writes to file, if you parse file
23
+ yaml['foo'] # => "bar"
24
+ yaml.delete('foo') # => "bar". Also automatically writes to file, if you parse file
36
25
  yaml.to_h # => {:a=>1, :b=>2}
37
26
  yaml.to_yaml # => ---\n:a: 1\n:b: 2\n"
38
27
  yaml.write_to_file('another_yaml_file.yml') # Writes to 'another_yaml_file.yml' file
@@ -42,6 +31,6 @@ hash = {a: 1, b:2}
42
31
  Bogy.new(hash: hash).write_to_file('file.yml') # Automatically converts to YAML
43
32
  ```
44
33
 
45
- ## Contributing
34
+ ## License
46
35
 
47
- Bug reports and pull requests are welcome on GitHub at https://github.com/bogem/bogy.
36
+ MIT License
data/Rakefile CHANGED
@@ -1,10 +1,12 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
3
5
 
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList['test/**/*_test.rb']
8
- end
6
+ desc 'Run all tests by default'
7
+ task default: :spec
9
8
 
10
- task :default => :test
9
+ require 'rspec/core/rake_task'
10
+ RSpec::Core::RakeTask.new do |t|
11
+ t.rspec_opts = ['--color', '--format doc']
12
+ end
@@ -6,17 +6,18 @@ require 'bogy/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'bogy'
8
8
  spec.version = Bogy::VERSION
9
- spec.authors = ['Albert']
9
+ spec.authors = ['Albert Nigmatzianov']
10
10
  spec.email = ['albertnigma@gmail.com']
11
11
 
12
- spec.summary = %q{Little more convenient interaction with YAML}
13
- spec.description = %q{bogy is YAML wrapper, which provides a little more convenient interaction with YAML}
12
+ spec.summary = %q{Ruby wrapper for YAML}
13
+ spec.description = %q{bogy is Ruby wrapper for YAML, which provides a little more convenient interaction with YAML}
14
14
  spec.homepage = 'https://github.com/bogem/bogy'
15
15
  spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.require_paths = ["lib"]
18
+ spec.require_paths = ['lib']
19
19
 
20
20
  spec.add_development_dependency 'bundler', '~> 1.10'
21
21
  spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'rspec', '~> 3.3.0'
22
23
  end
@@ -7,17 +7,20 @@ require 'bogy/hash_handler'
7
7
  require 'bogy/string_handler'
8
8
 
9
9
  class Bogy
10
- def initialize(file: nil, hash: nil, string: nil)
11
- # If user provides two arguments
12
- fail ArgumentError.new('You should provide only one argument') if file && string
10
+ def initialize(options = nil)
11
+ # If user provides no arguments
12
+ fail ArgumentError, 'wrong number of arguments (0 for 1)' if options.nil?
13
+
14
+ # If user provides more than one arguments
15
+ fail ArgumentError, 'you should provide only one argument' if options.length > 1
13
16
 
14
17
  @handler =
15
- if file
16
- FileHandler.new(file)
17
- elsif hash
18
- HashHandler.new(hash)
19
- elsif string
20
- StringHandler.new(string)
18
+ if options[:file]
19
+ FileHandler.new(options[:file])
20
+ elsif options[:hash]
21
+ HashHandler.new(options[:hash])
22
+ elsif options[:string]
23
+ StringHandler.new(options[:string])
21
24
  end
22
25
  end
23
26
 
@@ -11,7 +11,7 @@ class Bogy
11
11
  end
12
12
 
13
13
  def write
14
- IO.write(@path, @hash.to_yaml)
14
+ IO.write(@path, hash.to_yaml)
15
15
  end
16
16
  end
17
17
  end
@@ -3,7 +3,6 @@ class Bogy
3
3
  class Handler
4
4
  def hash
5
5
  load_to_hash
6
- @hash
7
6
  end
8
7
 
9
8
  def load; end
@@ -1,3 +1,3 @@
1
- module Bogy
2
- VERSION = '1.0'.freeze
1
+ class Bogy
2
+ VERSION = '1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bogy
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
- - Albert
7
+ - Albert Nigmatzianov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-23 00:00:00.000000000 Z
11
+ date: 2015-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,8 +38,22 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: bogy is YAML wrapper, which provides a little more convenient interaction
42
- with YAML
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.3.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.3.0
55
+ description: bogy is Ruby wrapper for YAML, which provides a little more convenient
56
+ interaction with YAML
43
57
  email:
44
58
  - albertnigma@gmail.com
45
59
  executables: []
@@ -48,7 +62,9 @@ extra_rdoc_files: []
48
62
  files:
49
63
  - ".gitignore"
50
64
  - ".travis.yml"
65
+ - CHANGELOG.md
51
66
  - Gemfile
67
+ - LICENSE
52
68
  - README.md
53
69
  - Rakefile
54
70
  - bogy.gemspec
@@ -82,5 +98,5 @@ rubyforge_project:
82
98
  rubygems_version: 2.4.8
83
99
  signing_key:
84
100
  specification_version: 4
85
- summary: Little more convenient interaction with YAML
101
+ summary: Ruby wrapper for YAML
86
102
  test_files: []