alfred_git 0.2.0 → 0.3.0

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: 762eb870a23c8c3cc6f485a5d1e0448478d592cf
4
- data.tar.gz: 1c51e0761210bdc1f1511d9499a4f1a5a9d1a242
3
+ metadata.gz: 2625773fbf4e725ceb03180ece65ba75401fdb50
4
+ data.tar.gz: cdb43c31a5c7d1e7bd0a9128460599b22aedb8a8
5
5
  SHA512:
6
- metadata.gz: b891a690f28f8e478884fb668dd01b038b2da3ba85de3c872c04e6723bfec0fc8b914637345ff7ce9aad5ea3f70fefb349a5c2f93f9f926618a86917553e8dc6
7
- data.tar.gz: f5fe66028b16c2d5d83ff808c54fb6cc5fed9c2a27fee9eb2011ed1a59173d312a78a080e083f8d5395b6c11f684dfd162f9c0a5aa3c96266936c6505e213c1b
6
+ metadata.gz: 11b268d82a70249a833db0d657d51a85477f02165cd9f751f59ba557cefb454c04b6e3c9fb6020d5775c226b3072874ae8221c2334d5b38dafffbee81ebbb110
7
+ data.tar.gz: aae44b8b8fd4e75a60a57539f9d8674492d184b6c7e4af3257dd460a8d971ad3164c3b52d4ae1f69f87022d094af8626153ff616b92b44a434234f516babc9e9
data/README.md CHANGED
@@ -37,7 +37,7 @@ I've tried to make the command syntax as intuitive as possible. Essentially,
37
37
  you'll send in a few parameters (the exact number of parameters required
38
38
  changes based on what git command you need to run - you can't run a `git
39
39
  checkout` without a branch name, for instance) separated by spaces; the
40
- important thing to remember is that repos you want to work with *always* be
40
+ important thing to remember is that repos you want to work with will *always* be
41
41
  your last/last few parameters and will also be separated by spaces. Want to do
42
42
  all of the repos, but don't want to type them all out? Of course you do! Why
43
43
  else would you be using this app? Just run AlfredGit with the word 'all' as
data/alfred_git.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'alfred_git/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'alfred_git'
8
- spec.version = AlfredGit::VERSION
8
+ spec.version = AlfredGitVersion::VERSION
9
9
  spec.authors = ['Chris Sellek']
10
10
  spec.email = ['iamsellek@gmail.com']
11
11
 
data/bin/alfred_git CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  require 'alfred_git'
4
4
 
5
- helper = AlfredGit::AlfredGit.new
5
+ alfred = AlfredGit::AlfredGit.new
6
6
 
7
- helper.config if ARGV[0] == 'config'
7
+ alfred.config if ARGV[0] == 'config'
8
8
 
9
- helper.alfred(ARGV)
9
+ alfred.alfred(ARGV)
@@ -1,3 +1,3 @@
1
- module AlfredGit
2
- VERSION = "0.2.0"
1
+ module AlfredGitVersion
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/alfred_git.rb CHANGED
@@ -1,11 +1,17 @@
1
1
  require 'YAML'
2
2
  require 'rainbow'
3
+ require 'fileutils'
4
+
5
+ require_relative './alfred_git/version'
3
6
 
4
7
  module AlfredGit
5
8
  class AlfredGit
9
+ include AlfredGitVersion
6
10
 
7
11
  def initialize
8
12
  set_app_directory
13
+ # If there's just one, it's the current version.
14
+ restore_settings unless Dir.glob("#{@app_directory.chomp('/alfred_git-#{VERSION}')}/alfred_git*").length > 1
9
15
  config unless File.exists?("#{@app_directory}/lib/config.yaml")
10
16
  config_yaml = YAML.load_file("#{@app_directory}/lib/config.yaml")
11
17
 
@@ -253,6 +259,44 @@ module AlfredGit
253
259
  abort
254
260
  end
255
261
 
262
+ # Attempt to restore settings from previous version.
263
+ def restore_settings
264
+ lines_pretty_print 'I see that I\'ve been recently updated.'
265
+ lines_pretty_print Rainbow('Would you like to restore the settings from the previous installation?').yellow
266
+
267
+ answered = false
268
+
269
+ until answered
270
+ answer = STDIN.gets.strip!
271
+
272
+ single_space
273
+
274
+ if answer == 'yes' || answer == 'y' || answer == 'no' || answer == 'n'
275
+ answered = true
276
+ else
277
+ lines_pretty_print 'You\'re hilarious. Really.'
278
+ lines_pretty_print Rainbow('Please input either \'yes\' or \'no\'.').yellow
279
+ end
280
+ end
281
+
282
+ return if answer == 'no' || answer == 'n'
283
+
284
+ lines_pretty_print 'One moment, please.'
285
+
286
+ single_space
287
+
288
+ all_gems = Dir.glob("#{@app_directory.chomp("/alfred_git-#{VERSION}")}/alfred_git*")
289
+
290
+ # glob orders things in the array alphabetically, so the second-to-last one in the array is the
291
+ # most recent version that is not the current version.
292
+ previous_config_file = "#{all_gems[-2]}/lib/config.yaml"
293
+ FileUtils.copy_file(previous_config_file, "#{@app_directory}/lib/config.yaml")
294
+
295
+ lines_pretty_print 'Done! Please run me again when you\'re ready.'
296
+
297
+ abort
298
+ end
299
+
256
300
  def second_argument_missing?
257
301
  @arguments[1].nil? || @arguments[1] == ''
258
302
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alfred_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Sellek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-26 00:00:00.000000000 Z
11
+ date: 2016-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow