instapusher 0.0.24 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,10 +30,12 @@ module Instapusher
30
30
  end
31
31
 
32
32
  def verify_api_key
33
- @api_key = ENV['API_KEY'] || Instapusher::Configuration.api_key || ""
33
+ @api_key = ENV['API_KEY'] || Instapusher::Configuration.api_key(debug) || ""
34
34
 
35
35
  if @api_key.to_s.length == 0
36
- puts "Please enter instapusher api_key at ~/.instapusher "
36
+ abort "Please enter instapusher api_key at ~/.instapusher "
37
+ elsif debug
38
+ puts "api_key is #{@api_key}"
37
39
  end
38
40
  end
39
41
 
@@ -55,15 +57,19 @@ module Instapusher
55
57
 
56
58
  input = STDIN.gets.chomp.downcase
57
59
 
58
- if %w(yes y).include?(input)
59
- elsif %w(no n).include?(input)
60
- abort "Please try again when you have taken the backup"
61
- else
62
- abort "Please answer yes or no"
63
- end
60
+ if %w(yes y).include?(input)
61
+ #do nothing
62
+ elsif %w(no n).include?(input)
63
+ abort "Please try again when you have taken the backup"
64
+ else
65
+ abort "Please answer yes or no"
66
+ end
67
+ end
64
68
 
65
- version_number = Time.current.to_s.parameterize
69
+ def tag_release
70
+ return if branch_name.intern != :production
66
71
 
72
+ version_number = Time.current.to_s.parameterize
67
73
 
68
74
  cmd = "git tag -a -m \"Version #{version_number}\" #{version_number}"
69
75
  puts cmd if debug
@@ -83,7 +89,6 @@ module Instapusher
83
89
  puts "options being passed to the url: #{options.inspect}"
84
90
  puts "connecting to #{url} to send data"
85
91
  end
86
-
87
92
 
88
93
  response = Net::HTTP.post_form URI.parse(url), options
89
94
  response_body = ::JSON.parse(response.body)
@@ -97,6 +102,8 @@ module Instapusher
97
102
  puts 'Monitor the job status at: ' + job_status_url
98
103
  cmd = "open #{job_status_url}"
99
104
  `#{cmd}`
105
+
106
+ tag_release
100
107
  else
101
108
  puts response_body['error']
102
109
  end
@@ -7,7 +7,7 @@ module Instapusher
7
7
  @_settings = {}
8
8
  attr_reader :_settings
9
9
 
10
- def load(filename=nil)
10
+ def load(debug = false, filename=nil)
11
11
  filename ||= File.join(ENV['HOME'], '.instapusher')
12
12
 
13
13
  unless File.exist? filename
@@ -15,9 +15,14 @@ module Instapusher
15
15
  end
16
16
 
17
17
  @_settings = YAML::load_file(filename) || {}
18
+
19
+ if debug
20
+ puts @_settings.inspect
21
+ end
18
22
  end
19
23
 
20
24
  def method_missing(name, *args, &block)
25
+ self.load
21
26
  @_settings[name.to_s]
22
27
  end
23
28
  end
@@ -1,3 +1,3 @@
1
1
  module Instapusher
2
- VERSION = "0.0.24"
2
+ VERSION = "0.0.25"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instapusher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -97,7 +97,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  segments:
99
99
  - 0
100
- hash: 2643523195945053738
100
+ hash: 4406336719269151696
101
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  none: false
103
103
  requirements:
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  segments:
108
108
  - 0
109
- hash: 2643523195945053738
109
+ hash: 4406336719269151696
110
110
  requirements: []
111
111
  rubyforge_project:
112
112
  rubygems_version: 1.8.23