mmve 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +0 -2
- data/.rspec +1 -0
- data/.travis.yml +42 -0
- data/Guardfile +4 -4
- data/README.md +20 -0
- data/Rakefile +5 -5
- data/config/cucumber.yaml +3 -0
- data/features/step_definitions/editor_steps.rb +2 -2
- data/features/step_definitions/filesystem_steps.rb +2 -2
- data/features/support/env_aruba.rb +2 -2
- data/features/support/env_cucumber-doc_string.rb +4 -4
- data/features/usage.feature +1 -1
- data/lib/mmve/cli.rb +5 -5
- data/lib/mmve/editor.rb +10 -10
- data/lib/mmve/renamer.rb +3 -3
- data/lib/mmve/version.rb +1 -1
- data/mmve.gemspec +14 -15
- data/spec/mmve/cli_spec.rb +16 -56
- data/spec/mmve/editor_spec.rb +29 -24
- data/spec/mmve/renamer_spec.rb +9 -29
- metadata +39 -55
- data/Gemfile +0 -5
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ff3cb10f46ee14137bfb99473ec4898d5c83acfc
|
4
|
+
data.tar.gz: 9bec858348ee596b1597096a0f6d7942bd98b765
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c8e5f51bccb5212f7e19cd204b1abc45ad6ef727bf031c0c5c95baa0127f4dcb341fa8d7dc5030a629285f8ca81558f4063aedc10270d4d7fa0d663be33e7006
|
7
|
+
data.tar.gz: 4aaac79acc5a36714df8c5032979dc51cdd0c2e7a35f2e4afe4281d4bcf516b883854a55db58320ae706ac7663a0ebad7af27c9b4d0697d57f1b869ea9170f68
|
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.travis.yml
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
sudo: required
|
2
|
+
dist: trusty
|
3
|
+
language: c
|
4
|
+
addons:
|
5
|
+
apt:
|
6
|
+
packages:
|
7
|
+
- realpath
|
8
|
+
notifications:
|
9
|
+
email:
|
10
|
+
- tj+travis_mmve@a13.fr
|
11
|
+
on_success: never
|
12
|
+
|
13
|
+
env:
|
14
|
+
- RUBYVER=2.4-stable
|
15
|
+
- RUBYVER=2.3-stable
|
16
|
+
- RUBYVER=2.2-stable
|
17
|
+
- RUBYVER=2.1-stable
|
18
|
+
cache:
|
19
|
+
directories:
|
20
|
+
- ${HOME}/.gem/travis
|
21
|
+
- ${HOME}/usr
|
22
|
+
timeout: 3600
|
23
|
+
|
24
|
+
before_install:
|
25
|
+
- sudo apt-get --purge remove ruby\*
|
26
|
+
- rm -rf ~/.bash*
|
27
|
+
- unset gem GEM_HOME GEM_PATH RUBYOPT IRBRC
|
28
|
+
- export PATH=/bin:/usr/bin RB=$HOME/usr/bin/ruby
|
29
|
+
- test -x $RB || wget http://ftp.ruby-lang.org/pub/ruby/ruby-${RUBYVER}.tar.xz
|
30
|
+
- test -x $RB || tar xfJ ruby-*.tar.xz
|
31
|
+
- test -x $RB || cd ruby-*
|
32
|
+
- test -x $RB || ./configure --prefix=$HOME/usr --disable-install-doc --with-out-ext=tk
|
33
|
+
- test -x $RB || (make && make install)
|
34
|
+
- echo "source 'https://rubygems.org'; gemspec" > ~/spec_deps.rb
|
35
|
+
install:
|
36
|
+
- unset gem GEM_HOME GEM_PATH RUBYOPT IRBRC
|
37
|
+
- export GEM_HOME=~/.gem/travis GEM_PATH=~/.gem/travis
|
38
|
+
- export PATH=$GEM_HOME/bin:$HOME/usr/bin:/bin:/usr/bin
|
39
|
+
- cd $TRAVIS_BUILD_DIR
|
40
|
+
- gem install -g ~/spec_deps.rb
|
41
|
+
script:
|
42
|
+
- MMVE_CI=yes RUBYOPT=-I$(realpath lib) rake
|
data/Guardfile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
guard :cucumber,
|
2
|
-
watch
|
1
|
+
guard :cucumber, cmd_additional_args: '--profile guard', all_on_start: false do
|
2
|
+
watch %r{\Afeatures/.+\.feature\z}
|
3
3
|
watch(%r{\Afeatures/support/.+\.rb\z}) { 'features' }
|
4
4
|
watch(%r{\Afeatures/step_definitions/.+_steps\.rb\z}) { 'features' }
|
5
5
|
end
|
6
6
|
|
7
|
-
guard :rspec do
|
8
|
-
watch
|
7
|
+
guard :rspec, cmd: 'rspec -f doc' do
|
8
|
+
watch %r{\Aspec/.+_spec\.rb\z}
|
9
9
|
watch(%r{\Alib/(.+)\.rb\z}) { |m| "spec/#{m[1]}_spec.rb" }
|
10
10
|
watch('spec/spec_helper.rb') { 'spec' }
|
11
11
|
end
|
data/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
MMVE
|
2
|
+
====
|
3
|
+
|
4
|
+
Mass MV Edit: use your editor to move (rename) files.
|
5
|
+
|
6
|
+
|
7
|
+
TODO
|
8
|
+
----
|
9
|
+
|
10
|
+
* Recurse directories:
|
11
|
+
- `-r some_dir` will rename `some_dir` entries.
|
12
|
+
`somedir/` could also be used
|
13
|
+
- `-rr some_dir` will rename all files found recursively in
|
14
|
+
`some_dir`
|
15
|
+
|
16
|
+
* Handle conflicts in edited files
|
17
|
+
|
18
|
+
* Make EDITOR configurable in the API, keep ENV['EDITOR'] as default.
|
19
|
+
|
20
|
+
* Sort entries
|
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'cucumber/rake/task'
|
2
2
|
require 'rspec/core/rake_task'
|
3
3
|
|
4
|
-
desc 'Run all scenarios'
|
5
|
-
Cucumber::Rake::Task.new(:features)
|
6
4
|
|
7
|
-
|
8
|
-
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
task default: %i[features spec]
|
9
6
|
|
7
|
+
Cucumber::Rake::Task.new :features do |t|
|
8
|
+
t.profile = 'quiet' if ENV.key? 'MMVE_CI'
|
9
|
+
end
|
10
10
|
|
11
|
-
|
11
|
+
RSpec::Core::RakeTask.new
|
@@ -1,3 +1,3 @@
|
|
1
|
-
Given
|
2
|
-
|
1
|
+
Given /^my editor is "([^"]+)"$/ do |editor|
|
2
|
+
set_environment_variable 'EDITOR', editor
|
3
3
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
Given
|
2
|
-
paths.raw.flatten.each { |
|
1
|
+
Given /^the following files exists:$/ do |paths|
|
2
|
+
paths.raw.flatten.each { |e| write_file e, '' }
|
3
3
|
end
|
@@ -2,13 +2,13 @@ module Cucumber
|
|
2
2
|
class Runtime
|
3
3
|
alias :old_step_match :step_match
|
4
4
|
|
5
|
-
def step_match
|
5
|
+
def step_match step_name, name_to_report = nil
|
6
6
|
if step_name.include? ' must '
|
7
7
|
name_to_report = step_name.dup
|
8
8
|
step_name.gsub! ' must ', ' should '
|
9
9
|
end
|
10
10
|
|
11
|
-
old_step_match
|
11
|
+
old_step_match step_name, name_to_report
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -5,8 +5,8 @@ module Cucumber
|
|
5
5
|
class DocString
|
6
6
|
alias :old_initialize :initialize
|
7
7
|
|
8
|
-
def initialize
|
9
|
-
old_initialize
|
8
|
+
def initialize string, content_type
|
9
|
+
old_initialize string + $/, content_type
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -15,8 +15,8 @@ module Cucumber
|
|
15
15
|
class Pretty
|
16
16
|
alias :old_doc_string :doc_string
|
17
17
|
|
18
|
-
def doc_string
|
19
|
-
old_doc_string
|
18
|
+
def doc_string string
|
19
|
+
old_doc_string string.chomp
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/features/usage.feature
CHANGED
data/lib/mmve/cli.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module MMVE
|
2
2
|
class CLI
|
3
|
-
USAGE = "Usage: #{File.basename $0} [ path ... ]"
|
3
|
+
USAGE = "Usage: #{File.basename $0} [ path ... ]".freeze
|
4
4
|
|
5
|
-
def initialize
|
5
|
+
def initialize arguments, stdout = $stdout
|
6
6
|
@arguments = arguments
|
7
7
|
@stdout = stdout
|
8
8
|
end
|
@@ -14,14 +14,14 @@ module MMVE
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def editor
|
17
|
-
@editor ||= Editor.new
|
17
|
+
@editor ||= Editor.new ENV['EDITOR']
|
18
18
|
end
|
19
19
|
|
20
20
|
def renamer
|
21
|
-
@renamer ||= Renamer.new
|
21
|
+
@renamer ||= Renamer.new @arguments
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
private
|
25
25
|
|
26
26
|
def print_usage_and_exit
|
27
27
|
@stdout.puts USAGE
|
data/lib/mmve/editor.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
1
3
|
module MMVE
|
2
4
|
class Editor
|
3
|
-
|
4
|
-
|
5
|
-
def initialize(editor_command)
|
5
|
+
def initialize editor_command
|
6
6
|
@editor_command = editor_command
|
7
7
|
end
|
8
8
|
|
9
|
-
def edit
|
10
|
-
edited_content = with_temp_file(paths *
|
11
|
-
edited_content.split
|
9
|
+
def edit paths
|
10
|
+
edited_content = with_temp_file(paths * $/ + $/) { |f| edit_file f }
|
11
|
+
edited_content.split $/
|
12
12
|
end
|
13
13
|
|
14
|
-
def with_temp_file
|
14
|
+
def with_temp_file content
|
15
15
|
content_after = ''
|
16
|
-
Tempfile.open
|
16
|
+
Tempfile.open File.basename $0 + ?_ do |f|
|
17
17
|
f.write content
|
18
18
|
f.rewind
|
19
19
|
yield f
|
@@ -22,8 +22,8 @@ module MMVE
|
|
22
22
|
content_after
|
23
23
|
end
|
24
24
|
|
25
|
-
def edit_file
|
26
|
-
system
|
25
|
+
def edit_file file
|
26
|
+
system *@editor_command.split, file.path
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/lib/mmve/renamer.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
module MMVE
|
2
2
|
class Renamer
|
3
3
|
attr_reader :sources
|
4
|
-
|
4
|
+
attr_accessor :destinations
|
5
5
|
|
6
|
-
def initialize
|
6
|
+
def initialize paths
|
7
7
|
@sources = paths
|
8
8
|
@destinations = @sources.dup
|
9
9
|
end
|
10
10
|
|
11
11
|
def execute!
|
12
12
|
[@sources, @destinations].transpose.each do |e|
|
13
|
-
File.rename
|
13
|
+
File.rename *e if e.uniq.count == 2
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/mmve/version.rb
CHANGED
data/mmve.gemspec
CHANGED
@@ -1,24 +1,23 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH << lib unless $LOAD_PATH.include? lib
|
3
|
-
require 'mmve/version'
|
1
|
+
require File.expand_path('../lib/mmve/version', __FILE__)
|
4
2
|
|
5
3
|
Gem::Specification.new do |s|
|
6
|
-
s.name
|
7
|
-
s.version
|
8
|
-
s.summary
|
4
|
+
s.name = 'mmve'
|
5
|
+
s.version = MMVE::VERSION
|
6
|
+
s.summary = "mmve-#{MMVE::VERSION}"
|
9
7
|
s.description = 'Mass MV Editor: move files with your favourite $EDITOR'
|
10
|
-
s.
|
8
|
+
s.license = 'BSD-3-Clause'
|
9
|
+
s.homepage = 'https://rubygems.org/gems/mmve'
|
11
10
|
|
12
|
-
s.authors
|
13
|
-
s.email
|
11
|
+
s.authors = 'Thibault Jouan'
|
12
|
+
s.email = 'tj@a13.fr'
|
14
13
|
|
15
14
|
s.files = `git ls-files`.split $/
|
16
|
-
s.
|
17
|
-
s.
|
15
|
+
s.executables = 'mmve'
|
16
|
+
s.extra_rdoc_files = %w[README.md]
|
18
17
|
|
19
18
|
|
20
|
-
s.add_development_dependency '
|
21
|
-
s.add_development_dependency '
|
22
|
-
s.add_development_dependency '
|
23
|
-
s.add_development_dependency '
|
19
|
+
s.add_development_dependency 'rake', '~> 10.4'
|
20
|
+
s.add_development_dependency 'rspec', '~> 3.2'
|
21
|
+
s.add_development_dependency 'cucumber', '~> 1.3'
|
22
|
+
s.add_development_dependency 'aruba', '~> 0.6'
|
24
23
|
end
|
data/spec/mmve/cli_spec.rb
CHANGED
@@ -1,50 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MMVE::CLI do
|
1
|
+
RSpec.describe MMVE::CLI do
|
4
2
|
include ExitHelpers
|
5
3
|
|
6
|
-
let(:arguments) { [
|
4
|
+
let(:arguments) { %i[some arguments] }
|
7
5
|
let(:stdout) { StringIO.new }
|
8
|
-
subject(:cli) {
|
9
|
-
|
10
|
-
describe '#initialize' do
|
11
|
-
it 'assigns the arguments' do
|
12
|
-
expect(cli.instance_eval { @arguments }).to eq arguments
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'assigns the standard output' do
|
16
|
-
expect(cli.instance_eval { @stdout }).to eq stdout
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'when no stdout is specified' do
|
20
|
-
subject(:cli) { MMVE::CLI.new(arguments) }
|
21
|
-
|
22
|
-
it 'assigns $stdout as a default standard output' do
|
23
|
-
expect(cli.instance_eval { @stdout }).to be $stdout
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
6
|
+
subject(:cli) { described_class.new arguments, stdout }
|
27
7
|
|
28
8
|
describe '#run!' do
|
29
9
|
it 'edits the renamer source paths' do
|
30
10
|
renamer = double('renamer').as_null_object
|
31
11
|
allow(cli).to receive(:renamer) { renamer }
|
32
|
-
expect(cli.editor)
|
12
|
+
expect(cli.editor)
|
13
|
+
.to receive(:edit)
|
14
|
+
.with cli.renamer.sources
|
33
15
|
cli.run!
|
34
16
|
end
|
35
17
|
|
36
18
|
it 'assigns the edited source paths as the renamer destination paths' do
|
37
|
-
editor = double
|
19
|
+
editor = double 'editor'
|
38
20
|
allow(cli).to receive(:editor) { editor }
|
39
21
|
allow(editor).to receive(:edit) { arguments }
|
40
|
-
expect(cli.renamer)
|
22
|
+
expect(cli.renamer)
|
23
|
+
.to receive(:destinations=)
|
24
|
+
.with arguments
|
41
25
|
cli.run!
|
42
26
|
end
|
43
27
|
|
44
28
|
it 'executes the renamer' do
|
45
29
|
editor = double('editor').as_null_object
|
46
30
|
allow(cli).to receive(:editor) { editor }
|
47
|
-
expect(cli.renamer).to receive
|
31
|
+
expect(cli.renamer).to receive :execute!
|
48
32
|
cli.run!
|
49
33
|
end
|
50
34
|
|
@@ -53,40 +37,16 @@ describe MMVE::CLI do
|
|
53
37
|
|
54
38
|
it 'prints the usage' do
|
55
39
|
trap_exit { cli.run! }
|
56
|
-
expect(stdout.string).to eq
|
40
|
+
expect(stdout.string).to eq <<-eoh
|
41
|
+
Usage: rspec [ path ... ]
|
42
|
+
eoh
|
57
43
|
end
|
58
44
|
|
59
45
|
it 'exits successfully' do
|
60
|
-
expect { cli.run! }.to raise_error
|
61
|
-
expect(e.
|
46
|
+
expect { cli.run! }.to raise_error SystemExit do |e|
|
47
|
+
expect(e.status).to be 0
|
62
48
|
end
|
63
49
|
end
|
64
50
|
end
|
65
51
|
end
|
66
|
-
|
67
|
-
describe '#editor' do
|
68
|
-
it 'builds an editor with current $EDITOR' do
|
69
|
-
expect(MMVE::Editor).to receive(:new).with(ENV['EDITOR'])
|
70
|
-
cli.editor
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'returns the editor' do
|
74
|
-
editor = double('editor')
|
75
|
-
allow(MMVE::Editor).to receive(:new) { editor }
|
76
|
-
expect(cli.editor).to be editor
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe '#renamer' do
|
81
|
-
it 'builds a renamer with the paths given as argument' do
|
82
|
-
expect(MMVE::Renamer).to receive(:new).with(arguments)
|
83
|
-
cli.renamer
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'returns the renamer' do
|
87
|
-
renamer = double('renamer')
|
88
|
-
allow(MMVE::Renamer).to receive(:new) { renamer }
|
89
|
-
expect(cli.renamer).to be renamer
|
90
|
-
end
|
91
|
-
end
|
92
52
|
end
|
data/spec/mmve/editor_spec.rb
CHANGED
@@ -1,33 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MMVE::Editor do
|
1
|
+
RSpec.describe MMVE::Editor do
|
4
2
|
let(:editor_command) { 'some editor command' }
|
5
|
-
subject(:editor) {
|
6
|
-
|
7
|
-
describe '#initialize' do
|
8
|
-
it 'assigns the editor command' do
|
9
|
-
expect(editor.instance_eval { @editor_command }).to eq editor_command
|
10
|
-
end
|
11
|
-
end
|
3
|
+
subject(:editor) { described_class.new editor_command }
|
12
4
|
|
13
5
|
describe '#edit' do
|
14
6
|
let(:paths) { %w[some_path other_path] }
|
15
|
-
let(:paths_str) { paths *
|
7
|
+
let(:paths_str) { paths * $/ + $/ }
|
16
8
|
|
17
9
|
it 'creates a temporary file with the paths as content' do
|
18
10
|
expect(editor)
|
19
|
-
.to receive(:with_temp_file)
|
20
|
-
|
11
|
+
.to receive(:with_temp_file)
|
12
|
+
.with(paths_str)
|
13
|
+
.and_return paths_str
|
14
|
+
editor.edit paths
|
21
15
|
end
|
22
16
|
|
23
17
|
it 'sends the edit_file message with the temporary file' do
|
24
|
-
expect(editor)
|
25
|
-
|
18
|
+
expect(editor)
|
19
|
+
.to receive(:edit_file)
|
20
|
+
.with any_args
|
21
|
+
editor.edit paths
|
26
22
|
end
|
27
23
|
|
28
24
|
it 'returns the edited file paths as a list' do
|
29
25
|
allow(editor).to receive(:with_temp_file) { paths_str }
|
30
|
-
expect(editor.edit
|
26
|
+
expect(editor.edit paths).to eq paths
|
31
27
|
end
|
32
28
|
end
|
33
29
|
|
@@ -35,21 +31,28 @@ describe MMVE::Editor do
|
|
35
31
|
let(:content) { "some_content\n" }
|
36
32
|
|
37
33
|
it 'opens a temporary file' do
|
38
|
-
expect(Tempfile)
|
34
|
+
expect(Tempfile)
|
35
|
+
.to receive(:open)
|
36
|
+
.with 'rspec_'
|
39
37
|
editor.with_temp_file(content) { }
|
40
38
|
end
|
41
39
|
|
42
40
|
it 'it writes the content to the file' do
|
43
41
|
file = double('file').as_null_object
|
44
|
-
allow(Tempfile)
|
45
|
-
|
42
|
+
allow(Tempfile)
|
43
|
+
.to receive(:open)
|
44
|
+
.and_yield file
|
45
|
+
expect(file).to receive(:write).with content
|
46
46
|
editor.with_temp_file(content) { }
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'yields the block with the file as argument' do
|
50
50
|
file = double('file').as_null_object
|
51
|
-
allow(Tempfile)
|
52
|
-
|
51
|
+
allow(Tempfile)
|
52
|
+
.to receive(:open)
|
53
|
+
.and_yield file
|
54
|
+
expect { |b| editor.with_temp_file content, &b }
|
55
|
+
.to yield_with_args file
|
53
56
|
end
|
54
57
|
|
55
58
|
it 'returns the temporary file content after yielding the block' do
|
@@ -61,11 +64,13 @@ describe MMVE::Editor do
|
|
61
64
|
end
|
62
65
|
|
63
66
|
describe '#edit_file' do
|
64
|
-
let(:file) { double
|
67
|
+
let(:file) { double 'file', path: 'some_path' }
|
65
68
|
|
66
69
|
it 'executes the editor command with the file path as argument' do
|
67
|
-
expect(editor)
|
68
|
-
|
70
|
+
expect(editor)
|
71
|
+
.to receive(:system)
|
72
|
+
.with *editor_command.split, file.path
|
73
|
+
editor.edit_file file
|
69
74
|
end
|
70
75
|
end
|
71
76
|
end
|
data/spec/mmve/renamer_spec.rb
CHANGED
@@ -1,35 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MMVE::Renamer do
|
1
|
+
RSpec.describe MMVE::Renamer do
|
4
2
|
let(:sources) { %w[some_path other_path] }
|
5
3
|
let(:destinations) { %w[renamed_path other_path] }
|
6
|
-
subject(:renamer) {
|
7
|
-
|
8
|
-
describe '#initialize' do
|
9
|
-
it 'assigns the source paths' do
|
10
|
-
expect(renamer.instance_eval { @sources }).to eq sources
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'assigns destination paths equivalent to source paths' do
|
14
|
-
expect(renamer.instance_eval { @destinations }).to eq sources
|
15
|
-
end
|
4
|
+
subject(:renamer) { described_class.new sources }
|
16
5
|
|
17
|
-
|
18
|
-
|
19
|
-
end
|
6
|
+
it 'assigns destination paths equivalent to source paths' do
|
7
|
+
expect(renamer.destinations).to eq sources
|
20
8
|
end
|
21
9
|
|
22
|
-
|
23
|
-
|
24
|
-
expect(renamer.sources).to eq sources
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#destinations=' do
|
29
|
-
it 'assigns the destination paths' do
|
30
|
-
renamer.destinations = destinations
|
31
|
-
expect(renamer.instance_eval { @destinations }).to eq destinations
|
32
|
-
end
|
10
|
+
it 'copies the assignated destinations paths' do
|
11
|
+
expect(renamer.destinations).not_to be sources
|
33
12
|
end
|
34
13
|
|
35
14
|
describe '#execute!' do
|
@@ -40,7 +19,8 @@ describe MMVE::Renamer do
|
|
40
19
|
|
41
20
|
it 'renames the sources to the destinations' do
|
42
21
|
expect(File)
|
43
|
-
.to receive(:rename)
|
22
|
+
.to receive(:rename)
|
23
|
+
.with sources.first, destinations.first
|
44
24
|
renamer.execute!
|
45
25
|
end
|
46
26
|
end
|
@@ -49,7 +29,7 @@ describe MMVE::Renamer do
|
|
49
29
|
let(:destinations) { sources }
|
50
30
|
|
51
31
|
it 'renames nothing' do
|
52
|
-
expect(File).not_to receive
|
32
|
+
expect(File).not_to receive :rename
|
53
33
|
renamer.execute!
|
54
34
|
end
|
55
35
|
end
|
metadata
CHANGED
@@ -1,93 +1,88 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Thibault Jouan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2017-03-05 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '10.4'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
26
|
+
version: '10.4'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
28
|
+
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
33
|
+
version: '3.2'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: '
|
40
|
+
version: '3.2'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
42
|
+
name: cucumber
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
47
|
+
version: '1.3'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
54
|
+
version: '1.3'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
56
|
+
name: aruba
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - "~>"
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
61
|
+
version: '0.6'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - "~>"
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
description:
|
68
|
+
version: '0.6'
|
69
|
+
description: 'Mass MV Editor: move files with your favourite $EDITOR'
|
79
70
|
email: tj@a13.fr
|
80
71
|
executables:
|
81
72
|
- mmve
|
82
73
|
extensions: []
|
83
|
-
extra_rdoc_files:
|
74
|
+
extra_rdoc_files:
|
75
|
+
- README.md
|
84
76
|
files:
|
85
|
-
- .gitignore
|
86
|
-
-
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
87
80
|
- Guardfile
|
88
81
|
- LICENSE
|
82
|
+
- README.md
|
89
83
|
- Rakefile
|
90
84
|
- bin/mmve
|
85
|
+
- config/cucumber.yaml
|
91
86
|
- features/rename.feature
|
92
87
|
- features/step_definitions/editor_steps.rb
|
93
88
|
- features/step_definitions/filesystem_steps.rb
|
@@ -106,38 +101,27 @@ files:
|
|
106
101
|
- spec/spec_helper.rb
|
107
102
|
- spec/support/exit_helpers.rb
|
108
103
|
homepage: https://rubygems.org/gems/mmve
|
109
|
-
licenses:
|
104
|
+
licenses:
|
105
|
+
- BSD-3-Clause
|
106
|
+
metadata: {}
|
110
107
|
post_install_message:
|
111
108
|
rdoc_options: []
|
112
109
|
require_paths:
|
113
110
|
- lib
|
114
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
112
|
requirements:
|
117
|
-
- -
|
113
|
+
- - ">="
|
118
114
|
- !ruby/object:Gem::Version
|
119
115
|
version: '0'
|
120
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
117
|
requirements:
|
123
|
-
- -
|
118
|
+
- - ">="
|
124
119
|
- !ruby/object:Gem::Version
|
125
120
|
version: '0'
|
126
121
|
requirements: []
|
127
122
|
rubyforge_project:
|
128
|
-
rubygems_version:
|
123
|
+
rubygems_version: 2.6.10
|
129
124
|
signing_key:
|
130
|
-
specification_version:
|
131
|
-
summary: mmve-0.1.
|
132
|
-
test_files:
|
133
|
-
- features/rename.feature
|
134
|
-
- features/step_definitions/editor_steps.rb
|
135
|
-
- features/step_definitions/filesystem_steps.rb
|
136
|
-
- features/support/env_aruba.rb
|
137
|
-
- features/support/env_cucumber-doc_string.rb
|
138
|
-
- features/usage.feature
|
139
|
-
- spec/mmve/cli_spec.rb
|
140
|
-
- spec/mmve/editor_spec.rb
|
141
|
-
- spec/mmve/renamer_spec.rb
|
142
|
-
- spec/spec_helper.rb
|
143
|
-
- spec/support/exit_helpers.rb
|
125
|
+
specification_version: 4
|
126
|
+
summary: mmve-0.1.2
|
127
|
+
test_files: []
|