my_todo 2.7.0 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +6 -3
- data/lib/db/todos_test.sqlite3 +0 -0
- data/lib/my_todo.rb +7 -7
- data/lib/{ar_base.rb → my_todo/ar_base.rb} +7 -3
- data/lib/my_todo/configuration.rb +7 -0
- data/lib/my_todo/db/todos_test.sqlite3 +0 -0
- data/lib/{item.rb → my_todo/models/item.rb} +0 -0
- data/lib/{note.rb → my_todo/models/note.rb} +0 -0
- data/lib/{stub.rb → my_todo/models/stub.rb} +0 -0
- data/lib/{tag.rb → my_todo/models/tag.rb} +0 -0
- data/lib/my_todo/templates/output.erb +2 -2
- data/lib/my_todo/version.rb +1 -1
- data/spec/actions/note_spec.rb +1 -1
- data/spec/actions/search_spec.rb +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e34470c767f09895747115f0d3b3fe188711a7b
|
4
|
+
data.tar.gz: 88717583dab1f1967d68586652b825f844974090
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44541d49b304415df3d76122d684fbb0ecefb64beca23535aa17983de2f20eab057e2e4c8c71cebc6b7ce0c4d520a03e2a525b7919864ffb13579630dddff689
|
7
|
+
data.tar.gz: ce9a182b76a060e39fa323f35f3b47c38fc2dcb9c1a7a4f8d8c15f14ab58125de2b30c0b495cdcea176a7d58de6280d75f1b21232567dd112568691e461072df
|
data/Rakefile
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
|
2
|
+
|
3
3
|
require 'standalone_migrations'
|
4
4
|
|
5
5
|
StandaloneMigrations::Tasks.load_tasks
|
6
6
|
|
7
|
-
|
7
|
+
unless ENV['RAILS_ENV'] == 'production'
|
8
|
+
require "rspec/core/rake_task"
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
10
|
|
9
|
-
task :default => :spec
|
11
|
+
task :default => :spec
|
12
|
+
end
|
data/lib/db/todos_test.sqlite3
CHANGED
Binary file
|
data/lib/my_todo.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# @author Lovell McIlwain
|
2
2
|
# Handles running the todo application
|
3
|
-
require
|
3
|
+
require "#{__dir__}/my_todo/version"
|
4
4
|
require 'thor'
|
5
5
|
require 'erb'
|
6
6
|
require 'sqlite3'
|
@@ -8,11 +8,11 @@ require 'active_record'
|
|
8
8
|
require 'active_model'
|
9
9
|
require 'yaml'
|
10
10
|
require 'ransack'
|
11
|
-
require_relative 'ar_base'
|
12
|
-
require_relative 'item'
|
13
|
-
require_relative 'stub'
|
14
|
-
require_relative 'tag'
|
15
|
-
require_relative 'note'
|
11
|
+
require_relative 'my_todo/ar_base'
|
12
|
+
require_relative 'my_todo/models/item'
|
13
|
+
require_relative 'my_todo/models/stub'
|
14
|
+
require_relative 'my_todo/models/tag'
|
15
|
+
require_relative 'my_todo/models/note'
|
16
16
|
|
17
17
|
module MyTodo
|
18
18
|
# Todo tasks using thor gem
|
@@ -23,7 +23,7 @@ module MyTodo
|
|
23
23
|
# Private methods
|
24
24
|
no_commands do
|
25
25
|
def output(item)
|
26
|
-
say ERB.new(File.read(
|
26
|
+
say ERB.new(File.read("#{__dir__}/my_todo/templates/output.erb"), nil, '-').result(binding)
|
27
27
|
end
|
28
28
|
|
29
29
|
def item
|
@@ -3,11 +3,15 @@
|
|
3
3
|
# Handles database connection
|
4
4
|
module ArBase
|
5
5
|
# Set path based on bin/my_todo
|
6
|
-
path =
|
7
|
-
|
6
|
+
path = case ENV['RAILS_ENV']
|
7
|
+
when 'development'
|
8
|
+
"#{__dir__}/../db/todos_development.sqlite3"
|
9
|
+
when 'test'
|
10
|
+
"#{__dir__}/../db/todos_test.sqlite3"
|
8
11
|
else
|
9
|
-
File.expand_path("#{`echo $HOME`.chomp}/.my_todo/data/
|
12
|
+
File.expand_path("#{`echo $HOME`.chomp}/.my_todo/data/todos_production.sqlite3", __FILE__)
|
10
13
|
end
|
14
|
+
|
11
15
|
# Connect to an sqlite3 database located in lib/db
|
12
16
|
ActiveRecord::Base.establish_connection(
|
13
17
|
adapter: 'sqlite3',
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,9 +1,9 @@
|
|
1
1
|
|
2
2
|
ID: <%= item.id %> | Tags: <%= item.tags.map(&:name).join(', ') %> | Complete: <%= item.done %>
|
3
3
|
<%= item.body %>
|
4
|
-
<% if item.notes.any?
|
4
|
+
<% if item.notes.any? -%>
|
5
5
|
Notes:
|
6
|
-
<% item.notes.each do |note|
|
6
|
+
<% item.notes.each do |note| -%>
|
7
7
|
<%= note.id %>: <%= note.body %>
|
8
8
|
<% end %>
|
9
9
|
<% end %>
|
data/lib/my_todo/version.rb
CHANGED
data/spec/actions/note_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe MyTodo do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'displays item with notes' do
|
17
|
-
expect{MyTodo::Todo.start(%W[note --id=#{@todo.id} --body=note_text])}.to output("\nID: 1 | Tags: | Complete: \nSome Body\
|
17
|
+
expect{MyTodo::Todo.start(%W[note --id=#{@todo.id} --body=note_text])}.to output( "\nID: 1 | Tags: | Complete: \nSome Body\nNotes:\n1: note_text\n\n\n").to_stdout
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
data/spec/actions/search_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe MyTodo do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'finds todo items by associated notes content' do
|
24
|
-
expect{MyTodo::Todo.start( %w[search note1])}.to output("ToDos FOUND: 1\n\nID: 3 | Tags: | Complete: \nalways\
|
24
|
+
expect{MyTodo::Todo.start( %w[search note1])}.to output("ToDos FOUND: 1\n\nID: 3 | Tags: | Complete: \nalways\nNotes:\n1: note1\n\n\n").to_stdout
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_todo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -238,7 +238,6 @@ files:
|
|
238
238
|
- bin/console
|
239
239
|
- bin/my_todo
|
240
240
|
- bin/setup
|
241
|
-
- lib/ar_base.rb
|
242
241
|
- lib/db/config.yml
|
243
242
|
- lib/db/migrate/20160912172429_create_items.rb
|
244
243
|
- lib/db/migrate/20160913134552_create_tags.rb
|
@@ -247,16 +246,19 @@ files:
|
|
247
246
|
- lib/db/schema.rb
|
248
247
|
- lib/db/todos_development.sqlite3
|
249
248
|
- lib/db/todos_test.sqlite3
|
250
|
-
- lib/item.rb
|
251
249
|
- lib/my_todo.rb
|
250
|
+
- lib/my_todo/ar_base.rb
|
251
|
+
- lib/my_todo/configuration.rb
|
252
|
+
- lib/my_todo/db/todos_test.sqlite3
|
253
|
+
- lib/my_todo/models/item.rb
|
254
|
+
- lib/my_todo/models/note.rb
|
255
|
+
- lib/my_todo/models/stub.rb
|
256
|
+
- lib/my_todo/models/tag.rb
|
252
257
|
- lib/my_todo/templates/config.yml.erb
|
253
258
|
- lib/my_todo/templates/output.erb
|
254
259
|
- lib/my_todo/templates/standalone_migrations.yml.erb
|
255
260
|
- lib/my_todo/version.rb
|
256
|
-
- lib/note.rb
|
257
261
|
- lib/setup.rb
|
258
|
-
- lib/stub.rb
|
259
|
-
- lib/tag.rb
|
260
262
|
- my_todo.gemspec
|
261
263
|
- spec/actions/create_spec.rb
|
262
264
|
- spec/actions/delete_spec.rb
|