desktop-boom 0.3.0 → 0.4.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/boom +78 -0
  3. data/lib/boom/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd8dab305f791bf40d2f3a977ee742576070cee3
4
- data.tar.gz: cac3af03a8f2b2f1a783ce87c41deef5cb43ca7a
3
+ metadata.gz: 15dca0c7b23ef97d864a6b9f51a2c0a3d5227902
4
+ data.tar.gz: 3eb45bd240fc9676b6e7c6dc99e53f35d8f5cf02
5
5
  SHA512:
6
- metadata.gz: 88629d36b73974e4a520e63ab95b6037a23c025e2cd30a61e2d2a8fd7e39d6c668a537b662f34409ec358d6c5f94b3d39abbd0a11a64dd1f08930ca66e25b451
7
- data.tar.gz: b763052e70df7f3d256584ba1756ce794f47cbbdfe820d778e977a2b3d4a42b2084d96bc1b6d6d53df71852f86340f20f1f3cf410ccd44eb0beeb574a54cf0e7
6
+ metadata.gz: 8db873b51bf32ef6a36c5ea00087433d3373d06fc50f552e55933df34fa5102ed68df8b54e864108341947a0e5f76b2694424083e8051ad10fcb380f3b4bdc2a
7
+ data.tar.gz: 4bc3d0f18a1bc8d8e8ff0adcded204effa60714381991b80782283cb59ac1ffa2e00664e792345d99229f8d07c379b94d24d7314dd7a3199b41f286eb99b2587
data/bin/boom CHANGED
@@ -71,6 +71,10 @@ command :switch do |c|
71
71
  doesn't exist, it will be created:
72
72
 
73
73
  #{APP_NAME} <project name>
74
+
75
+ or for help:
76
+
77
+ #{APP_NAME} --help
74
78
  " and abort if args.empty?
75
79
  new_project = args[0]
76
80
  create_configuration_file unless File.file? config_path
@@ -149,6 +153,30 @@ command :rename do |c|
149
153
  end
150
154
  end
151
155
 
156
+ command :browse do |c|
157
+ c.syntax = "#{APP_NAME} browse [<project name>]"
158
+ c.summary = 'Browse project(s) directory'
159
+ c.description = c.summary
160
+ c.example 'Run command', "$ #{APP_NAME} browse [<project name>]"
161
+ c.action do |args, options|
162
+ say_error "Specify at most 1 project name
163
+ $ #{APP_NAME} browse [<project name>]
164
+ " and abort unless args.empty? || args.size == 1
165
+ with_config do |mapping, projects_directory, current_project|
166
+ project = args[0]
167
+ if project
168
+ if current_project == project
169
+ `open "#{File.expand_path(project, DESKTOP_DIR)}"`
170
+ else
171
+ `open "#{File.expand_path(project, projects_directory)}"`
172
+ end
173
+ else
174
+ `open "#{File.expand_path(projects_directory)}"`
175
+ end
176
+ end
177
+ end
178
+ end
179
+
152
180
  command :close do |c|
153
181
  c.syntax = "#{APP_NAME} close"
154
182
  c.summary = 'Close current project'
@@ -164,6 +192,56 @@ command :close do |c|
164
192
  end
165
193
  end
166
194
 
195
+ command :move do |c|
196
+ c.syntax = "#{APP_NAME} move"
197
+ c.summary = 'Move file(s)/folders(s) in current project to another projects'
198
+ c.description = c.summary
199
+ c.example 'Run command', "$ #{APP_NAME} move <source file/folder> ... <project name>"
200
+ c.action do |args, options|
201
+ say_error "Specify the name(s) of the file(s)/folders(s) in the current project
202
+ which you want to move and the project to move to
203
+
204
+ #{APP_NAME} move <source file/folder> ... <project name>
205
+
206
+ or for help:
207
+
208
+ #{APP_NAME} --help
209
+ " and abort if args.size < 2
210
+ target_project = args.last
211
+ sources = args.first(args.size-1)
212
+ create_configuration_file unless File.file? config_path
213
+ with_config do |mapping, projects_directory, current_project|
214
+ if !current_project || current_project.empty?
215
+ say_error "No open project" and abort
216
+ break
217
+ end
218
+ unless (projects + [current_project]).include? target_project
219
+ say_error "Project does not exist: `#{target_project}`" and abort
220
+ break
221
+ end
222
+ if target_project == current_project
223
+ say "Already at project '#{current_project}'"
224
+ break
225
+ end
226
+ if target_project == current_project
227
+ say "Already at project '#{current_project}'"
228
+ break
229
+ end
230
+ source_not_found = sources.find {|e|
231
+ exist = File.exists?(File.expand_path(e, DESKTOP_DIR))
232
+ !exist
233
+ }
234
+ say_error "Item is not in current project: `#{source_not_found}`" and abort if source_not_found
235
+ destination_dup = sources.find {|e|
236
+ exist = File.exists?(File.expand_path(e, File.expand_path(target_project, projects_directory)))
237
+ exist
238
+ }
239
+ say_error "There is already an item with the name: `#{destination_dup}` in the project `target_project`" and abort if destination_dup
240
+ sources.each {|e| FileUtils.mv(File.expand_path(e, DESKTOP_DIR), File.expand_path(target_project, projects_directory)) }
241
+ end
242
+ end
243
+ end
244
+
167
245
  def create_configuration_file
168
246
  write_configuration(nil)
169
247
  end
@@ -1,3 +1,3 @@
1
1
  module DesktopBoom
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: desktop-boom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hwee-Boon Yar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-20 00:00:00.000000000 Z
11
+ date: 2016-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander