desktop-boom 0.1.0 → 0.1.1

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 +39 -2
  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: 37d7612174f483b10ab7e6daae61a2e670d88994
4
- data.tar.gz: 64edf7e95895b2bad708e077ef811fb69e5aa03d
3
+ metadata.gz: 5b5a72ed2ea65b432a037b97d4626ea3165ea89f
4
+ data.tar.gz: 3097c1e433946b9d5b987bbee3071ee2e7bf29f0
5
5
  SHA512:
6
- metadata.gz: 862199945e542d6c6df102d8a023e2b0ec0f1de0eaca1c40ad7cda05f963e3f5ef61dd9270d2a69dc7f5db80095dadf6536372d54b78c2bc928eb0179b3daf4d
7
- data.tar.gz: 87a36e6d4fa17a598049c67c1a9001dbe0c402f96ea99d5a0c6b3261568cff92790a3825396c9ee854d7b81c2c0477e21a96325e2211872fe895b35d9989a414
6
+ metadata.gz: 5929abd50810d015ccfd514050d46a7cfdffde264c152fc44be80eff3d7dda4d4b7da6b51854f5d5e0980ac0310463ec08faea401e5ebc473837808778f2ad87
7
+ data.tar.gz: eed0714413941c63b19a7d259cf1971a9debc12edb5cc7b5f615a75be65653b2f8b0c7c7508d46ae84515f9f426b131ea9001368c87cf695074ae756aec3d19f
data/bin/boom CHANGED
@@ -11,7 +11,7 @@ APP_NAME = 'boom'
11
11
  DESKTOP_DIR = File.expand_path('~/Desktop/')
12
12
  #TODO make configurable?
13
13
  PROJECTS_DIRECTORY = "~/Documents/#{APP_NAME}/"
14
- HELP_STRING = "#{APP_NAME} helps maintain your OS X desktop. Use APP_NAME so that your desktop
14
+ HELP_STRING = "#{APP_NAME} helps maintain your OS X desktop. Use #{APP_NAME} so that your desktop
15
15
  only contains files and folders for the current project you are
16
16
  working on.
17
17
 
@@ -22,7 +22,7 @@ later by #{APP_NAME} again.
22
22
  Assuming you are current working on project `A`, to switch to the
23
23
  project called `B`, run
24
24
 
25
- $ APP_NAME B
25
+ $ #{APP_NAME} B
26
26
 
27
27
  Files and folders in the desktop will be moved away and tagged as
28
28
  belonging to project `A` and the files and folders for project `B`
@@ -120,6 +120,43 @@ command :list do |c|
120
120
  end
121
121
  end
122
122
 
123
+ command :rename do |c|
124
+ c.syntax = "#{APP_NAME} rename"
125
+ c.summary = 'Rename project'
126
+ c.description = c.summary
127
+ c.example 'Run command', "$ #{APP_NAME} rename <source> <target>"
128
+ c.action do |args, options|
129
+ puts "args: #{args}"
130
+ say_error "You must specify both the original project name and the new project name
131
+ $ #{APP_NAME} B
132
+ " and abort unless args.size == 2
133
+ File.open(config_path) do |f|
134
+ mapping = Psych.load(f.read)
135
+ projects_directory = mapping['projects_directory']
136
+ current_project = mapping['current_project']
137
+ projects = Dir.entries(File.expand_path(projects_directory)).reject {|e| e == '.' || e == '..' || !File.directory?(File.expand_path(e, projects_directory))}
138
+ source = args[0]
139
+ destination = args[1]
140
+ puts "current project: #{current_project}"
141
+ puts "projects: #{projects}"
142
+ puts "rename #{source} -> #{destination}"
143
+ #kkk check if source does not exist
144
+ say_error "Project does not exist: `#{source}`" and abort unless (projects + [current_project]).include? source
145
+ #kkk check if clash
146
+ say_error "There is an existing project with the name: `#{destination}`" and abort if (projects + [current_project]).include? destination
147
+ if current_project == source
148
+ say "rename current"
149
+ #kkk rename current
150
+ #switch_to(mapping, destination)
151
+ else
152
+ say "rename not current"
153
+ #kkk rename not current
154
+ #FileUtils.mv(File.expand_path(source, projects_directory), File.expand_path(destination, projects_directory))
155
+ end
156
+ end
157
+ end
158
+ end
159
+
123
160
  def create_configuration_file
124
161
  write_configuration(nil)
125
162
  end
@@ -1,3 +1,3 @@
1
1
  module DesktopBoom
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
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.1.0
4
+ version: 0.1.1
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-15 00:00:00.000000000 Z
11
+ date: 2016-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander