outline 0.2.1 → 0.2.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/Gemfile.lock +11 -3
- data/lib/outline.rb +6 -2
- data/lib/outline/version.rb +3 -0
- data/outline.gemspec +8 -3
- data/spec/outline_spec.rb +11 -6
- metadata +18 -7
- data/Rakefile +0 -120
data/Gemfile.lock
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
outline (0.2.
|
5
|
-
meta_tools (~> 0.2.
|
4
|
+
outline (0.2.2)
|
5
|
+
meta_tools (~> 0.2.7)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
10
|
diff-lcs (1.1.3)
|
11
|
-
|
11
|
+
ffi (1.0.11)
|
12
|
+
guard (1.0.1)
|
13
|
+
ffi (>= 0.5.0)
|
14
|
+
thor (~> 0.14.6)
|
15
|
+
guard-rspec (0.7.0)
|
16
|
+
guard (>= 0.10.0)
|
17
|
+
meta_tools (0.2.7)
|
12
18
|
rspec (2.6.0)
|
13
19
|
rspec-core (~> 2.6.0)
|
14
20
|
rspec-expectations (~> 2.6.0)
|
@@ -17,10 +23,12 @@ GEM
|
|
17
23
|
rspec-expectations (2.6.0)
|
18
24
|
diff-lcs (~> 1.1.2)
|
19
25
|
rspec-mocks (2.6.0)
|
26
|
+
thor (0.14.6)
|
20
27
|
|
21
28
|
PLATFORMS
|
22
29
|
ruby
|
23
30
|
|
24
31
|
DEPENDENCIES
|
32
|
+
guard-rspec (~> 0.7.0)
|
25
33
|
outline!
|
26
34
|
rspec (~> 2.6.0)
|
data/lib/outline.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
require 'meta_tools'
|
3
|
+
require 'outline/version'
|
3
4
|
|
4
5
|
class Hash
|
5
6
|
def to_outline
|
@@ -21,11 +22,10 @@ class Hash
|
|
21
22
|
end
|
22
23
|
|
23
24
|
class Outline
|
24
|
-
VERSION = '0.2.0'
|
25
|
-
|
26
25
|
# It's as if we are subclassing BasicObject, but without the loss of context (and object_id):
|
27
26
|
(Object.instance_methods - BasicObject.instance_methods).each { |meth| remove_method(meth) unless [:object_id].include?(meth) rescue nil }
|
28
27
|
include MetaTools
|
28
|
+
include Enumerable
|
29
29
|
|
30
30
|
attr_reader :parent, :data
|
31
31
|
|
@@ -83,6 +83,10 @@ class Outline
|
|
83
83
|
__send__(meth, *args, &blk)
|
84
84
|
end
|
85
85
|
|
86
|
+
def each
|
87
|
+
to_h.each { |k, v| yield(k, v) }
|
88
|
+
end
|
89
|
+
|
86
90
|
def to_h
|
87
91
|
@data ||= {}
|
88
92
|
@data.each_with_object({}) do |(key, value), memo|
|
data/outline.gemspec
CHANGED
@@ -1,12 +1,16 @@
|
|
1
|
+
$:.unshift( File.expand_path("../lib", __FILE__) )
|
2
|
+
PROJECT_NAME ||= File.basename(__FILE__, ".gemspec")
|
3
|
+
require "#{PROJECT_NAME}/version"
|
4
|
+
|
1
5
|
Gem::Specification.new do |s|
|
2
6
|
s.author = "Ryan Scott Lewis"
|
3
7
|
s.email = "c00lryguy@gmail.com"
|
4
8
|
|
5
|
-
s.name =
|
9
|
+
s.name = PROJECT_NAME
|
6
10
|
s.description = "Easily set configurations on your Ruby apps."
|
7
11
|
s.summary = "Simplify your configurations."
|
8
|
-
s.homepage = "http://github.com/c00lryguy/#{
|
9
|
-
s.version =
|
12
|
+
s.homepage = "http://github.com/c00lryguy/#{PROJECT_NAME}"
|
13
|
+
s.version = Outline::VERSION
|
10
14
|
s.license = 'MIT'
|
11
15
|
s.platform = Gem::Platform::RUBY
|
12
16
|
s.require_path = 'lib'
|
@@ -16,4 +20,5 @@ Gem::Specification.new do |s|
|
|
16
20
|
|
17
21
|
s.add_dependency("meta_tools", "~> 0.2.7")
|
18
22
|
s.add_development_dependency("rspec", "~> 2.6.0")
|
23
|
+
s.add_development_dependency("guard-rspec", "~> 0.7.0")
|
19
24
|
end
|
data/spec/outline_spec.rb
CHANGED
@@ -29,12 +29,6 @@ describe Outline do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
describe 'VERSION' do
|
33
|
-
it "should be correct" do
|
34
|
-
Outline::VERSION.should == '0.2.0'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
32
|
describe "getters" do
|
39
33
|
it "should work" do
|
40
34
|
config.testing.should == "testing"
|
@@ -85,6 +79,17 @@ describe Outline do
|
|
85
79
|
end
|
86
80
|
end
|
87
81
|
|
82
|
+
describe "#each" do
|
83
|
+
it "should work as expected" do
|
84
|
+
result = {}
|
85
|
+
config.each do |k, v|
|
86
|
+
result[k] = v
|
87
|
+
end
|
88
|
+
|
89
|
+
result.should == config.to_h
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
88
93
|
describe "#to_h" do
|
89
94
|
it "should return the correct Hash output" do
|
90
95
|
config.to_h[:testing].should == "testing"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: outline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-08 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: meta_tools
|
16
|
-
requirement: &
|
16
|
+
requirement: &70333400868700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.2.7
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70333400868700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70333400867820 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,18 +32,29 @@ dependencies:
|
|
32
32
|
version: 2.6.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70333400867820
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: guard-rspec
|
38
|
+
requirement: &70333400867360 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.7.0
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70333400867360
|
36
47
|
description: Easily set configurations on your Ruby apps.
|
37
48
|
email: c00lryguy@gmail.com
|
38
49
|
executables: []
|
39
50
|
extensions: []
|
40
51
|
extra_rdoc_files: []
|
41
52
|
files:
|
42
|
-
- Rakefile
|
43
53
|
- Gemfile.lock
|
44
54
|
- Gemfile
|
45
55
|
- VERSION
|
46
56
|
- outline.gemspec
|
57
|
+
- lib/outline/version.rb
|
47
58
|
- lib/outline.rb
|
48
59
|
- spec/outline_spec.rb
|
49
60
|
homepage: http://github.com/c00lryguy/outline
|
data/Rakefile
DELETED
@@ -1,120 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
__LIB__ = Pathname.new(__FILE__).expand_path.dirname.join('lib').to_s
|
3
|
-
$:.unshift(__LIB__) unless $:.include?(__LIB__)
|
4
|
-
require 'outline'
|
5
|
-
|
6
|
-
def notify(message)
|
7
|
-
start_time = Time.now
|
8
|
-
puts "-- #{message}"
|
9
|
-
yield
|
10
|
-
puts " -> #{'%0.04f' % (Time.now - start_time)}s"
|
11
|
-
end
|
12
|
-
|
13
|
-
VERSION_REGEXP = /VERSION = '((\d+)\.(\d+)\.(\d+))'/
|
14
|
-
|
15
|
-
namespace :version do
|
16
|
-
desc 'Display the current version'
|
17
|
-
task :current do
|
18
|
-
puts File.read('VERSION')
|
19
|
-
end
|
20
|
-
|
21
|
-
desc 'Update the version file to the latest version'
|
22
|
-
task :update_file do
|
23
|
-
notify "updating VERSION file to #{Outline::VERSION}" do
|
24
|
-
File.open('VERSION', 'w+') { |f| f.print Outline::VERSION }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
namespace :bump do
|
29
|
-
desc 'Bump the major version'
|
30
|
-
task :major do
|
31
|
-
data = File.read('lib/outline.rb')
|
32
|
-
|
33
|
-
versions = { old: {}, new: {} }
|
34
|
-
versions[:old][:major], versions[:old][:minor], versions[:old][:patch] = data.match(VERSION_REGEXP).captures[1..-1].collect { |i| i.to_i }
|
35
|
-
versions[:new] = versions[:old].dup
|
36
|
-
versions[:new][:major] += 1
|
37
|
-
versions[:new][:minor] = 0
|
38
|
-
versions[:new][:patch] = 0
|
39
|
-
versions[:old][:string] = [ versions[:old][:major], versions[:old][:minor], versions[:old][:patch] ].join('.')
|
40
|
-
versions[:new][:string] = [ versions[:new][:major], versions[:new][:minor], versions[:new][:patch] ].join('.')
|
41
|
-
|
42
|
-
notify "updating version from #{versions[:old][:string]} to #{versions[:new][:string]}" do
|
43
|
-
File.open('lib/outline.rb', 'w+') { |f| f.print data.gsub(VERSION_REGEXP, "VERSION = '#{versions[:new][:string]}'") }
|
44
|
-
Outline::VERSION.replace(versions[:new][:string])
|
45
|
-
end
|
46
|
-
|
47
|
-
Rake::Task["version:update_file"].execute
|
48
|
-
end
|
49
|
-
|
50
|
-
desc 'Bump the minor version'
|
51
|
-
task :minor do
|
52
|
-
data = File.read('lib/outline.rb')
|
53
|
-
|
54
|
-
versions = { old: {}, new: {} }
|
55
|
-
versions[:old][:major], versions[:old][:minor], versions[:old][:patch] = data.match(VERSION_REGEXP).captures[1..-1].collect { |i| i.to_i }
|
56
|
-
versions[:new] = versions[:old].dup
|
57
|
-
versions[:new][:minor] += 1
|
58
|
-
versions[:new][:patch] = 0
|
59
|
-
versions[:old][:string] = [ versions[:old][:major], versions[:old][:minor], versions[:old][:patch] ].join('.')
|
60
|
-
versions[:new][:string] = [ versions[:new][:major], versions[:new][:minor], versions[:new][:patch] ].join('.')
|
61
|
-
|
62
|
-
notify "updating version from #{versions[:old][:string]} to #{versions[:new][:string]}" do
|
63
|
-
File.open('lib/outline.rb', 'w+') { |f| f.print data.gsub(VERSION_REGEXP, "VERSION = '#{versions[:new][:string]}'") }
|
64
|
-
Outline::VERSION.replace(versions[:new][:string])
|
65
|
-
end
|
66
|
-
|
67
|
-
Rake::Task["version:update_file"].execute
|
68
|
-
end
|
69
|
-
|
70
|
-
desc 'Bump the patch version'
|
71
|
-
task :patch do
|
72
|
-
data = File.read('lib/outline.rb')
|
73
|
-
|
74
|
-
versions = { old: {}, new: {} }
|
75
|
-
versions[:old][:major], versions[:old][:minor], versions[:old][:patch] = data.match(VERSION_REGEXP).captures[1..-1].collect { |i| i.to_i }
|
76
|
-
versions[:new] = versions[:old].dup
|
77
|
-
versions[:new][:patch] += 1
|
78
|
-
versions[:old][:string] = [ versions[:old][:major], versions[:old][:minor], versions[:old][:patch] ].join('.')
|
79
|
-
versions[:new][:string] = [ versions[:new][:major], versions[:new][:minor], versions[:new][:patch] ].join('.')
|
80
|
-
|
81
|
-
notify "updating version from #{versions[:old][:string]} to #{versions[:new][:string]}" do
|
82
|
-
File.open('lib/outline.rb', 'w+') { |f| f.print data.gsub(VERSION_REGEXP, "VERSION = '#{versions[:new][:string]}'") }
|
83
|
-
Outline::VERSION.replace(versions[:new][:string])
|
84
|
-
end
|
85
|
-
|
86
|
-
Rake::Task["version:update_file"].execute
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
namespace :gem do
|
92
|
-
desc 'Build the gem'
|
93
|
-
task :build do
|
94
|
-
notify 'building the gem' do
|
95
|
-
`gem build *.gemspec`
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
desc 'Push the gem to RubyGems'
|
100
|
-
task :push do
|
101
|
-
notify 'pushing gem' do
|
102
|
-
`gem push *.gem`
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
desc 'Move the gem to the pkg directory'
|
107
|
-
task :move do
|
108
|
-
notify 'moving the gem to pkg/' do
|
109
|
-
`mv *.gem pkg/`
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
desc 'Update VERSION, build the gem, push the gem, then move the gem to the pkg directory'
|
114
|
-
task deploy: [:build, :push, :move]
|
115
|
-
end
|
116
|
-
|
117
|
-
desc "Run all specs"
|
118
|
-
task :spec do
|
119
|
-
sh 'bundle exec rspec spec'
|
120
|
-
end
|