everything-core 0.0.8 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Everything
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.13'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: everything-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Tolle
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-17 00:00:00.000000000 Z
11
+ date: 2020-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -30,62 +30,88 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.2
33
+ version: 0.0.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.2
40
+ version: 0.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.11'
47
+ version: '2.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.11'
54
+ version: '2.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 13.0.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 13.0.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '10.5'
75
+ version: '3.9'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '10.5'
82
+ version: '3.9'
69
83
  - !ruby/object:Gem::Dependency
70
- name: rspec
84
+ name: timecop
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '3.4'
89
+ version: '0.9'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '3.4'
96
+ version: '0.9'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fakefs
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.2.2
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.2.2
83
111
  description: Gives you access to pieces within your everything repo.
84
112
  email:
85
113
  - kyle@nullsix.com
86
- executables:
87
- - console
88
- - setup
114
+ executables: []
89
115
  extensions: []
90
116
  extra_rdoc_files: []
91
117
  files:
@@ -102,20 +128,22 @@ files:
102
128
  - bin/setup
103
129
  - everything-core.gemspec
104
130
  - lib/everything.rb
131
+ - lib/everything/logger.rb
132
+ - lib/everything/logger/base.rb
133
+ - lib/everything/logger/debug.rb
134
+ - lib/everything/logger/error.rb
135
+ - lib/everything/logger/log_it.rb
136
+ - lib/everything/logger/verbose.rb
105
137
  - lib/everything/piece.rb
106
138
  - lib/everything/piece/content.rb
107
139
  - lib/everything/piece/metadata.rb
108
140
  - lib/everything/version.rb
109
- - spec/everything/piece/content_spec.rb
110
- - spec/everything/piece/metadata_spec.rb
111
- - spec/everything/piece_spec.rb
112
- - spec/everything_spec.rb
113
- - spec/spec_helper.rb
114
- - spec/support/pieces.rb
115
141
  homepage: https://github.com/kyletolle/everything-core
116
142
  licenses:
117
143
  - MIT
118
- metadata: {}
144
+ metadata:
145
+ homepage_uri: https://github.com/kyletolle/everything-core
146
+ source_code_uri: https://github.com/kyletolle/everything-core
119
147
  post_install_message:
120
148
  rdoc_options: []
121
149
  require_paths:
@@ -124,22 +152,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
152
  requirements:
125
153
  - - ">="
126
154
  - !ruby/object:Gem::Version
127
- version: '0'
155
+ version: 2.7.1
128
156
  required_rubygems_version: !ruby/object:Gem::Requirement
129
157
  requirements:
130
158
  - - ">="
131
159
  - !ruby/object:Gem::Version
132
160
  version: '0'
133
161
  requirements: []
134
- rubyforge_project:
135
- rubygems_version: 2.5.1
162
+ rubygems_version: 3.1.2
136
163
  signing_key:
137
164
  specification_version: 4
138
165
  summary: Library for working with your `everything` repository.
139
- test_files:
140
- - spec/everything/piece/content_spec.rb
141
- - spec/everything/piece/metadata_spec.rb
142
- - spec/everything/piece_spec.rb
143
- - spec/everything_spec.rb
144
- - spec/spec_helper.rb
145
- - spec/support/pieces.rb
166
+ test_files: []
@@ -1,190 +0,0 @@
1
- require './spec/support/pieces'
2
-
3
- describe Everything::Piece::Content do
4
- shared_context 'with tmp piece markdown file on disk' do
5
- let(:tmp_piece_markdown_path) do
6
- File.join(tmp_piece_path, 'index.md')
7
- end
8
-
9
- let(:given_markdown) do
10
- <<MD
11
- # Piece Title Here
12
-
13
- The body is totally this right here.
14
-
15
- And it might even include multiple lines!
16
- MD
17
- end
18
-
19
- before do
20
- File.open(tmp_piece_markdown_path, 'w') do |markdown_file|
21
- markdown_file.puts given_markdown
22
- end
23
- end
24
- end
25
-
26
- let(:content) do
27
- described_class.new(tmp_piece_path)
28
- end
29
-
30
- describe '#file_path' do
31
- include_context 'with tmp piece on disk'
32
-
33
- let(:expected_file_path) do
34
- "#{tmp_piece_path}/index.md"
35
- end
36
-
37
- it 'is the index.md under the piece' do
38
- expect(content.file_path).to eq(expected_file_path)
39
- end
40
- end
41
-
42
- describe '#title' do
43
- include_context 'with tmp piece on disk'
44
- include_context 'with tmp piece markdown file on disk'
45
-
46
- let(:expected_title) do
47
- 'Piece Title Here'
48
- end
49
-
50
- it 'is the title from the markdown' do
51
- expect(content.title).to eq(expected_title)
52
- end
53
- end
54
-
55
- describe '#body' do
56
- include_context 'with tmp piece on disk'
57
- include_context 'with tmp piece markdown file on disk'
58
-
59
- let(:expected_body) do
60
- <<MD
61
- The body is totally this right here.
62
-
63
- And it might even include multiple lines!
64
- MD
65
- end
66
-
67
- it 'is the body text from the markdown' do
68
- expect(content.body).to eq(expected_body)
69
- end
70
- end
71
-
72
- describe '#raw_markdown' do
73
- include_context 'with tmp piece on disk'
74
- include_context 'with tmp piece markdown file on disk'
75
-
76
- let(:expected_raw_markdown) do
77
- given_markdown
78
- end
79
-
80
- it 'is the markdown from the file' do
81
- expect(content.raw_markdown).to eq(expected_raw_markdown)
82
- end
83
-
84
- it 'memoizes the file read' do
85
- allow(File)
86
- .to receive(:read)
87
- .and_call_original
88
-
89
- 2.times { content.raw_markdown }
90
-
91
- expect(File)
92
- .to have_received(:read)
93
- .exactly(:once)
94
- end
95
- end
96
-
97
- describe '#raw_markdown=' do
98
- include_context 'with tmp piece on disk'
99
-
100
- let(:new_raw_markdown) do
101
- <<MD
102
- # New Markdown
103
-
104
- This is a completely new bit of markdown.
105
- MD
106
- end
107
-
108
- it 'sets the raw_markdown value' do
109
- content.raw_markdown = new_raw_markdown
110
-
111
- expect(content.raw_markdown).to eq(new_raw_markdown)
112
- end
113
- end
114
-
115
- describe '#save' do
116
- let(:tmp_dir) do
117
- Dir.tmpdir
118
- end
119
-
120
- let(:tmp_piece_path) do
121
- File.join(tmp_dir, 'a-test-piece')
122
- end
123
-
124
- before do
125
- content.raw_markdown = "# Ship Shape"
126
- end
127
-
128
- after do
129
- FileUtils.remove_entry(tmp_piece_path)
130
- end
131
-
132
- context 'when the piece directory does not exist' do
133
- it 'creates the folder' do
134
- expect(Dir.exist?(tmp_piece_path)).to eq(false)
135
-
136
- content.save
137
-
138
- expect(Dir.exist?(tmp_piece_path)).to eq(true)
139
- end
140
-
141
- it 'creates the content markdown file' do
142
- expect(File.exist?(content.file_path)).to eq(false)
143
-
144
- content.save
145
-
146
- expect(File.exist?(content.file_path)).to eq(true)
147
- end
148
-
149
- it 'writes the markdown to the file' do
150
- content.save
151
-
152
- expect(File.read(content.file_path)).to eq('# Ship Shape')
153
- end
154
- end
155
-
156
- context 'when the piece directory exists' do
157
- before do
158
- FileUtils.mkdir_p(tmp_piece_path)
159
- end
160
-
161
- context 'when the content file does not exist' do
162
- it 'creates the content markdown file' do
163
- expect(File.exist?(content.file_path)).to eq(false)
164
-
165
- content.save
166
-
167
- expect(File.exist?(content.file_path)).to eq(true)
168
- end
169
-
170
- it 'writes the markdown to the file' do
171
- content.save
172
-
173
- expect(File.read(content.file_path)).to eq('# Ship Shape')
174
- end
175
- end
176
-
177
- context 'when the content file already exists' do
178
- before do
179
- File.write(content.file_path, '# Rolly Polly')
180
- end
181
-
182
- it 'overwrites the file with the correct markdown' do
183
- content.save
184
-
185
- expect(File.read(content.file_path)).to eq('# Ship Shape')
186
- end
187
- end
188
- end
189
- end
190
- end
@@ -1,198 +0,0 @@
1
- require './spec/support/pieces'
2
-
3
- describe Everything::Piece::Metadata do
4
- shared_context 'with tmp piece metadata file on disk' do
5
- let(:tmp_piece_metadata_path) do
6
- File.join(tmp_piece_path, 'index.yaml')
7
- end
8
-
9
- let(:given_yaml) do
10
- <<YAML
11
- ---
12
- public: false
13
- YAML
14
- end
15
-
16
- before do
17
- File.open(tmp_piece_metadata_path, 'w') do |metadata_file|
18
- metadata_file.puts given_yaml
19
- end
20
- end
21
- end
22
-
23
- let(:metadata) do
24
- described_class.new(tmp_piece_path)
25
- end
26
-
27
- describe '#[]' do
28
- include_context 'with tmp piece on disk'
29
-
30
- let(:yaml_double) do
31
- instance_double(Hash)
32
- end
33
- let(:given_key) { 'public' }
34
-
35
- before do
36
- expect(YAML)
37
- .to receive(:load_file)
38
- .and_return(yaml_double)
39
- end
40
-
41
- it 'delegates to the yaml' do
42
- allow(yaml_double)
43
- .to receive(:[])
44
-
45
- metadata[given_key]
46
-
47
- expect(yaml_double)
48
- .to have_received(:[])
49
- .with(given_key)
50
- end
51
- end
52
-
53
- describe '#file_path' do
54
- include_context 'with tmp piece on disk'
55
-
56
- let(:expected_file_path) do
57
- "#{tmp_piece_path}/index.yaml"
58
- end
59
-
60
- it 'is the index.yaml under the piece' do
61
- expect(metadata.file_path).to eq(expected_file_path)
62
- end
63
- end
64
-
65
- describe '#raw_yaml' do
66
- include_context 'with tmp piece on disk'
67
- include_context 'with tmp piece metadata file on disk'
68
-
69
- let(:expected_raw_yaml) do
70
- {
71
- 'public' => false
72
- }
73
- end
74
-
75
- it 'is the yaml as parsed from the file' do
76
- expect(metadata.raw_yaml).to eq(expected_raw_yaml)
77
- end
78
-
79
- it 'memoizes the yaml read' do
80
- allow(YAML)
81
- .to receive(:load_file)
82
- .and_call_original
83
-
84
- metadata.raw_yaml
85
- metadata.raw_yaml
86
-
87
- expect(YAML)
88
- .to have_received(:load_file)
89
- .exactly(:once)
90
- end
91
- end
92
-
93
- describe '#raw_yaml=' do
94
- include_context 'with tmp piece on disk'
95
-
96
- let(:new_raw_yaml) do
97
- <<YAML
98
- ---
99
- public: true
100
- other: okay
101
- YAML
102
- end
103
-
104
- it 'sets the raw_yaml value' do
105
- metadata.raw_yaml = new_raw_yaml
106
-
107
- expect(metadata.raw_yaml).to eq(new_raw_yaml)
108
- end
109
- end
110
-
111
- describe '#save' do
112
- let(:tmp_dir) do
113
- Dir.tmpdir
114
- end
115
-
116
- let(:tmp_piece_path) do
117
- File.join(tmp_dir, 'fake-piece-here')
118
- end
119
-
120
- before do
121
- metadata.raw_yaml = <<YAML
122
- ---
123
- favorite_color: blue
124
- YAML
125
- end
126
-
127
- after do
128
- FileUtils.remove_entry(tmp_piece_path)
129
- end
130
-
131
- context 'when the piece directory does not exist' do
132
- it 'creates the folder' do
133
- expect(Dir.exist?(tmp_piece_path)).to eq(false)
134
-
135
- metadata.save
136
-
137
- expect(Dir.exist?(tmp_piece_path)).to eq(true)
138
- end
139
-
140
- it 'creates the metadata yaml file' do
141
- expect(File.exist?(metadata.file_path)).to eq(false)
142
-
143
- metadata.save
144
-
145
- expect(File.exist?(metadata.file_path)).to eq(true)
146
- end
147
-
148
- it 'writes the yaml to the file' do
149
- metadata.save
150
-
151
- expect(File.read(metadata.file_path)).to eq(<<YAML)
152
- ---
153
- favorite_color: blue
154
- YAML
155
- end
156
- end
157
-
158
- context 'when the piece directory exists' do
159
- before do
160
- FileUtils.mkdir_p(tmp_piece_path)
161
- end
162
-
163
- context 'when the metadata file does not exist' do
164
- it 'creates the metadata yaml file' do
165
- expect(File.exist?(metadata.file_path)).to eq(false)
166
-
167
- metadata.save
168
-
169
- expect(File.exist?(metadata.file_path)).to eq(true)
170
- end
171
-
172
- it 'writes the yaml to the file' do
173
- metadata.save
174
-
175
- expect(File.read(metadata.file_path)).to eq(<<YAML)
176
- ---
177
- favorite_color: blue
178
- YAML
179
- end
180
- end
181
-
182
- context 'when the metadata file already exists' do
183
- before do
184
- File.write(metadata.file_path, "---\nwho: knows")
185
- end
186
-
187
- it 'overwrites the file with the correct yaml' do
188
- metadata.save
189
-
190
- expect(File.read(metadata.file_path)).to eq(<<YAML)
191
- ---
192
- favorite_color: blue
193
- YAML
194
- end
195
- end
196
- end
197
- end
198
- end