instapusher 0.0.17 → 0.0.18

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.
data/README.md CHANGED
@@ -25,11 +25,11 @@ Example:
25
25
 
26
26
  You can provide the env variable `LOCAL` like:
27
27
 
28
- LOCAL=1 instapusher
28
+ instapusher --local
29
29
 
30
30
  To enable debug messages you can do
31
31
 
32
- DEBUG=1 instapusher
32
+ instapusher --debug
33
33
 
34
34
  Pass host info like this
35
35
 
data/bin/instapusher CHANGED
@@ -1,10 +1,33 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'instapusher/commands'
4
- require 'instapusher/version'
3
+ require_relative '../lib/instapusher/commands'
4
+ require_relative '../lib/instapusher/version'
5
5
 
6
- if ['-v', '--version'].include? ARGV[0]
6
+ require 'optparse'
7
+
8
+ options = {}
9
+ OptionParser.new do |opts|
10
+
11
+ opts.on("-v", "--version", "show version") do |v|
12
+ options[:version] = v
13
+ end
14
+
15
+ opts.on("--quick", "Run quickly") do |v|
16
+ options[:quickly] = v
17
+ end
18
+
19
+ opts.on("--local", "Run locally") do |v|
20
+ options[:local] = v
21
+ end
22
+
23
+ opts.on("--debug", "Show debug messages") do |v|
24
+ options[:debug] = v
25
+ end
26
+ end.parse!
27
+
28
+ if options[:version]
7
29
  puts Instapusher::VERSION
8
30
  else
9
- Instapusher::Commands.deploy *ARGV[0..1]
31
+ debugger
32
+ Instapusher::Commands.deploy(options)
10
33
  end
@@ -7,28 +7,31 @@ module Instapusher
7
7
  class Commands
8
8
  DEFAULT_HOSTNAME = 'instapusher.com'
9
9
 
10
- def self.deploy(project_name=nil, branch_name=nil)
11
- debug = ENV['DEBUG']
10
+ def self.deploy(_options)
11
+
12
+ debug = _options(:debug)
13
+
12
14
  hostname = ENV['INSTAPUSHER_HOST'] || DEFAULT_HOSTNAME
13
- hostname = "localhost:3000" if ENV['LOCAL']
15
+ hostname = "localhost:3000" if _options[:local]
14
16
 
15
17
  url = "http://#{hostname}/heroku.json"
16
18
  git = Git.new
17
- branch_name ||= ENV['INSTAPUSHER_BRANCH'] || git.current_branch
18
- project_name ||= ENV['INSTAPUSHER_PROJECT'] || git.project_name
19
+ branch_name = _options[:project_name] || ENV['INSTAPUSHER_BRANCH'] || git.current_branch
20
+ project_name = _options[:branch_name] || ENV['INSTAPUSHER_PROJECT'] || git.project_name
19
21
 
20
22
  api_key = ENV['API_KEY'] || Instapusher::Configuration.api_key || ""
23
+
21
24
  if api_key.to_s.length == 0
22
25
  puts "Please enter instapusher api_key at ~/.instapusher "
23
26
  end
24
27
 
25
28
  options = { project: project_name,
26
29
  branch: branch_name,
27
- quick: ENV['QUICK'],
28
- local: ENV['LOCAL'],
30
+ quick: _options[:quick],
31
+ local: _options[:local],
29
32
  api_key: api_key }
30
33
 
31
- if debug
34
+ if debug || true
32
35
  puts "url to hit: #{url.inspect}"
33
36
  puts "options being passed to the url: #{options.inspect}"
34
37
  end
@@ -1,3 +1,3 @@
1
1
  module Instapusher
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
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.17
4
+ version: 0.0.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -81,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  segments:
83
83
  - 0
84
- hash: 360748177235654900
84
+ hash: 2098198211942867454
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  segments:
92
92
  - 0
93
- hash: 360748177235654900
93
+ hash: 2098198211942867454
94
94
  requirements: []
95
95
  rubyforge_project:
96
96
  rubygems_version: 1.8.23