YAMLiner 0.3.1 → 0.3.2
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.
- data/.gitignore +3 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +26 -0
- data/Rakefile +29 -31
- data/YAMLiner.gemspec +18 -48
- data/lib/YAMLiner/version.rb +3 -0
- data/lib/yamliner.rb +10 -9
- data/spec/spec_helper.rb +2 -3
- metadata +17 -16
- data/VERSION +0 -1
- data/spec/spec.opts +0 -1
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
YAMLiner (0.3.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.1.2)
|
10
|
+
rspec (2.0.1)
|
11
|
+
rspec-core (~> 2.0.1)
|
12
|
+
rspec-expectations (~> 2.0.1)
|
13
|
+
rspec-mocks (~> 2.0.1)
|
14
|
+
rspec-core (2.0.1)
|
15
|
+
rspec-expectations (2.0.1)
|
16
|
+
diff-lcs (>= 1.1.2)
|
17
|
+
rspec-mocks (2.0.1)
|
18
|
+
rspec-core (~> 2.0.1)
|
19
|
+
rspec-expectations (~> 2.0.1)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
YAMLiner!
|
26
|
+
rspec (~> 2.0.1)
|
data/Rakefile
CHANGED
@@ -1,36 +1,35 @@
|
|
1
|
-
|
2
|
-
require
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "YAMLiner/version"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "YAMLiner"
|
8
|
-
gem.summary = "inline YAML CRUD operations"
|
9
|
-
gem.description = "Simple gem that supplies inline YAML CRUD operations that usable by all kind of text files."
|
10
|
-
gem.email = "selman.ulug@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/selman/YAMLiner"
|
12
|
-
gem.authors = ["Selman ULUG"]
|
13
|
-
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
-
end
|
16
|
-
Jeweler::GemcutterTasks.new
|
17
|
-
rescue LoadError
|
18
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
-
end
|
4
|
+
require 'bundler'
|
5
|
+
Bundler::GemHelper.install_tasks
|
20
6
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
7
|
+
task :default => :spec
|
8
|
+
|
9
|
+
require 'rspec/core/rake_task'
|
10
|
+
RSpec::Core::RakeTask.new do |t|
|
11
|
+
t.pattern = 'spec/**/*_spec.rb'
|
25
12
|
end
|
26
13
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
14
|
+
begin
|
15
|
+
require 'flay'
|
16
|
+
require 'flay_task'
|
17
|
+
FlayTask.new
|
18
|
+
rescue LoadError
|
19
|
+
task :flay do
|
20
|
+
abort "Flay is not available. In order to run flay, you must: sudo gem install flay"
|
21
|
+
end
|
31
22
|
end
|
32
23
|
|
33
|
-
|
24
|
+
begin
|
25
|
+
require 'flog'
|
26
|
+
require 'flog_task'
|
27
|
+
FlogTask.new
|
28
|
+
rescue LoadError
|
29
|
+
task :flog do
|
30
|
+
abort "Flog is not available. In order to run flog, you must: sudo gem install flog"
|
31
|
+
end
|
32
|
+
end
|
34
33
|
|
35
34
|
begin
|
36
35
|
require 'reek/rake/task'
|
@@ -57,14 +56,13 @@ rescue LoadError
|
|
57
56
|
end
|
58
57
|
end
|
59
58
|
|
60
|
-
task :default => :spec
|
61
|
-
|
62
59
|
require 'rake/rdoctask'
|
63
60
|
Rake::RDocTask.new do |rdoc|
|
64
|
-
version =
|
61
|
+
version = YAMLiner::VERSION
|
65
62
|
|
66
63
|
rdoc.rdoc_dir = 'rdoc'
|
67
64
|
rdoc.title = "YAMLiner #{version}"
|
68
|
-
rdoc.rdoc_files.include('README
|
65
|
+
rdoc.rdoc_files.include('README.rdoc')
|
66
|
+
rdoc.main = 'README.rdoc'
|
69
67
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
70
68
|
end
|
data/YAMLiner.gemspec
CHANGED
@@ -1,55 +1,25 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "YAMLiner/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
9
|
-
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
6
|
+
s.name = "YAMLiner"
|
7
|
+
s.version = YAMLiner::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Selman ULUG"]
|
10
|
+
s.email = ["selman.ulug@gmail.com"]
|
11
|
+
s.homepage = "http://github.com/selman/YAMLiner"
|
12
|
+
s.summary = %q{inline YAML CRUD operations}
|
13
13
|
s.description = %q{Simple gem that supplies inline YAML CRUD operations that usable by all kind of text files.}
|
14
|
-
s.email = %q{selman.ulug@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"YAMLiner.gemspec",
|
27
|
-
"lib/yamliner.rb",
|
28
|
-
"spec/spec.opts",
|
29
|
-
"spec/spec_helper.rb",
|
30
|
-
"spec/yamliner_spec.rb"
|
31
|
-
]
|
32
|
-
s.homepage = %q{http://github.com/selman/YAMLiner}
|
33
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
34
|
-
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.3.7}
|
36
|
-
s.summary = %q{inline YAML CRUD operations}
|
37
|
-
s.test_files = [
|
38
|
-
"spec/spec_helper.rb",
|
39
|
-
"spec/yamliner_spec.rb"
|
40
|
-
]
|
41
14
|
|
42
|
-
|
43
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
|
-
s.specification_version = 3
|
15
|
+
s.add_development_dependency('rspec', '~> 2.0.1')
|
45
16
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
else
|
52
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
53
|
-
end
|
54
|
-
end
|
17
|
+
s.has_rdoc = true
|
18
|
+
s.extra_rdoc_files = ['README.rdoc']
|
19
|
+
s.rdoc_options << '--title' << "YAMLiner #{YAMLiner::VERSION}" <<
|
20
|
+
'--main' << 'README.rdoc'
|
55
21
|
|
22
|
+
s.files = `git ls-files`.split("\n")
|
23
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
24
|
+
s.require_paths = ["lib"]
|
25
|
+
end
|
data/lib/yamliner.rb
CHANGED
@@ -11,7 +11,7 @@ require 'fileutils'
|
|
11
11
|
module YAMLiner
|
12
12
|
extend self
|
13
13
|
|
14
|
-
#extends given
|
14
|
+
#extends given Object instance with YAMLinerActions
|
15
15
|
# a = {:name => 'selman', :surname => 'ulug'}
|
16
16
|
# YAMLiner::line a
|
17
17
|
def line(*objects)
|
@@ -47,7 +47,7 @@ module YAMLiner
|
|
47
47
|
|
48
48
|
#removing our yamline_settings instance variable
|
49
49
|
def to_yaml_properties
|
50
|
-
to_yaml_properties_orginal - [:@yamline_settings]
|
50
|
+
to_yaml_properties_orginal - [:@yamline_settings, '@yamline_settings']
|
51
51
|
end
|
52
52
|
|
53
53
|
#Returns generated YAMLiner line
|
@@ -59,7 +59,7 @@ module YAMLiner
|
|
59
59
|
|
60
60
|
#YAMLiner settings default values
|
61
61
|
# :name => 'YAMLiner'
|
62
|
-
# :
|
62
|
+
# :file => ''
|
63
63
|
# :line => 0
|
64
64
|
# :prefix => '#'
|
65
65
|
# :postfix => ''
|
@@ -73,9 +73,9 @@ module YAMLiner
|
|
73
73
|
def yamline_read(lines = nil, loaded = true)
|
74
74
|
lines = file_lines unless lines
|
75
75
|
return unless lines
|
76
|
-
matcher = %r{
|
76
|
+
matcher = %r{^#{Regexp.escape(@yamline_settings[:prefix] + @yamline_settings[:name])}(.*?)#{Regexp.escape(@yamline_settings[:postfix])}$}
|
77
77
|
line_l = []
|
78
|
-
line_s = lines.select {|line|
|
78
|
+
line_s = lines.select {|line| line_l << YAML::load($1) if line =~ matcher }
|
79
79
|
return if line_s.empty?
|
80
80
|
loaded ? line_l : line_s
|
81
81
|
end
|
@@ -106,10 +106,11 @@ module YAMLiner
|
|
106
106
|
private
|
107
107
|
|
108
108
|
def file_lines
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
109
|
+
begin
|
110
|
+
File.readlines(@yamline_settings[:file])
|
111
|
+
rescue Exception
|
112
|
+
return
|
113
|
+
end
|
113
114
|
end
|
114
115
|
|
115
116
|
def save_file(temp)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
3
|
require 'yamliner'
|
4
|
-
require '
|
5
|
-
require 'spec/autorun'
|
4
|
+
require 'rspec'
|
6
5
|
|
7
|
-
|
6
|
+
RSpec.configure do |c|
|
8
7
|
|
9
8
|
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: YAMLiner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 17
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
8
|
+
- 2
|
9
|
+
version: 0.3.2
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Selman ULUG
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-10-19 00:00:00 +03:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
@@ -24,35 +23,36 @@ dependencies:
|
|
24
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
25
|
requirements:
|
27
|
-
- -
|
26
|
+
- - ~>
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 13
|
30
28
|
segments:
|
31
|
-
- 1
|
32
29
|
- 2
|
33
|
-
-
|
34
|
-
|
30
|
+
- 0
|
31
|
+
- 1
|
32
|
+
version: 2.0.1
|
35
33
|
type: :development
|
36
34
|
version_requirements: *id001
|
37
35
|
description: Simple gem that supplies inline YAML CRUD operations that usable by all kind of text files.
|
38
|
-
email:
|
36
|
+
email:
|
37
|
+
- selman.ulug@gmail.com
|
39
38
|
executables: []
|
40
39
|
|
41
40
|
extensions: []
|
42
41
|
|
43
42
|
extra_rdoc_files:
|
44
|
-
- LICENSE
|
45
43
|
- README.rdoc
|
46
44
|
files:
|
47
45
|
- .document
|
48
46
|
- .gitignore
|
47
|
+
- .rspec
|
48
|
+
- Gemfile
|
49
|
+
- Gemfile.lock
|
49
50
|
- LICENSE
|
50
51
|
- README.rdoc
|
51
52
|
- Rakefile
|
52
|
-
- VERSION
|
53
53
|
- YAMLiner.gemspec
|
54
|
+
- lib/YAMLiner/version.rb
|
54
55
|
- lib/yamliner.rb
|
55
|
-
- spec/spec.opts
|
56
56
|
- spec/spec_helper.rb
|
57
57
|
- spec/yamliner_spec.rb
|
58
58
|
has_rdoc: true
|
@@ -61,7 +61,10 @@ licenses: []
|
|
61
61
|
|
62
62
|
post_install_message:
|
63
63
|
rdoc_options:
|
64
|
-
- --
|
64
|
+
- --title
|
65
|
+
- YAMLiner 0.3.2
|
66
|
+
- --main
|
67
|
+
- README.rdoc
|
65
68
|
require_paths:
|
66
69
|
- lib
|
67
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -69,7 +72,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
72
|
requirements:
|
70
73
|
- - ">="
|
71
74
|
- !ruby/object:Gem::Version
|
72
|
-
hash: 3
|
73
75
|
segments:
|
74
76
|
- 0
|
75
77
|
version: "0"
|
@@ -78,7 +80,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
80
|
requirements:
|
79
81
|
- - ">="
|
80
82
|
- !ruby/object:Gem::Version
|
81
|
-
hash: 3
|
82
83
|
segments:
|
83
84
|
- 0
|
84
85
|
version: "0"
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.3.1
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color -fn
|