c0_setup 0.0.2 → 0.1.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: 9194b29571e83db5e180db0266f7f06849f59ddd
4
- data.tar.gz: d220d752f970500775088eafa41ef046ccd99c68
3
+ metadata.gz: b6a01ce6c1e3c1498176911e00f5d180df91e162
4
+ data.tar.gz: 4dcc4199f6921eb356e4464eecd388a90bc26a1a
5
5
  SHA512:
6
- metadata.gz: 43cf2c15b6b671a240f8d976baf127447984e38b3fff7b68447f4183cf589530b5c01af5f257ce90306f36a410d35a7bd2d14ffde13121fbec0676800964f903
7
- data.tar.gz: 1e5b981f1b056a8b22c6e89a83304549caecef7b45ca05a08e5ac9704eb28c134dc461a9a7cc5b4327ebbfc48fffbf7a38fdc414777d33dc680c3a2aa44c8d66
6
+ metadata.gz: b84c98771760ba9fc7f61b32d548590f9f928d40874c73acc96c59a6f1bf61534462a82feaab36c7dcff8bd10a9f4988d476ffc584fc9f931e70e12d899246ec
7
+ data.tar.gz: 8ea3cf55881a69508d022bf5a20a540edcc5364983b00c9fe2c6e3ffbb7984b0a071732a8b6e5b1c2aa72c18a2f230eb1cedb0c39c8009f648da09eed1c18333
@@ -11,7 +11,7 @@ unless ARGV[0].nil? or ARGV[0] != "install"
11
11
  puts result
12
12
  puts "make sure you restart your terminal session for any changes to take effect" if !result.empty?
13
13
  else
14
- puts "to install c0 utils (cc0 and coin), try again 'cc0-setup install"
14
+ puts "to install c0 utils (cc0 and coin), try again 'cc0_setup install"
15
15
  end
16
16
 
17
17
 
Binary file
Binary file
@@ -21,25 +21,16 @@ class C0Setup
21
21
  result.push ".c0 folder already exists, remove it and retry if broken"
22
22
  return result
23
23
  end
24
- if to_do.include? "cc0"
25
- if install_cc0
26
- result.push "successfully installed cc0"
24
+ if to_do.include? "cc0" and to_do.include? "coin"
25
+ if install_lib
26
+ result.push "successfully installed cc0 and coin"
27
27
  else
28
- result.push "failed to install cc0"
28
+ result.push "failed to install cc0 and coin"
29
29
  end
30
- else
31
- result.push "cc0 is already installed somewhere, remove it and retry if broken"
32
- end
33
- if to_do.include? "coin"
34
- if install_coin
35
- result.push "successfully installed coin"
36
- else
37
- result.push "failed to install coin"
38
- end
39
- else
40
- result.push "cc0 is already installed somewhere, remove it and retry if broken"
30
+ else
31
+ result.push "coin or cc0 is already installed somewhere, remove it and retry if broken"
41
32
  end
42
- return result
33
+
43
34
  end
44
35
 
45
36
  # check for things that don't exist yet
@@ -63,43 +54,28 @@ class C0Setup
63
54
  def create_runpath
64
55
  Dir.chdir(File.expand_path("~")) do
65
56
  Dir.mkdir ".c0"
66
- File.new ".bashrc" unless File.exist? ".bashrc"
57
+ File.new("#{File.expand_path("~")}/.bashrc", "w+") unless File.exist? ".bashrc"
67
58
  File.open(".bashrc", "a") do |file|
68
- file.puts "export PATH=$PATH:~/.c0"
59
+ file.puts "export PATH=$PATH:~/.c0/bin"
69
60
  end
70
- in_path = File.open(".bashrc", "r").read.include? "export PATH=$PATH:~/.c0"
61
+ in_path = File.open(".bashrc", "r").read.include? "export PATH=$PATH:~/.c0/bin"
71
62
  return (in_path and Dir.exist? ".c0")
72
63
  end
73
64
  end
74
-
75
- def install_cc0
76
- # copy the cc0 binary to "~/.c0"
65
+ # copy the c0 lib to "~/.c0" (OS specific)
66
+ def install_lib
77
67
  user = File.expand_path("~")
78
- Dir.chdir(File.dirname __dir__) do
79
- if get_os == "darwin"
80
- FileUtils.cp("./cc0_mac", "#{user}/.c0/cc0")
81
- elsif get_os == "linux"
82
- FileUtils.cp("./cc0_linux", "#{user}/.c0/cc0")
83
- end
84
- end
85
- return File.exist?("#{user}/.c0/cc0")
68
+ if get_os == "darwin"
69
+ `tar -xvzf #{File.expand_path(File.dirname __dir__)}/c0_mac.tar.gz -C #{user}/.c0`
70
+ elsif get_os == "linux"
71
+ `tar -xvzf #{File.expand_path(File.dirname __dir__)}/c0_linux.tar.gz -C #{user}/.c0`
72
+ end
73
+ return (File.exist?("#{user}/.c0/bin/cc0") and File.exist?("#{user}/.c0/bin/coin"))
86
74
  end
87
75
 
88
- def install_coin
89
- # copy the coin binary to "~/.c0"
90
- user = File.expand_path("~")
91
- Dir.chdir(File.dirname __dir__) do
92
- if get_os == "darwin"
93
- FileUtils.cp("./coin_mac", "#{user}/.c0/coin")
94
- elsif get_os == "linux"
95
- FileUtils.cp("./coin_linux", "#{user}/.c0/coin")
96
- end
97
- end
98
- return File.exist?("#{user}/.c0/coin")
99
- end
100
-
101
- def which(cmd)
76
+
102
77
  # check for the presence of a binary in $PATH
78
+ def which(cmd)
103
79
  exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
104
80
  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
105
81
  exts.each do |ext|
@@ -110,7 +86,7 @@ class C0Setup
110
86
  return nil
111
87
  end
112
88
 
113
-
89
+ # figure out the os
114
90
  def get_os
115
91
  result = ""
116
92
  os = RbConfig::CONFIG['host_os']
@@ -123,4 +99,3 @@ class C0Setup
123
99
  end
124
100
 
125
101
  end
126
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c0_setup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Brigden
@@ -18,10 +18,8 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - bin/c0_setup
21
- - cc0_linux
22
- - cc0_mac
23
- - coin_linux
24
- - coin_mac
21
+ - c0_linux.tar.gz
22
+ - c0_mac.tar.gz
25
23
  - lib/c0_setup.rb
26
24
  homepage: https://github.com/rbrigden
27
25
  licenses: []
data/cc0_linux DELETED
Binary file
data/cc0_mac DELETED
Binary file
data/coin_linux DELETED
Binary file
data/coin_mac DELETED
Binary file