lookfile 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e81295ad028f562c07f5de7aca606ea1f8063f30
4
- data.tar.gz: 892e0d1b304818d8ae5f31f8b69377cee5d09569
3
+ metadata.gz: aaf6dabdfc5e632a80a8ffb6a0e6d4b75b6653d4
4
+ data.tar.gz: 932108b2dca284607f1ca8f5d15a8f9f018f9f64
5
5
  SHA512:
6
- metadata.gz: e4c79c99dca630ff7e4216da129d4649f9678e1b78d36a174c2e717d2f38093ae0cc2fd43154677bfee5f96ede337f9c8780932f904b6194d4386114228be16e
7
- data.tar.gz: 3d1200d46d34761c15c2610d3292641e13051e7f5bbeae4508bd0d436a61904d0bde4202467af08af2663c8eec47c8262822ae71376b81e7b8c0462a0feb9789
6
+ metadata.gz: 9f446a1d71a35405d5b6b6eb917454891cf6cc694fbb5173855afbc372ff91f79bff5f601d1349d7215059bab079cfb38ec938208430bd304180e22e33d001af
7
+ data.tar.gz: ee7293dfb6f86c44de310207eb307e4975582641c61bf3c528f161ac92b0e3888fc45e9dca65ea5f128e20f8d7078215a4a34a2330ebb98a26af6c8232631b16
data/lib/commands/look.rb CHANGED
@@ -2,8 +2,9 @@ require 'command'
2
2
  require 'commands/init'
3
3
  require 'commands/add'
4
4
  require 'commands/set_repository'
5
- require 'commands/update'
5
+ require 'commands/push'
6
6
  require 'commands/show'
7
+ require 'commands/status'
7
8
 
8
9
  # Command 'lookfile' implementation
9
10
  class Look < Command
@@ -20,6 +21,6 @@ class Look < Command
20
21
  end
21
22
 
22
23
  def self.childrens
23
- [Init, Add, Update, Show, SetRepository]
24
+ [Init, Add, Push, Status, Show, SetRepository]
24
25
  end
25
26
  end
@@ -4,15 +4,15 @@ require 'commands/look'
4
4
  require 'lookfile'
5
5
 
6
6
  # Command 'lookfile update' implementation
7
- class Update < Command
7
+ class Push < Command
8
8
  def self.options_messages
9
- %( update \t $ lookfile update
10
- \t\t - Update files to lookfile and push to repository
9
+ %( push \t\t $ lookfile push
10
+ \t\t - Push files on lookfile to repository
11
11
  )
12
12
  end
13
13
 
14
14
  def self.command_name
15
- 'update'
15
+ 'push'
16
16
  end
17
17
 
18
18
  def self.parent
@@ -20,7 +20,7 @@ class Update < Command
20
20
  end
21
21
 
22
22
  def self.run(*)
23
- message = Lookfile.update
23
+ message = Lookfile.push
24
24
  puts message
25
25
  end
26
26
  end
@@ -0,0 +1,25 @@
1
+ require 'command'
2
+ require 'commands/look'
3
+
4
+ require 'lookfile'
5
+
6
+ # Command 'lookfile status' implementation
7
+ class Status < Command
8
+ def self.options_messages
9
+ %( status \t $ lookfile status
10
+ \t\t - Show status of files on lookfile
11
+ )
12
+ end
13
+
14
+ def self.command_name
15
+ 'status'
16
+ end
17
+
18
+ def self.parent
19
+ Look
20
+ end
21
+
22
+ def self.run(*)
23
+ puts Lookfile.status
24
+ end
25
+ end
data/lib/git.rb CHANGED
@@ -38,16 +38,22 @@ module Git
38
38
  `#{git} pull origin master`
39
39
  end
40
40
 
41
- def commit(base_dir = BASE_DIR)
41
+ def status(base_dir = BASE_DIR)
42
42
  git = load_git_command(base_dir)
43
43
  untracked_files = `#{git} ls-files --others --exclude-standard`.split
44
44
  deleted_files = `#{git} ls-files --deleted`.split
45
45
  modified_files = `#{git} ls-files --modified`.split - deleted_files
46
- `#{git} add --all`
47
46
  message = Lookfile.show_files("\nAdded files:", untracked_files)
48
47
  message += Lookfile.show_files("\nModified files:", modified_files)
49
48
  message += Lookfile.show_files("\nDeleted files:", deleted_files)
50
- return nil unless make_commit?(message, base_dir)
49
+ message.strip
50
+ end
51
+
52
+ def commit(base_dir = BASE_DIR)
53
+ git = load_git_command(base_dir)
54
+ message = status(base_dir)
55
+ `#{git} add --all`
56
+ return nil if !make_commit?(message, base_dir) || message.empty?
51
57
  message
52
58
  end
53
59
 
@@ -1,3 +1,3 @@
1
1
  module Lookfile
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
data/lib/lookfile.rb CHANGED
@@ -36,12 +36,12 @@ module Lookfile
36
36
  show_files('Files on lookfile:', files_path)
37
37
  end
38
38
 
39
- def set_repository(repository_ssh_name, base_dir = BASE_DIR)
40
- Git.set_remote(repository_ssh_name, base_dir)
41
- Git.rebase(base_dir)
39
+ def status(base_dir = BASE_DIR)
40
+ update_files(base_dir)
41
+ Git.status(base_dir)
42
42
  end
43
43
 
44
- def update(base_dir = BASE_DIR)
44
+ def push(base_dir = BASE_DIR)
45
45
  update_files(base_dir)
46
46
  message = Git.commit(base_dir)
47
47
  return 'Nothing to update' if message.nil?
@@ -49,6 +49,11 @@ module Lookfile
49
49
  message
50
50
  end
51
51
 
52
+ def set_repository(repository_ssh_name, base_dir = BASE_DIR)
53
+ Git.set_remote(repository_ssh_name, base_dir)
54
+ Git.rebase(base_dir)
55
+ end
56
+
52
57
  def add_one_file(file_path, base_dir = BASE_DIR)
53
58
  lookfile_dir = load_lookfile_dir(base_dir)
54
59
  folder_path = lookfile_dir + file_path.scan(%r{(.+)\/}).flatten.first
data/lookfile.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.description = 'Version files usage on day-to-day can be cansative ' \
14
14
  'and exaustive, mainly because that files are on ' \
15
15
  "diferent folders, and group there it's a hard work " \
16
- ',therefore, the people does not can version that ' \
16
+ ', therefore, the people does not can version that ' \
17
17
  "file. With this gem it's can change, because this " \
18
18
  'gem can group all files that you need in a ' \
19
19
  'repository, and version all these files with a ' \
data/test.rb ADDED
@@ -0,0 +1 @@
1
+ aew modified
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lookfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luciano Prestes Cavalcanti
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
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,
56
+ because that files are on diferent folders, and group there it's a hard work , therefore,
57
57
  the people does not can version that file. With this gem it's can change, because
58
58
  this gem can group all files that you need in a repository, and version all these
59
59
  files with a single command.
@@ -79,13 +79,15 @@ files:
79
79
  - lib/commands/add.rb
80
80
  - lib/commands/init.rb
81
81
  - lib/commands/look.rb
82
+ - lib/commands/push.rb
82
83
  - lib/commands/set_repository.rb
83
84
  - lib/commands/show.rb
84
- - lib/commands/update.rb
85
+ - lib/commands/status.rb
85
86
  - lib/git.rb
86
87
  - lib/lookfile.rb
87
88
  - lib/lookfile/version.rb
88
89
  - lookfile.gemspec
90
+ - test.rb
89
91
  homepage: https://github.com/LucianoPC/lookfile
90
92
  licenses:
91
93
  - MIT