lookfile 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.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +13 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +63 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/lookfile +10 -0
- data/bin/setup +8 -0
- data/lib/command.rb +66 -0
- data/lib/commands/add.rb +28 -0
- data/lib/commands/init.rb +30 -0
- data/lib/commands/look.rb +24 -0
- data/lib/commands/set_repository.rb +28 -0
- data/lib/commands/update.rb +26 -0
- data/lib/git.rb +65 -0
- data/lib/lookfile/version.rb +3 -0
- data/lib/lookfile.rb +78 -0
- data/lookfile.gemspec +34 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 16ad942c9d54c4e9a2d6e720027b9e598dec990c
|
4
|
+
data.tar.gz: 1139b66523a216971c46f54dc1b2dfb0724688d1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ca725460da46c1670ecff304ceee4d3f56366638caeff9b869e08d12b9f7b08cf5f00cf85d50dd08003a75609e180e76e1084114b0452851a0c6817ec21e71ae
|
7
|
+
data.tar.gz: ad5909ed88918e0ce15644badd76cbe470342398e2baf414dc8d7824685fbf8adaa30195c248b7cc6e45c885cd87536587b627a1f4bcf0f9c0dc4e8b71590516
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 2.3.1
|
5
|
+
before_install:
|
6
|
+
- gem install bundler -v 1.12.3
|
7
|
+
- gem install rubocop -v 0.40.0
|
8
|
+
- git config --global user.name "Your Name"
|
9
|
+
- git config --global user.email "you@example.com"
|
10
|
+
script:
|
11
|
+
- rubocop .
|
12
|
+
- bundle exec rspec spec
|
13
|
+
- rake build
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at lucianopcbr@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Luciano
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Lookfile [](https://travis-ci.org/LucianoPC/lookfile) [](https://codeclimate.com/github/LucianoPC/lookfile)
|
2
|
+
|
3
|
+
Version files usage on day-to-day can be cansative and exaustive, mainly
|
4
|
+
because that files are on diferent folders, and group there it's a hard
|
5
|
+
work, therefore, the people does not can version that file. With this gem
|
6
|
+
it's can change, because this gem can group all files that you need in
|
7
|
+
a repository, and version all these files with a single command.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'lookfile'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install lookfile
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
lookfile [option]
|
28
|
+
|
29
|
+
[options]
|
30
|
+
|
31
|
+
init $ lookfile init
|
32
|
+
- Initialize lookfile configurations
|
33
|
+
|
34
|
+
add $ lookfile add [file 0] [file 1] ... [file n]
|
35
|
+
- Add files to lookfile
|
36
|
+
|
37
|
+
update $ lookfile update
|
38
|
+
- Update files to lookfile and push to repository
|
39
|
+
|
40
|
+
setrepo $ lookfile setrepo [repository_ssh]
|
41
|
+
- Set lookfile repository to save files
|
42
|
+
- repository_ssh: link ssh to repository
|
43
|
+
|
44
|
+
|
45
|
+
## Development
|
46
|
+
|
47
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then,
|
48
|
+
run `rake spec` to run the tests. You can also run `bin/console` for an
|
49
|
+
interactive prompt that will allow you to experiment.
|
50
|
+
|
51
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
52
|
+
To release a new version, update the version number in `version.rb`, and then
|
53
|
+
run `bundle exec rake release`, which will create a git tag for the version,
|
54
|
+
push git commits and tags, and push the `.gem` file to
|
55
|
+
[rubygems.org](https://rubygems.org).
|
56
|
+
|
57
|
+
## Contributing
|
58
|
+
|
59
|
+
Bug reports and pull requests are welcome on GitHub at
|
60
|
+
https://github.com/[USERNAME]/lookfile. This project is intended to be a
|
61
|
+
safe, welcoming space for collaboration, and contributors are expected to
|
62
|
+
adhere to the [Contributor Covenant](http://contributor-covenant.org)
|
63
|
+
code of conduct.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'lookfile'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require 'pry'
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/lookfile
ADDED
data/bin/setup
ADDED
data/lib/command.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# Abstract class with definitions of commands
|
2
|
+
class Command
|
3
|
+
def self.options_messages
|
4
|
+
raise 'return a list with how to use this command'
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.command_name
|
8
|
+
raise 'return the command name'
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.run(argv)
|
12
|
+
run_childrens(argv)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.parent
|
16
|
+
raise 'return the parent command'
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.childrens
|
20
|
+
raise 'return the childrens commands'
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.childrens?
|
24
|
+
!childrens.empty?
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.run_childrens(argv)
|
28
|
+
children_command = argv.first
|
29
|
+
children = childrens.detect { |c| c.command_name == children_command }
|
30
|
+
return usage unless children
|
31
|
+
|
32
|
+
argv.delete(children.command_name)
|
33
|
+
children.run(argv)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.usage
|
37
|
+
usage_message = usage_header
|
38
|
+
usage_message += "\n\n[options]\n"
|
39
|
+
|
40
|
+
childrens.each do |command|
|
41
|
+
messages = command.options_messages
|
42
|
+
messages = [messages] unless messages.is_a?(Array)
|
43
|
+
|
44
|
+
messages.each do |message|
|
45
|
+
usage_message += "\n#{message}" if message
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
puts usage_message
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.usage_header
|
53
|
+
header = ''
|
54
|
+
header += '[option]' if childrens?
|
55
|
+
header = "#{command_name} " + header
|
56
|
+
|
57
|
+
parent = self.parent
|
58
|
+
until parent.nil?
|
59
|
+
header = "#{parent.command_name} " + header
|
60
|
+
parent = parent.parent
|
61
|
+
end
|
62
|
+
|
63
|
+
header = '$ ' + header
|
64
|
+
header
|
65
|
+
end
|
66
|
+
end
|
data/lib/commands/add.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'command'
|
2
|
+
require 'commands/look'
|
3
|
+
|
4
|
+
require 'lookfile'
|
5
|
+
|
6
|
+
# Command 'lookfile add' implementation
|
7
|
+
class Add < Command
|
8
|
+
def self.options_messages
|
9
|
+
%( add \t\t $ lookfile add [file 0] [file 1] ... [file n]
|
10
|
+
\t\t - Add files to lookfile
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.command_name
|
15
|
+
'add'
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.parent
|
19
|
+
Look
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.run(argv)
|
23
|
+
added_files, error_files = Lookfile.add_files(argv)
|
24
|
+
puts Lookfile.show_files('Added files:', added_files)
|
25
|
+
puts Lookfile.show_files('Error to add files, check if exists:',
|
26
|
+
error_files)
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'command'
|
2
|
+
require 'commands/look'
|
3
|
+
|
4
|
+
require 'lookfile'
|
5
|
+
|
6
|
+
# Command 'lookfile init' implementation
|
7
|
+
class Init < Command
|
8
|
+
def self.options_messages
|
9
|
+
%( init \t\t $ lookfile init
|
10
|
+
\t\t - Initialize lookfile configurations
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.command_name
|
15
|
+
'init'
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.parent
|
19
|
+
Look
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.run(*)
|
23
|
+
dir = Lookfile.initialize
|
24
|
+
if dir
|
25
|
+
puts "Initialize lookfile on: #{dir}"
|
26
|
+
else
|
27
|
+
puts 'lookfile was already initialized'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'command'
|
2
|
+
require 'commands/init'
|
3
|
+
require 'commands/add'
|
4
|
+
require 'commands/set_repository'
|
5
|
+
require 'commands/update'
|
6
|
+
|
7
|
+
# Command 'lookfile' implementation
|
8
|
+
class Look < Command
|
9
|
+
def self.options_messages
|
10
|
+
''
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.command_name
|
14
|
+
'lookfile'
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.parent
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.childrens
|
22
|
+
[Init, Add, Update, SetRepository]
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'command'
|
2
|
+
require 'commands/look'
|
3
|
+
|
4
|
+
require 'lookfile'
|
5
|
+
|
6
|
+
# Command 'lookfile init' implementation
|
7
|
+
class SetRepository < Command
|
8
|
+
def self.options_messages
|
9
|
+
%( setrepo \t $ lookfile setrepo [repository_ssh]
|
10
|
+
\t\t - Set lookfile repository to save files
|
11
|
+
\t\t - repository_ssh: link ssh to repository
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.command_name
|
16
|
+
'setrepo'
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.parent
|
20
|
+
Look
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.run(argv)
|
24
|
+
repository_ssh_name = argv.first
|
25
|
+
Lookfile.set_repository(repository_ssh_name)
|
26
|
+
puts "Setted repository to: #{repository_ssh_name}"
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'command'
|
2
|
+
require 'commands/look'
|
3
|
+
|
4
|
+
require 'lookfile'
|
5
|
+
|
6
|
+
# Command 'lookfile update' implementation
|
7
|
+
class Update < Command
|
8
|
+
def self.options_messages
|
9
|
+
%( update \t $ lookfile update
|
10
|
+
\t\t - Update files to lookfile and push to repository
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.command_name
|
15
|
+
'update'
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.parent
|
19
|
+
Look
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.run(*)
|
23
|
+
message = Lookfile.update
|
24
|
+
puts message
|
25
|
+
end
|
26
|
+
end
|
data/lib/git.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'lookfile'
|
3
|
+
|
4
|
+
# module for help with git
|
5
|
+
module Git
|
6
|
+
module_function
|
7
|
+
|
8
|
+
BASE_DIR = '~/'.freeze
|
9
|
+
LOOKFILE_DIR = '.lookfile'.freeze
|
10
|
+
|
11
|
+
def load_git_command(base_dir = BASE_DIR)
|
12
|
+
directory = Lookfile.load_lookfile_dir(base_dir)
|
13
|
+
"git -C '#{directory}'"
|
14
|
+
end
|
15
|
+
|
16
|
+
def init(base_dir = BASE_DIR)
|
17
|
+
git = load_git_command(base_dir)
|
18
|
+
`#{git} init`
|
19
|
+
end
|
20
|
+
|
21
|
+
def remote?(base_dir = BASE_DIR)
|
22
|
+
git = load_git_command(base_dir)
|
23
|
+
remote = `#{git} remote`
|
24
|
+
remote.include?('origin')
|
25
|
+
end
|
26
|
+
|
27
|
+
def set_remote(repository_ssh_name, base_dir = BASE_DIR)
|
28
|
+
git = load_git_command(base_dir)
|
29
|
+
`#{git} remote remove origin` if remote?(base_dir)
|
30
|
+
`#{git} remote add origin #{repository_ssh_name}`
|
31
|
+
end
|
32
|
+
|
33
|
+
def rebase(base_dir = BASE_DIR)
|
34
|
+
git = load_git_command(base_dir)
|
35
|
+
branchs = `#{git} branch -a`
|
36
|
+
return nil unless branchs.include?('remotes/origin/master')
|
37
|
+
`#{git} fetch origin -p`
|
38
|
+
`#{git} pull origin master`
|
39
|
+
end
|
40
|
+
|
41
|
+
def commit(base_dir = BASE_DIR)
|
42
|
+
git = load_git_command(base_dir)
|
43
|
+
untracked_files = `#{git} ls-files --others --exclude-standard`.split
|
44
|
+
deleted_files = `#{git} ls-files --deleted`.split
|
45
|
+
modified_files = `#{git} ls-files --modified`.split - deleted_files
|
46
|
+
`#{git} add --all`
|
47
|
+
message = Lookfile.show_files("\nAdded files:", untracked_files)
|
48
|
+
message += Lookfile.show_files("\nModified files:", modified_files)
|
49
|
+
message += Lookfile.show_files("\nDeleted files:", deleted_files)
|
50
|
+
return nil unless make_commit?(message, base_dir)
|
51
|
+
message
|
52
|
+
end
|
53
|
+
|
54
|
+
def push(base_dir = BASE_DIR)
|
55
|
+
git = load_git_command(base_dir)
|
56
|
+
`#{git} push origin master`
|
57
|
+
end
|
58
|
+
|
59
|
+
def make_commit?(message, base_dir = BASE_DIR)
|
60
|
+
git = load_git_command(base_dir)
|
61
|
+
commit = `#{git} commit -m "#{message}"`
|
62
|
+
return false if commit.include?('nothing to commit')
|
63
|
+
true
|
64
|
+
end
|
65
|
+
end
|
data/lib/lookfile.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'lookfile/version'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'git'
|
4
|
+
|
5
|
+
# main module of lookfile gem
|
6
|
+
module Lookfile
|
7
|
+
module_function
|
8
|
+
|
9
|
+
BASE_DIR = '~/'.freeze
|
10
|
+
LOOKFILE_DIR = '.lookfile'.freeze
|
11
|
+
|
12
|
+
def initialize(base_dir = BASE_DIR)
|
13
|
+
lookfile_dir = load_lookfile_dir(base_dir)
|
14
|
+
return nil if File.directory?(lookfile_dir)
|
15
|
+
Dir.mkdir(lookfile_dir)
|
16
|
+
Git.init(base_dir)
|
17
|
+
lookfile_dir
|
18
|
+
end
|
19
|
+
|
20
|
+
def add_files(files_path, base_dir = BASE_DIR)
|
21
|
+
files_path = [files_path] unless files_path.is_a?(Array)
|
22
|
+
files_path = files_path.map { |file_path| File.expand_path(file_path) }
|
23
|
+
added_files = []
|
24
|
+
error_files = []
|
25
|
+
files_path.each do |file_path|
|
26
|
+
list = add_one_file(file_path, base_dir) ? added_files : error_files
|
27
|
+
list << file_path
|
28
|
+
end
|
29
|
+
[added_files, error_files]
|
30
|
+
end
|
31
|
+
|
32
|
+
def set_repository(repository_ssh_name, base_dir = BASE_DIR)
|
33
|
+
Git.set_remote(repository_ssh_name, base_dir)
|
34
|
+
Git.rebase(base_dir)
|
35
|
+
end
|
36
|
+
|
37
|
+
def update(base_dir = BASE_DIR)
|
38
|
+
update_files(base_dir)
|
39
|
+
message = Git.commit(base_dir)
|
40
|
+
return 'Nothing to update' if message.nil?
|
41
|
+
Git.push(base_dir) if Git.remote?(base_dir)
|
42
|
+
message
|
43
|
+
end
|
44
|
+
|
45
|
+
def add_one_file(file_path, base_dir = BASE_DIR)
|
46
|
+
lookfile_dir = load_lookfile_dir(base_dir)
|
47
|
+
folder_path = lookfile_dir + file_path.scan(%r{(.+)\/}).flatten.first
|
48
|
+
FileUtils.mkpath(folder_path)
|
49
|
+
begin
|
50
|
+
FileUtils.cp(file_path, folder_path)
|
51
|
+
true
|
52
|
+
rescue
|
53
|
+
false
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def show_files(header_message, files_path)
|
58
|
+
message = header_message.to_s unless files_path.empty?
|
59
|
+
files_path.each do |file_path|
|
60
|
+
message += "\n #{file_path}"
|
61
|
+
end
|
62
|
+
message ||= ''
|
63
|
+
message
|
64
|
+
end
|
65
|
+
|
66
|
+
def load_lookfile_dir(base_dir = BASE_DIR)
|
67
|
+
base_dir = File.expand_path(base_dir)
|
68
|
+
base_dir += '/' if base_dir[-1] != '/'
|
69
|
+
base_dir + LOOKFILE_DIR
|
70
|
+
end
|
71
|
+
|
72
|
+
def update_files(base_dir = BASE_DIR)
|
73
|
+
lookfile_dir = load_lookfile_dir(base_dir)
|
74
|
+
files_regex = %r{^#{lookfile_dir}(?!\/.git)(.+)$}
|
75
|
+
files_path = `find #{lookfile_dir} -type f`.scan(files_regex).flatten
|
76
|
+
add_files(files_path, base_dir)
|
77
|
+
end
|
78
|
+
end
|
data/lookfile.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lookfile/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'lookfile'
|
8
|
+
spec.version = Lookfile::VERSION
|
9
|
+
spec.authors = ['Luciano Prestes Cavalcanti']
|
10
|
+
spec.email = ['lucianopcbr@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'Version all files that you need'
|
13
|
+
spec.description = 'Version files usage on day-to-day can be cansative ' \
|
14
|
+
'and exaustive, mainly because that files are on ' \
|
15
|
+
"diferent folders, and group there it's a hard work " \
|
16
|
+
'therefore, the people does not can version that ' \
|
17
|
+
"file. With this gem it's can change, because this " \
|
18
|
+
'gem can group all files that you need in a ' \
|
19
|
+
'repository, and version all these files with a ' \
|
20
|
+
'single command.'
|
21
|
+
spec.homepage = 'https://github.com/LucianoPC/lookfile'
|
22
|
+
spec.license = 'MIT'
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
25
|
+
f.match(%r{^(test|spec|features)/})
|
26
|
+
end
|
27
|
+
spec.bindir = 'bin'
|
28
|
+
spec.executables << 'lookfile'
|
29
|
+
spec.require_paths = ['lib']
|
30
|
+
|
31
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
32
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lookfile
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Luciano Prestes Cavalcanti
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Version files usage on day-to-day can be cansative and exaustive, mainly
|
56
|
+
because that files are on diferent folders, and group there it's a hard work therefore,
|
57
|
+
the people does not can version that file. With this gem it's can change, because
|
58
|
+
this gem can group all files that you need in a repository, and version all these
|
59
|
+
files with a single command.
|
60
|
+
email:
|
61
|
+
- lucianopcbr@gmail.com
|
62
|
+
executables:
|
63
|
+
- lookfile
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files: []
|
66
|
+
files:
|
67
|
+
- ".gitignore"
|
68
|
+
- ".rspec"
|
69
|
+
- ".travis.yml"
|
70
|
+
- CODE_OF_CONDUCT.md
|
71
|
+
- Gemfile
|
72
|
+
- LICENSE
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- bin/console
|
76
|
+
- bin/lookfile
|
77
|
+
- bin/setup
|
78
|
+
- lib/command.rb
|
79
|
+
- lib/commands/add.rb
|
80
|
+
- lib/commands/init.rb
|
81
|
+
- lib/commands/look.rb
|
82
|
+
- lib/commands/set_repository.rb
|
83
|
+
- lib/commands/update.rb
|
84
|
+
- lib/git.rb
|
85
|
+
- lib/lookfile.rb
|
86
|
+
- lib/lookfile/version.rb
|
87
|
+
- lookfile.gemspec
|
88
|
+
homepage: https://github.com/LucianoPC/lookfile
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.5.1
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Version all files that you need
|
112
|
+
test_files: []
|