noir 0.1.9 → 0.1.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ae997bded8276dc827ce2a3b883f601751e21be
4
- data.tar.gz: 22bb06c286daa30bd8dfab5ee7d81a1dde001709
3
+ metadata.gz: eda95a17a860b6e532f4d44ef41fa0013c3e0ce1
4
+ data.tar.gz: 46bfe2da4011ec694911a0b86b0e3d61fa682fbf
5
5
  SHA512:
6
- metadata.gz: f66a2d26f4e4dc5c2d350a9e2f5bf3e90d6e0b99ff8c2128c76107c076f29271535c4d0f7cfde910097ff419218bdab80b69071062cadd38f79ced254c6ab799
7
- data.tar.gz: 837fde2fb8ea3b52803c7b96195fe2c17caf3507b95eefa236b3716cbb30cf5bcbd8ad7e6aa695a041dfe1d81348a6fa7f587d49987e9b30c4ddf553bc71fd54
6
+ metadata.gz: 1c040d77da7e767a9f06cb7c3e6d1f886086f0b9eb83c6b952b63af18cae63fd3b4d85770e8f2e68efbf937e2abb5ade4c930f53ed7c696dd0debabb8b6d2903
7
+ data.tar.gz: a00534c0d17251f58199b5b3b8e8a48f815cfd56d07b83d19cb16edb8e237d226c9da17bae3394116344e5e3f6f362d551160deabe940e3e8bd2c33eb2e7b197
@@ -1 +1 @@
1
- 2.2.4
1
+ 2.4.1
@@ -1,6 +1,16 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.4.1
4
+ - 2.4.0
5
+ - 2.3.4-clang
6
+ - 2.3.4
7
+ - 2.3.3
8
+ - 2.3.2
9
+ - 2.2.7
10
+ - 2.2.6
11
+ - 2.2.5
3
12
  - 2.2.4
13
+ - 2.2.4-clang
4
14
  - 2.2.3
5
15
  - 2.2.2
6
16
  - 2.2.1
@@ -14,8 +24,6 @@ rvm:
14
24
  - 2.1.2
15
25
  - 2.1.1
16
26
  - 2.0.0
17
- - 1.9.3
18
- - 1.9.2
19
27
  before_install:
20
28
  - gem update bundler
21
29
  notifications:
@@ -17,7 +17,7 @@ module Noir::Base
17
17
  end
18
18
 
19
19
  # check invalid command
20
- check_command_not_found *args
20
+ check_command_not_found(*args)
21
21
 
22
22
  # default execute is show description with sub commands.
23
23
  description
@@ -3,7 +3,7 @@ class Noir::Command < Noir::Base::Command
3
3
  def execute *args
4
4
  # if arguments missing. call help.
5
5
  Noir::Command::Help.execute if args.size.zero?
6
- check_command_not_found *args
6
+ check_command_not_found(*args)
7
7
  end
8
8
  end
9
9
  end
@@ -46,6 +46,8 @@ class Noir::Command::Calculate::Time < Noir::Base::TerminalCommand
46
46
  raise "Formatted time was not sorted in #{path}" unless times.sort == times
47
47
 
48
48
  diffs = times.map.each_slice(2).to_a
49
+
50
+ return diffs
49
51
  end
50
52
 
51
53
  def calc_total time_pairs
@@ -2,4 +2,5 @@ class Noir::Command::Format < Noir::Base::Command
2
2
  @description = 'format string utils'
3
3
  end
4
4
 
5
+ require 'noir/command/format/lgtm'
5
6
  require 'noir/command/format/pdf_url'
@@ -0,0 +1,18 @@
1
+ require 'uri'
2
+
3
+ class Noir::Command::Format::LGTM < Noir::Base::TerminalCommand
4
+ @description = 'puts LGTM Markdown string from image URL'
5
+
6
+ def self.execute *args
7
+ raise 'URL Missing. Please input a link in argument.'if args.empty?
8
+ url = args.first
9
+
10
+ if URI.regexp.match(url)
11
+ puts "[![LGTM](#{url})](#{url})"
12
+ else
13
+ puts "Argument '#{url}' is not URL."
14
+ end
15
+
16
+ end
17
+ end
18
+
@@ -4,7 +4,7 @@ class Noir::Command::Help < Noir::Base::TerminalCommand
4
4
 
5
5
  class << self
6
6
  def execute *args
7
- check_command_not_found *args
7
+ check_command_not_found(*args)
8
8
 
9
9
  puts 'noir : utilities'
10
10
  puts '-----'
@@ -11,7 +11,6 @@ module Noir
11
11
  matched_str = find_abbr_command(commands, search_str) if matched_str.nil?
12
12
 
13
13
  return nil if matched_str.nil?
14
- matched_arr = command_arr + [matched_str]
15
14
 
16
15
  return matched_str
17
16
  end
@@ -59,7 +58,7 @@ module Noir
59
58
  return command_from_argv.description
60
59
  end
61
60
 
62
- command_from_argv.execute *args_from_argv
61
+ command_from_argv.execute(*args_from_argv)
63
62
  end
64
63
 
65
64
  end
@@ -1,3 +1,3 @@
1
1
  module Noir
2
- VERSION = '0.1.9'
2
+ VERSION = '0.1.10'
3
3
  end
@@ -18,10 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.required_ruby_version = '>= 1.9.2'
21
+ spec.required_ruby_version = '>= 2.0.0'
22
22
 
23
- spec.add_development_dependency 'bundler', '~> 1.6'
24
- spec.add_development_dependency 'rake', '10.4.2'
25
- spec.add_development_dependency 'rspec', '3.2.0'
26
- spec.add_development_dependency 'pry', '0.10.3'
23
+ spec.add_development_dependency 'bundler', '~> 1.6'
24
+ spec.add_development_dependency 'rake', '12.0.0'
25
+ spec.add_development_dependency 'rspec', '3.6.0'
26
+ spec.add_development_dependency 'rspec-temp_dir', '1.0.0'
27
+ spec.add_development_dependency 'pry', '0.10.4'
27
28
  end
@@ -12,7 +12,7 @@ describe 'Noir::Command::Calculate::Time' do
12
12
  end
13
13
 
14
14
  it 'is raise exception when non-arguments' do
15
- expect{ Noir::Command::Calculate::Time.execute }.to raise_error
15
+ expect{ Noir::Command::Calculate::Time.execute }.to raise_error(RuntimeError)
16
16
  end
17
17
 
18
18
  describe '.extract_directory' do
@@ -48,7 +48,7 @@ describe 'Noir::Command::Edit::Note' do
48
48
  allow(Dir).to receive(:glob).with(anything).and_return([1, 2, 3, 4, 5])
49
49
  expect(Noir::Command::Edit::Note).to_not receive(:edit)
50
50
  [-4,-5,-6].each do |n|
51
- expect{Noir::Command::Edit::Note.execute(n.to_s)}.to raise_error(/Cannot/)
51
+ expect{Noir::Command::Edit::Note.execute(n.to_s)}.to raise_error(RuntimeError, /Cannot/)
52
52
  end
53
53
  end
54
54
 
@@ -7,16 +7,10 @@ describe 'Noir::Command::Edit::WeeklyReport' do
7
7
  end
8
8
 
9
9
  describe '.report_name' do
10
- before do
11
- class Time
12
- def self.now
13
- Time.new(2014, 4, 1) # test date is 2014/04/01
14
- end
15
- end
16
- end
10
+ dependent_time_now
17
11
 
18
12
  it 'is raise invalid weekly separator' do
19
- expect{Noir::Command::Edit::WeeklyReport.report_name :unknown}.to raise_error
13
+ expect{Noir::Command::Edit::WeeklyReport.report_name :unknown}.to raise_error(RuntimeError)
20
14
  end
21
15
 
22
16
  describe 'in no week diff' do
@@ -0,0 +1,21 @@
1
+ require 'noir'
2
+ require 'spec_helper'
3
+
4
+ describe 'Noir::Command::Format::LGTM' do
5
+ it 'is inherited Noir::Base::Terminalcommand' do
6
+ expect(Noir::Command::Format::LGTM.superclass).to eq(Noir::Base::TerminalCommand)
7
+ end
8
+
9
+ it 'is raise exception when argument is empty' do
10
+ expect{Noir::Command::Format::LGTM.execute}.to raise_error(RuntimeError, /URL Missing/)
11
+ end
12
+
13
+ it 'outputs Markdown strging from valid URL' do
14
+ url = 'http://www.google.com/'
15
+ expect{ Noir::Command::Format::LGTM.execute(url) }.to output(/LGTM/).to_stdout
16
+ end
17
+
18
+ it 'is output message, if link is not valid' do
19
+ expect{ Noir::Command::Format::LGTM.execute('hoge') }.to output(/is not URL/).to_stdout
20
+ end
21
+ end
@@ -1,7 +1,7 @@
1
1
  require 'noir'
2
2
  require 'spec_helper'
3
3
 
4
- describe 'Noir::Command::Edit' do
4
+ describe 'Noir::Command::Format::PDFURL' do
5
5
  it 'is inherited Noir::Base::Terminalcommand' do
6
6
  expect(Noir::Command::Format::PDFURL.superclass).to eq(Noir::Base::TerminalCommand)
7
7
  end
@@ -11,6 +11,6 @@ describe 'Noir::Command::Help' do
11
11
  end
12
12
 
13
13
  it 'is raise exception when apply arguments' do
14
- expect{Noir::Command::Help.execute 'abc'}.to raise_error
14
+ expect{Noir::Command::Help.execute 'abc'}.to raise_error(RuntimeError)
15
15
  end
16
16
  end
@@ -7,6 +7,6 @@ describe 'Noir::Command::Init::Zsh' do
7
7
  end
8
8
 
9
9
  it 'is output in execute' do
10
- expect{expect{Noir::Command::Init::Zsh.execute []}.to output.to_stdout}.to_not raise_error
10
+ expect{expect{Noir::Command::Init::Zsh.execute []}.to output.to_stdout}.to_not raise_exception
11
11
  end
12
12
  end
@@ -14,11 +14,11 @@ describe 'Noir::Command::New::GitIgnore' do
14
14
 
15
15
  describe '.ignore_texts_from_kinds' do
16
16
  it 'is raise error when arguments is empty' do
17
- expect{Noir::Command::New::GitIgnore.ignore_texts_from_kinds([])}.to raise_error(/input/)
17
+ expect{Noir::Command::New::GitIgnore.ignore_texts_from_kinds([])}.to raise_error(RuntimeError, /input/)
18
18
  end
19
19
 
20
20
  it 'is raise errors when arguments has invalid kinds' do
21
- expect{Noir::Command::New::GitIgnore.ignore_texts_from_kinds(['hoge'])}.to raise_error(/Un/)
21
+ expect{Noir::Command::New::GitIgnore.ignore_texts_from_kinds(['hoge'])}.to raise_error(RuntimeError, /Un/)
22
22
  end
23
23
 
24
24
  it 'is same text when valid a kind' do
@@ -13,11 +13,11 @@ describe 'Noir::Command::New::HgIgnore' do
13
13
  end
14
14
 
15
15
  it 'is raise when arguments is empty by .ignore_texts_from_kinds' do
16
- expect{Noir::Command::New::HgIgnore.execute}.to raise_error(/input/)
16
+ expect{Noir::Command::New::HgIgnore.execute}.to raise_error(RuntimeError, /input/)
17
17
  end
18
18
 
19
19
  it 'is raise when arguments includes invalid kinds' do
20
- expect{Noir::Command::New::HgIgnore.execute('hoge')}.to raise_error(/Unsupported kinds/)
20
+ expect{Noir::Command::New::HgIgnore.execute('hoge')}.to raise_error(RuntimeError, /Unsupported kinds/)
21
21
  end
22
22
 
23
23
 
@@ -3,6 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  describe 'Noir::Command::Summarize::Note::Weekly' do
5
5
  include_context :dependencie_on_current_directory
6
+ dependent_time_now
6
7
 
7
8
  it 'is inherited Noir::Base::Command' do
8
9
  expect(Noir::Command::Summarize::Note::Weekly.superclass).to eq(Noir::Base::Command)
@@ -92,7 +92,7 @@ describe 'Noir::Executer' do
92
92
 
93
93
  it 'raise exception matched one more' do
94
94
  stub_const 'ARGV', ['h']
95
- expect{Noir::Executer.command_from_argv}.to raise_error
95
+ expect{Noir::Executer.command_from_argv}.to raise_error(RuntimeError)
96
96
  end
97
97
 
98
98
  it 'support multi command abbrev' do
@@ -115,7 +115,7 @@ describe 'Noir::Executer' do
115
115
  end
116
116
 
117
117
  it 'raise exeption in ambiguous match' do
118
- expect{Noir::Executer.find_command(['Noir', 'Command'], 'f')}.to raise_error
118
+ expect{Noir::Executer.find_command(['Noir', 'Command'], 'f')}.to raise_error(RuntimeError)
119
119
  end
120
120
  end # find_command
121
121
 
@@ -21,7 +21,7 @@ describe 'Noir::Base::Command' do
21
21
  it 'not effect that set description into superclass to subclass' do
22
22
  Noir::Base::Command.class_variable_set :@@description, "hoge"
23
23
  stub_const('Hoge', Class.new(Noir::Base::Command))
24
- expect{Hoge.description}.to raise_error
24
+ expect{Hoge.description}.to raise_error(RuntimeError)
25
25
  Noir::Base::Command.class_variable_set :@@description, nil
26
26
  end
27
27
  end
@@ -34,7 +34,7 @@ describe 'Noir::Base::Command' do
34
34
  end
35
35
 
36
36
  it 'raise exception if called in extended class but undefined description' do
37
- expect{Hoge.execute}.to raise_error
37
+ expect{Hoge.execute}.to raise_error(RuntimeError)
38
38
  end
39
39
 
40
40
  it 'output description if called in extended class and defined description' do
@@ -1,4 +1,5 @@
1
1
  require 'noir'
2
+ require 'rspec/temp_dir'
2
3
 
3
4
  $LOAD_PATH << File.expand_path('../../lib', __FILE__)
4
5
 
@@ -43,21 +44,17 @@ def stub_commands
43
44
  end
44
45
 
45
46
  shared_context :dependencie_on_current_directory do
47
+ include_context 'uses temp dir'
46
48
  around do |spec|
47
- Dir.mktmpdir('noir-tempdir') do |dir|
48
- Dir.chdir(dir) do
49
- spec.run
50
- end
49
+ Dir.chdir(temp_dir) do
50
+ spec.run
51
51
  end
52
52
  end
53
53
  end
54
54
 
55
- # for ruby 1.9.2
56
-
57
- unless File.respond_to?(:write)
58
- class File
59
- def self.write filename, contents
60
- open(filename, 'w'){|f| f.write(contents)}
61
- end
55
+ def dependent_time_now
56
+ before (:each) do
57
+ # test date is 2014/04/01
58
+ allow(Time).to receive(:now).and_return(Time.new(2014, 4, 1))
62
59
  end
63
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noir
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - atton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-24 00:00:00.000000000 Z
11
+ date: 2017-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,42 +30,56 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 10.4.2
33
+ version: 12.0.0
34
34
  type: :development
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: 10.4.2
40
+ version: 12.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 3.2.0
47
+ version: 3.6.0
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: 3.2.0
54
+ version: 3.6.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-temp_dir
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: pry
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - '='
60
74
  - !ruby/object:Gem::Version
61
- version: 0.10.3
75
+ version: 0.10.4
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: 0.10.3
82
+ version: 0.10.4
69
83
  description: Untility commands with completion for atton.
70
84
  email:
71
85
  - e115763@gmail.com
@@ -94,6 +108,7 @@ files:
94
108
  - lib/noir/command/edit/note.rb
95
109
  - lib/noir/command/edit/weekly_report.rb
96
110
  - lib/noir/command/format.rb
111
+ - lib/noir/command/format/lgtm.rb
97
112
  - lib/noir/command/format/pdf_url.rb
98
113
  - lib/noir/command/help.rb
99
114
  - lib/noir/command/init.rb
@@ -126,6 +141,7 @@ files:
126
141
  - spec/noir/command/edit/weekly_report/wednesday_spec.rb
127
142
  - spec/noir/command/edit/weekly_report_spec.rb
128
143
  - spec/noir/command/edit_spec.rb
144
+ - spec/noir/command/format/lgtm_spec.rb
129
145
  - spec/noir/command/format/pdf_url_spec.rb
130
146
  - spec/noir/command/format_spec.rb
131
147
  - spec/noir/command/help_spec.rb
@@ -160,7 +176,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
176
  requirements:
161
177
  - - ">="
162
178
  - !ruby/object:Gem::Version
163
- version: 1.9.2
179
+ version: 2.0.0
164
180
  required_rubygems_version: !ruby/object:Gem::Requirement
165
181
  requirements:
166
182
  - - ">="
@@ -168,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
184
  version: '0'
169
185
  requirements: []
170
186
  rubyforge_project:
171
- rubygems_version: 2.5.1
187
+ rubygems_version: 2.6.12
172
188
  signing_key:
173
189
  specification_version: 4
174
190
  summary: Utilities for atton.
@@ -186,6 +202,7 @@ test_files:
186
202
  - spec/noir/command/edit/weekly_report/wednesday_spec.rb
187
203
  - spec/noir/command/edit/weekly_report_spec.rb
188
204
  - spec/noir/command/edit_spec.rb
205
+ - spec/noir/command/format/lgtm_spec.rb
189
206
  - spec/noir/command/format/pdf_url_spec.rb
190
207
  - spec/noir/command/format_spec.rb
191
208
  - spec/noir/command/help_spec.rb
@@ -208,4 +225,3 @@ test_files:
208
225
  - spec/noir/noir_spec.rb
209
226
  - spec/noir/options_spec.rb
210
227
  - spec/spec_helper.rb
211
- has_rdoc: