sbag 0.2.2 → 2.2.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 +4 -4
- data/lib/sbag.rb +117 -0
- data/lib/sbag/version.rb +1 -1
- data/sbag.gemspec +2 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0157498ab505430d1a74494e83d4685ac9f6c28c
|
4
|
+
data.tar.gz: 5e4a919d138c6a3babec530fa5bad6a42a43b471
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2e347e7e8cd53366e314430bba8ae0c0832721bc2c59ae87444234921fd2cac81a08eba39623f2f8b474f35a293d270cdc8c83f17ea2e58ab908d64d947669b
|
7
|
+
data.tar.gz: 55fb54c1a9100535ce6866a106eb2f5d15176dc22a318f64c463ff7e614b0980e5aadac23481a381a1f41f402939c44b75229b64867050063c0d8bf84a29f6a8
|
data/lib/sbag.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require "sbag/version"
|
2
2
|
require 'thor'
|
3
3
|
require "colorize"
|
4
|
+
require "MDownloader"
|
5
|
+
require "fileutils"
|
6
|
+
|
4
7
|
module Sbag
|
5
8
|
|
6
9
|
class C < Thor
|
@@ -13,6 +16,7 @@ method_option :newfile, :aliases => "-c" , :desc => "Use newfile command to crea
|
|
13
16
|
puts "New file created => *#{file}*".green
|
14
17
|
end
|
15
18
|
#========================END===============================#
|
19
|
+
|
16
20
|
#Delete File Command =====================================>>>
|
17
21
|
desc "delfile", "Delete the existing file"
|
18
22
|
method_option :delfile, :aliases => "-d", :desc => "Use delfile command to delete existing file. Usage: [file_name].[file_extension]"
|
@@ -22,6 +26,7 @@ method_option :delfile, :aliases => "-d", :desc => "Use delfile command to delet
|
|
22
26
|
puts "Existing file deleted => *#{file}*".green
|
23
27
|
end
|
24
28
|
#========================END===============================#
|
29
|
+
|
25
30
|
#Time Display Command =====================================>>>
|
26
31
|
desc "time" , "Display current time"
|
27
32
|
method_option :time, :aliases => "-t", :desc => "Use time command to display the current time"
|
@@ -31,6 +36,7 @@ method_option :time, :aliases => "-t", :desc => "Use time command to display the
|
|
31
36
|
puts "Current time => *#{time}*".green
|
32
37
|
end
|
33
38
|
#========================END===============================#
|
39
|
+
|
34
40
|
#Current Location Command =====================================>>>
|
35
41
|
desc "locate", "Current directory or folder path"
|
36
42
|
method_option :locate, :aliases => "-loc", :desc => "Use locate command to find the current directory or folder path"
|
@@ -40,6 +46,7 @@ method_option :locate, :aliases => "-loc", :desc => "Use locate command to find
|
|
40
46
|
puts "Current Location => *#{location}*".green
|
41
47
|
end
|
42
48
|
#========================END===============================#
|
49
|
+
|
43
50
|
#Make new Directory Command =====================================>>>
|
44
51
|
desc "newdir", "Create a new directory or folder"
|
45
52
|
method_option :newdir, :aliases => "-nd", :desc => "Use newdir command to create a new directory or folder in the current path"
|
@@ -50,6 +57,7 @@ method_option :newdir, :aliases => "-nd", :desc => "Use newdir command to create
|
|
50
57
|
puts "New Directory created => *#{new_dir}* at *#{location}*".green
|
51
58
|
end
|
52
59
|
#========================END===============================#
|
60
|
+
|
53
61
|
#Directory Listing Command =====================================>>>
|
54
62
|
desc "entries", "Files and directory Listing Command"
|
55
63
|
method_option :entries, :aliases => "-entries", :desc => "Use entries command to list all the files and directories in current path"
|
@@ -59,6 +67,7 @@ method_option :entries, :aliases => "-entries", :desc => "Use entries command to
|
|
59
67
|
puts "#{location}".green
|
60
68
|
end
|
61
69
|
#========================END===============================#
|
70
|
+
|
62
71
|
#Delete Directory Command =====================================>>>
|
63
72
|
desc "deldir", "Delete directory or folder Command"
|
64
73
|
method_option :deldir, :aliases => "-ddir", :desc => "Use deldir command to delete the folder and directory in current path"
|
@@ -68,5 +77,113 @@ method_option :deldir, :aliases => "-ddir", :desc => "Use deldir command to dele
|
|
68
77
|
puts "Deleted directory => *#{del_dir}*".green
|
69
78
|
end
|
70
79
|
#========================END===============================#
|
80
|
+
|
81
|
+
# start command Starts===================================>>>
|
82
|
+
desc "start" ,"Initialize empty Kit depository in the current project folder"
|
83
|
+
|
84
|
+
method_option :start, :aliases => "-start" , :desc => "Use kit init command to make a directory of content in Kit depository. You can do this in any directory at any time, completelylocally."
|
85
|
+
|
86
|
+
def start(new_depository = 'kit')
|
87
|
+
|
88
|
+
if Dir.exist?('kit') == true
|
89
|
+
|
90
|
+
puts "Depository *Kit* already exists!!! Please use add command to continue working on your project. Start command can be used only once.".red
|
91
|
+
|
92
|
+
else
|
93
|
+
|
94
|
+
Dir.mkdir("#{new_depository}")
|
95
|
+
location = Dir.pwd
|
96
|
+
puts "Depository *Kit* intialized for your project at *#{location}*".green
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
# init command Ends===================================>>>
|
102
|
+
|
103
|
+
# clone command Starts=================================>>>
|
104
|
+
desc "clone", "Copy the project on which you want to work"
|
105
|
+
|
106
|
+
method_option :clone , :alises => "-clone" , :desc => "Use the kit clone [URL] command with URL of the project you want to copy."
|
107
|
+
|
108
|
+
def clone(url)
|
109
|
+
|
110
|
+
array_url = url.split('/')
|
111
|
+
puts array_url.last
|
112
|
+
location = Dir.pwd
|
113
|
+
path = location.to_s + "/#{array_url.last}"
|
114
|
+
options = Hash.new
|
115
|
+
options[:retry] = :any #retry times, :any(any times retry), 0(no retry), or custom numbers(int)
|
116
|
+
options[:resume] = true #true or false, resume continue download, break point resume download
|
117
|
+
|
118
|
+
result, error = MDownloader.download(url, path, options) do |report|
|
119
|
+
puts "Progress:#{report[:percent]}% Cloning:#{report[:min]} #{url} #{report[:sec]}"
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
if result
|
124
|
+
|
125
|
+
puts 'Cloning Finished!'
|
126
|
+
|
127
|
+
else
|
128
|
+
|
129
|
+
puts 'Error in cloning #{url}'
|
130
|
+
puts error
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
# clone command Ends=====================================>>>
|
136
|
+
|
137
|
+
# add command Starts=====================================>>>
|
138
|
+
desc "add" ,"Add file contents to your project before you can make them. Usage : add [version number] Eg: add 1.0.1"
|
139
|
+
|
140
|
+
method_option :add , :alises => "-add", :desc => "Use the kit add command to intially add the file to your current project, but even if the file is already tracked"
|
141
|
+
|
142
|
+
def add(version)
|
143
|
+
source = FileUtils.pwd()
|
144
|
+
dir_last = source.split("/")
|
145
|
+
current_dir = dir_last.last
|
146
|
+
structure_data = Dir["**/*"]
|
147
|
+
data = Dir["*"]
|
148
|
+
data.delete("kit")
|
149
|
+
puts "-------- Process for adding Kit started --------"
|
150
|
+
puts "Checking current depository files ==============>"
|
151
|
+
puts structure_data
|
152
|
+
puts "-------- Checking completed --------"
|
153
|
+
|
154
|
+
if Dir.exist?("kit") == false
|
155
|
+
puts "Kit depository not found!!! Use start command first.".red
|
156
|
+
else
|
157
|
+
|
158
|
+
Dir.chdir "kit"
|
159
|
+
changed_dir = FileUtils.pwd()
|
160
|
+
|
161
|
+
if Dir.exist?("v#{version}") == true
|
162
|
+
puts "Kit *v#{version}* already exists!!! Please increment the version."
|
163
|
+
else
|
164
|
+
Dir.mkdir("v#{version}")
|
165
|
+
destination = changed_dir + "/v#{version}"
|
166
|
+
Dir.chdir(destination)
|
167
|
+
|
168
|
+
structure_file = "structure.txt"
|
169
|
+
File.new("#{structure_file}", "w+")
|
170
|
+
File.open("#{structure_file}","w") do |f|
|
171
|
+
|
172
|
+
structure_data.each do |ch|
|
173
|
+
|
174
|
+
f.write("#{ch}\n")
|
175
|
+
|
176
|
+
end
|
177
|
+
|
178
|
+
end
|
179
|
+
puts "Structure.txt file created successfully".yellow
|
180
|
+
Dir.chdir(source)
|
181
|
+
|
182
|
+
puts "Adding Kit for your Depository with v#{version} completed successfully.".green
|
183
|
+
FileUtils.cp_r data, destination
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
# add command Ends=======================================>>>
|
71
188
|
end
|
72
189
|
end
|
data/lib/sbag/version.rb
CHANGED
data/sbag.gemspec
CHANGED
@@ -24,7 +24,8 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_dependency 'thor', "~>0.19.1"
|
26
26
|
spec.add_dependency 'colorize', "~>0.7.5"
|
27
|
-
|
27
|
+
spec.add_dependency 'MDownloader'
|
28
|
+
|
28
29
|
spec.add_development_dependency "bundler", "~> 1.8"
|
29
30
|
spec.add_development_dependency "rake", "~>10.4.2"
|
30
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sbag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shubham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.7.5
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: MDownloader
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|