ruby-bitly 0.1.1 → 0.1.2
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/VERSION +1 -1
- data/bin/bitly +13 -12
- data/lib/readme.rb +2 -1
- data/ruby-bitly.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/bin/bitly
CHANGED
@@ -13,7 +13,7 @@ class App
|
|
13
13
|
VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
|
14
14
|
ACCOUNT_FILE_PATH = "#{ENV['HOME']}/.bitly"
|
15
15
|
|
16
|
-
attr_accessor :arguments, :options
|
16
|
+
attr_accessor :arguments, :options
|
17
17
|
|
18
18
|
def initialize(arguments, stdin = nil)
|
19
19
|
self.options = OpenStruct.new
|
@@ -27,10 +27,10 @@ class App
|
|
27
27
|
if arguments_valid?
|
28
28
|
output_options if options.verbose
|
29
29
|
|
30
|
-
process_arguments
|
30
|
+
post_process_options and process_arguments
|
31
31
|
puts "#{options.message} #{process_command}".strip
|
32
32
|
else
|
33
|
-
output_help
|
33
|
+
output_help("ERROR: Invalid options", 'examples')
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -40,9 +40,7 @@ class App
|
|
40
40
|
begin
|
41
41
|
account_data = YAML.load(File.read(ACCOUNT_FILE_PATH))
|
42
42
|
rescue
|
43
|
-
|
44
|
-
puts "See: bitly -h"
|
45
|
-
exit
|
43
|
+
output_help("ERROR: Crendentials not found", 'authentication')
|
46
44
|
end
|
47
45
|
|
48
46
|
if account_data
|
@@ -72,9 +70,7 @@ class App
|
|
72
70
|
opts.on('-v', '--version') { output_version ; exit 0 }
|
73
71
|
opts.on('-h', '--help') { output_help }
|
74
72
|
opts.on('-V', '--verbose') { options.verbose = true }
|
75
|
-
opts.on('-q', '--quiet') { options.quiet = true; options.verbose = false
|
76
|
-
|
77
|
-
post_process_options
|
73
|
+
opts.on('-q', '--quiet') { options.quiet = true; options.verbose = false }
|
78
74
|
|
79
75
|
opts.parse!(arguments) rescue return false
|
80
76
|
end
|
@@ -84,7 +80,10 @@ class App
|
|
84
80
|
load_account_data unless options.login and options.key
|
85
81
|
|
86
82
|
# Default option: --shorten
|
87
|
-
options.shorten = true unless options.expand or options.user_clicks or options.global_clicks
|
83
|
+
options.shorten = true and options.message = 'Short url:' unless options.expand or options.user_clicks or options.global_clicks
|
84
|
+
|
85
|
+
# Message empty if option quiet exists
|
86
|
+
options.message = '' if options.quiet
|
88
87
|
end
|
89
88
|
|
90
89
|
def output_options
|
@@ -104,8 +103,10 @@ class App
|
|
104
103
|
def process_arguments
|
105
104
|
end
|
106
105
|
|
107
|
-
def output_help
|
108
|
-
|
106
|
+
def output_help(message = nil, section = "")
|
107
|
+
puts message if message
|
108
|
+
|
109
|
+
Readme::usage(section) #exits app
|
109
110
|
end
|
110
111
|
|
111
112
|
def output_version
|
data/lib/readme.rb
CHANGED
@@ -120,8 +120,9 @@ module Readme
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
123
|
+
|
123
124
|
if result.empty?
|
124
|
-
puts "Note to developer: requested section(s) [#{sections.join(', ')}] not found"
|
125
|
+
# puts "Note to developer: requested section(s) [#{sections.join(', ')}] not found"
|
125
126
|
result = flow
|
126
127
|
end
|
127
128
|
result
|
data/ruby-bitly.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-bitly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- rafaeldx7
|