replace_recursive 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0e4eb14d9fbad383999bd4559d15e24e96eecda0
4
+ data.tar.gz: ec785263106c05ce3776aab33ec74a0642c3dea1
5
+ SHA512:
6
+ metadata.gz: 709f4279326dff056639f0b8ce0c9bbefd78be9fa2ec510a32012a2e564ff96be2c153b777bd882d4c3c17c77fa83746052c2fd49f207feb8be3a38f44bd2758
7
+ data.tar.gz: 074fae883a9b7977cb62572c56a3da170b6518a706ce0e6fd9598582cbb06c7098ceb736c154b14820e70b981aa4d1f4979b69ccfd0f4607e2039ff976837ac6
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "thor", ">= 0.19.1"
4
+
5
+ group :development do
6
+ gem "jeweler", "~> 2.0.1"
7
+ end
@@ -0,0 +1,57 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.3.8)
5
+ builder (3.2.2)
6
+ descendants_tracker (0.0.4)
7
+ thread_safe (~> 0.3, >= 0.3.1)
8
+ faraday (0.9.2)
9
+ multipart-post (>= 1.2, < 3)
10
+ git (1.2.9.1)
11
+ github_api (0.12.4)
12
+ addressable (~> 2.3)
13
+ descendants_tracker (~> 0.0.4)
14
+ faraday (~> 0.8, < 0.10)
15
+ hashie (>= 3.4)
16
+ multi_json (>= 1.7.5, < 2.0)
17
+ nokogiri (~> 1.6.6)
18
+ oauth2
19
+ hashie (3.4.3)
20
+ highline (1.7.8)
21
+ jeweler (2.0.1)
22
+ builder
23
+ bundler (>= 1.0)
24
+ git (>= 1.2.5)
25
+ github_api
26
+ highline (>= 1.6.15)
27
+ nokogiri (>= 1.5.10)
28
+ rake
29
+ rdoc
30
+ jwt (1.5.2)
31
+ mini_portile (0.6.2)
32
+ multi_json (1.11.2)
33
+ multi_xml (0.5.5)
34
+ multipart-post (2.0.0)
35
+ nokogiri (1.6.6.3)
36
+ mini_portile (~> 0.6.0)
37
+ oauth2 (1.0.0)
38
+ faraday (>= 0.8, < 0.10)
39
+ jwt (~> 1.0)
40
+ multi_json (~> 1.3)
41
+ multi_xml (~> 0.5)
42
+ rack (~> 1.2)
43
+ rack (1.6.4)
44
+ rake (10.4.2)
45
+ rdoc (4.2.0)
46
+ thor (0.19.1)
47
+ thread_safe (0.3.5)
48
+
49
+ PLATFORMS
50
+ ruby
51
+
52
+ DEPENDENCIES
53
+ jeweler (~> 2.0.1)
54
+ thor (>= 0.19.1)
55
+
56
+ BUNDLED WITH
57
+ 1.10.6
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 Victor Antoniazzi
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,23 @@
1
+ # Replace Recursive
2
+
3
+ Replace recursive text in path or into all files
4
+
5
+ # Installing
6
+
7
+ `gem install replace_recursive`
8
+
9
+ # Usage
10
+
11
+ ```
12
+ -p --path : Path to search string
13
+ -f --find : Text to search to replace
14
+ -r --replace : New text
15
+ ```
16
+
17
+ ## Text in files recursive
18
+
19
+ `replace_recursive text -p ~/Path -f user -r users`
20
+
21
+ ## Names of path and files recursive
22
+
23
+ `replace_recursive path -p ~/Path -f user -r users`
@@ -0,0 +1,43 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "replace_recursive"
18
+ gem.homepage = "http://github.com/vgsantoniazzi/replace_recursive"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Replace text into files and paths by new ones}
21
+ gem.description = %Q{replace_recursive --help}
22
+ gem.email = "vgsantoniazzi@gmail.com"
23
+ gem.authors = ["Victor Antoniazzi"]
24
+ gem.executables = ["replace_recursive"]
25
+ # dependencies defined in Gemfile
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rake/testtask'
30
+ Rake::TestTask.new(:test) do |test|
31
+ test.libs << 'lib' << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+
36
+ desc "Code coverage detail"
37
+ task :simplecov do
38
+ ENV['COVERAGE'] = "true"
39
+ Rake::Task['test'].execute
40
+ end
41
+
42
+ task :default => :test
43
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path(File.join('..', 'lib', 'replace_recursive'), File.dirname(__FILE__))
3
+
4
+ ReplaceRecursive.start(ARGV)
@@ -0,0 +1,19 @@
1
+ require 'thor'
2
+
3
+ class ReplaceRecursive < Thor
4
+ desc "path", "Replace all occurrencies of --find by --replace in path (file and folder names)"
5
+ option :path, :required => true, aliases: :p
6
+ option :find, :required => true, aliases: :f
7
+ option :replace, :required => true, aliases: :r
8
+ def path(name = nil)
9
+ system "find #{options[:path]} -depth -name '*#{options[:find]}*' -execdir bash -c 'mv \"$1\" \"${1//#{options[:find]}/#{options[:replace]}}\"' _ {} \\;"
10
+ end
11
+
12
+ desc "text", "Replace all occurrencies of --find by --replace in files (Text in files)"
13
+ option :path, :required => true, aliases: :p
14
+ option :find, :required => true, aliases: :f
15
+ option :replace, :required => true, aliases: :r
16
+ def text(name = nil)
17
+ system "grep -rl \"#{options[:find]}\" #{options[:path]} | xargs sed -i \"s/#{options[:find]}/#{options[:replace]}/g\""
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: replace_recursive
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Victor Antoniazzi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.19.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.19.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: jeweler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.0.1
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.0.1
41
+ description: replace_recursive --help
42
+ email: vgsantoniazzi@gmail.com
43
+ executables:
44
+ - replace_recursive
45
+ extensions: []
46
+ extra_rdoc_files:
47
+ - LICENSE.txt
48
+ - README.md
49
+ files:
50
+ - ".document"
51
+ - Gemfile
52
+ - Gemfile.lock
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - VERSION
57
+ - bin/replace_recursive
58
+ - lib/replace_recursive.rb
59
+ homepage: http://github.com/vgsantoniazzi/replace_recursive
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.4.5.1
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Replace text into files and paths by new ones
83
+ test_files: []