chrome_ssb 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.
- checksums.yaml +4 -4
- data/bin/chrome_ssb +81 -0
- data/lib/chrome_ssb/version.rb +1 -1
- data/lib/chrome_ssb.rb +6 -11
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8611c486dfa1e1c11a70c0753ea0bc9319a35b30
|
4
|
+
data.tar.gz: 793bd9c82c73c0d21b4d4f4882eba4547a1a2a9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76d2fc78cb513979d5c0ce5d3ef8b28a5e7f8a49be5b2ef7f3d88a5fd634e26350502105446fd18236fc913fed2c2b3f55a4f6665dd7f18dc9c85ae363209fd2
|
7
|
+
data.tar.gz: 379d051c4427e87cdc168dcfb437cf86d2c0ffbdf26f67322d4ca5e08350cb430264f07b469d1e5eb14cbefd529bf064ad21bfec511d98871db4355c0f423025
|
data/bin/chrome_ssb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'chrome_ssb'
|
4
|
+
|
5
|
+
$data = []
|
6
|
+
|
7
|
+
overwrite = %w(-o --overwrite -f --force)
|
8
|
+
unless ARGV[0]
|
9
|
+
def get_param(o, n)
|
10
|
+
print o.strip+' '
|
11
|
+
v = $stdin.gets.strip
|
12
|
+
$data.push [n,v] if v.length > 0
|
13
|
+
end
|
14
|
+
|
15
|
+
get_param 'Application name:', '-n'
|
16
|
+
get_param 'URL to open:', '-l'
|
17
|
+
get_param 'Path to icon (blank for download):', '-i'
|
18
|
+
get_param 'Directory to save to:', '-p'
|
19
|
+
get_param 'Path to Google Chrome (blank for auto):', '-c'
|
20
|
+
else
|
21
|
+
ARGV.each_with_index do |v, idx|
|
22
|
+
if idx%2 == 0
|
23
|
+
$data[idx/2] = [v]
|
24
|
+
else
|
25
|
+
$data[idx/2].push v
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
ssb = ChromeSSB.new
|
31
|
+
show_help = false
|
32
|
+
|
33
|
+
$data.each do |param|
|
34
|
+
k = param[0]
|
35
|
+
v = param[1]
|
36
|
+
if %w(-n --name).include? k
|
37
|
+
ssb.name = v
|
38
|
+
elsif %w(-l --location --url).include? k
|
39
|
+
ssb.location = v
|
40
|
+
elsif %w(-i --icon).include? k
|
41
|
+
ssb.icon = v
|
42
|
+
elsif %w(-p --path -d --directory).include? k
|
43
|
+
ssb.path = v
|
44
|
+
elsif %w(-c --chrome-path).include? k
|
45
|
+
ssb.chrome_path = v
|
46
|
+
elsif overwrite.include? k
|
47
|
+
ssb.overwrite = %w(y 1 t true yes).include? v.downcase
|
48
|
+
elsif %w(-h --help).include? k
|
49
|
+
show_help = true
|
50
|
+
break
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
if show_help
|
55
|
+
puts <<-HELP.gsub(/^\s*\-/,'')
|
56
|
+
-chrome_ssb v0.1.0
|
57
|
+
- http://www.github.com/bradynpoulsen/chrome_ssb/
|
58
|
+
-
|
59
|
+
-Useage:
|
60
|
+
- chrome_ssb [options...]
|
61
|
+
-
|
62
|
+
-Options:
|
63
|
+
- -c --chrome-path Path to Google Chrome Application
|
64
|
+
- -d --directory alias: --path
|
65
|
+
- -f --force alias: --overwrite
|
66
|
+
- -h --help Show this helper message
|
67
|
+
- -i --icon Path to icon
|
68
|
+
- -l --location URL to open
|
69
|
+
- -n --name Application Name
|
70
|
+
- -o --overwrite Overwrite app if already exists
|
71
|
+
- -p --path Directory to create Application in
|
72
|
+
- --url alias: --location
|
73
|
+
HELP
|
74
|
+
exit
|
75
|
+
end
|
76
|
+
|
77
|
+
begin
|
78
|
+
ssb.create!
|
79
|
+
rescue ArgumentError => e
|
80
|
+
puts "Error: #{e}"
|
81
|
+
end
|
data/lib/chrome_ssb/version.rb
CHANGED
data/lib/chrome_ssb.rb
CHANGED
@@ -1,22 +1,17 @@
|
|
1
1
|
require "chrome_ssb/version"
|
2
2
|
|
3
3
|
class ChromeSSB
|
4
|
-
@@compatible = !(/darwin/ =~ RUBY_PLATFORM).nil?
|
5
|
-
|
6
|
-
private
|
7
|
-
|
8
4
|
require 'fileutils'
|
9
5
|
require 'tempfile'
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
public
|
7
|
+
@params = %i(name location icon path chrome_path overwrite)
|
8
|
+
@compatible = !(/darwin/ =~ RUBY_PLATFORM).nil?
|
14
9
|
|
15
|
-
attr_accessor
|
10
|
+
attr_accessor *@params
|
16
11
|
|
17
12
|
def initialize(args={})
|
18
13
|
## Require Mac OS X for SSB .app structure
|
19
|
-
raise '`chrome_ssb` is only compatible with Mac OS X' unless
|
14
|
+
raise '`chrome_ssb` is only compatible with Mac OS X' unless @compatible
|
20
15
|
|
21
16
|
## Set Default Values
|
22
17
|
self.name = 'Untitled SSB'
|
@@ -27,7 +22,7 @@ class ChromeSSB
|
|
27
22
|
self.overwrite = false
|
28
23
|
|
29
24
|
## Process passed args
|
30
|
-
args.each { |k,v| send("#{k}=",v) if
|
25
|
+
args.each { |k,v| send("#{k}=",v) if @params.include? k.to_sym }
|
31
26
|
end
|
32
27
|
|
33
28
|
def download_icon!
|
@@ -145,6 +140,6 @@ class ChromeSSB
|
|
145
140
|
|
146
141
|
## System Compatible
|
147
142
|
def self.compatible?
|
148
|
-
|
143
|
+
!!@compatible
|
149
144
|
end
|
150
145
|
end
|
metadata
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chrome_ssb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bradyn Poulsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Mild ruby-based Cli app to generate Chrome Site-Specific Browsers on
|
14
14
|
Mac OS X
|
15
15
|
email:
|
16
16
|
- bradyn@bradynpoulsen.com
|
17
|
-
executables:
|
17
|
+
executables:
|
18
|
+
- chrome_ssb
|
18
19
|
extensions: []
|
19
20
|
extra_rdoc_files: []
|
20
21
|
files:
|
@@ -23,6 +24,7 @@ files:
|
|
23
24
|
- LICENSE.txt
|
24
25
|
- README.md
|
25
26
|
- Rakefile
|
27
|
+
- bin/chrome_ssb
|
26
28
|
- chrome_ssb.gemspec
|
27
29
|
- lib/chrome_ssb.rb
|
28
30
|
- lib/chrome_ssb/version.rb
|