rocket_fuel 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 270c8d2e9833cff50010fcb862b829bc00a12a09
4
- data.tar.gz: 3e73a408b265179b4ccade761b9c492ff63c783f
3
+ metadata.gz: 9908a5c1ceba99833e61048a297295df291389be
4
+ data.tar.gz: 0bd720d0d68cd8fd2ccc07081176c77608ae7156
5
5
  SHA512:
6
- metadata.gz: 9331a7e0b37987c513ca6cb989dfe8be6208f0d4e70cb9c32cd8f05544083a34e1c857ae20c1bf20938b826e856b66f4897ba03dc587c0a927527bd83e782d9f
7
- data.tar.gz: 475438f7135146553fc8bb75eb1c9792f8b8349360efe5ed0eeab142f8ef914680849b23b8915b758d13a5c81a25be33fcb8587386177388b2858057055c9640
6
+ metadata.gz: 4c75b96ce3c7e2bf8e7ec7bac8ce2b91b74c61188088bdf7684e222ec58fded88c7c37498a3e1249df32f7f3234b4cf5e9a578245bb4057fe4acb035fdf3ce8f
7
+ data.tar.gz: f20046fba9c7aa8d905652b33fba2c9b878e035b089e47428ee511da590417bcdc5180db41aa5104faa6d460673c010a102188fdb227dada37b1427a806d8c37
@@ -8,8 +8,9 @@ module RocketFuel
8
8
  say '***Rocket Fuel: Checking prerequisites***', :blue
9
9
  say ''
10
10
 
11
- RocketFuel::Precheck::Run.new.results
12
-
11
+ RocketFuel::Precheck::Run.new.tap do |run|
12
+ run.results
13
+ end
13
14
  end
14
15
 
15
16
  desc 'fix', 'fix problems that can cause issues with running rocket fuel'
@@ -35,6 +36,11 @@ module RocketFuel
35
36
 
36
37
  desc 'install [package]', 'install rocket fuel packages'
37
38
  def install
39
+ require 'rocket_fuel/install'
40
+ run = precheck
41
+ if run.ok?
42
+ RocketFuel::Install::Run.new.run
43
+ end
38
44
  end
39
45
  end
40
46
  end
@@ -0,0 +1,8 @@
1
+ require 'rocket_fuel/install/run'
2
+
3
+ module RocketFuel
4
+ module Install
5
+ ARCHIVE_PATH = '/tmp/rocket_fuel.tar.gz'
6
+ RECIPE_PATH = '/tmp/rocket_fuel_chef'
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ module RocketFuel
2
+ module Install
3
+ class ChefInstall
4
+ def run
5
+ `sudo echo`
6
+ `curl -L https://www.opscode.com/chef/install.sh | sudo bash`
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,37 @@
1
+ require 'net/http'
2
+ require 'open-uri'
3
+ require 'fileutils'
4
+
5
+ module RocketFuel
6
+ module Install
7
+ class Download
8
+ URL = 'https://codeload.github.com/LaunchAcademy/rocket-fuel-chef/tar.gz/master'
9
+
10
+ def retrieve
11
+ http = Net::HTTP.new(uri.host, uri.port)
12
+ http.use_ssl = true
13
+ resp = http.get(uri.request_uri)
14
+ open(archive_path, "wb") do |file|
15
+ file.write(resp.body)
16
+ end
17
+ end
18
+
19
+ def extract
20
+ `tar xvfz #{archive_path} -C #{File.join(recipe_path, '..') }`
21
+ end
22
+
23
+ protected
24
+ def archive_path
25
+ RocketFuel::Install::ARCHIVE_PATH
26
+ end
27
+
28
+ def recipe_path
29
+ RocketFuel::Install::RECIPE_PATH
30
+ end
31
+
32
+ def uri
33
+ @uri = URI.parse(URL)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,10 @@
1
+ module RocketFuel
2
+ module Install
3
+ class RecipeRun
4
+ def run
5
+ `cd #{RocketFuel::Install::RECIPE_PATH}`
6
+ puts `chef-solo -c cookbooks/fueled-osx-station/config.rb -j cookbooks/fueled-osx-station/roles/default.json`
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,30 @@
1
+ require 'rocket_fuel/install/download'
2
+ require 'rocket_fuel/install/chef_install'
3
+ require 'rocket_fuel/install/recipe_run'
4
+
5
+ module RocketFuel
6
+ module Install
7
+ class Run
8
+ include Thor::Base
9
+
10
+ def initialize
11
+ @download = RocketFuel::Install::Download.new
12
+ end
13
+
14
+ def run
15
+ say('Downloading rocket fuel recipes...')
16
+ @download.retrieve
17
+ say('Done.')
18
+ say('Extracting rocket fuel recipes...')
19
+ @download.extract
20
+ say('Done.')
21
+ say('Installing chef omnibus. You may be prompted for your sudo password..')
22
+ RocketFuel::Install::ChefInstall.new.run
23
+ say('Done.')
24
+ say('Running rocket fuel recipes...this may take some time')
25
+ RocketFuel::Install::RecipeRun.new.run
26
+ say('Done')
27
+ end
28
+ end
29
+ end
30
+ end
@@ -13,14 +13,18 @@ module RocketFuel
13
13
  module Precheck
14
14
  class Run
15
15
  include Thor::Base
16
+ def ok?
17
+ !@failed_checks.nil? && @failed_checks.empty?
18
+ end
19
+
16
20
  def results
17
- failed_checks = []
21
+ @failed_checks = []
18
22
  RocketFuel::Precheck.checks.each do |key, klass|
19
23
  check = klass.new
20
24
  if check.check?
21
25
  CommandLineResultPresenter.new(check).present
22
26
  if !check.ok?
23
- failed_checks << key
27
+ @failed_checks << key
24
28
  end
25
29
  end
26
30
  end
@@ -29,11 +33,11 @@ module RocketFuel
29
33
  say('========================')
30
34
  say('')
31
35
 
32
- if !failed_checks.empty?
36
+ if !@failed_checks.empty?
33
37
  say('***YOU ARE NOT CLEARED FOR INSTALLATION***', :red)
34
38
  say('')
35
39
 
36
- failed_checks.each do |sym|
40
+ @failed_checks.each do |sym|
37
41
  if RocketFuel::Precheck.fixes[sym]
38
42
  fix = RocketFuel::Precheck.fixes[sym].new
39
43
  say("#{fix.title}", :red)
@@ -1,3 +1,3 @@
1
1
  module RocketFuel
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocket_fuel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Pickett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-21 00:00:00.000000000 Z
11
+ date: 2014-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -124,6 +124,11 @@ files:
124
124
  - lib/rocket_fuel/fix/macports_fix.rb
125
125
  - lib/rocket_fuel/fix/rbenv_fix.rb
126
126
  - lib/rocket_fuel/fix/rvm_fix.rb
127
+ - lib/rocket_fuel/install.rb
128
+ - lib/rocket_fuel/install/chef_install.rb
129
+ - lib/rocket_fuel/install/download.rb
130
+ - lib/rocket_fuel/install/recipe_run.rb
131
+ - lib/rocket_fuel/install/run.rb
127
132
  - lib/rocket_fuel/operating_system.rb
128
133
  - lib/rocket_fuel/precheck.rb
129
134
  - lib/rocket_fuel/precheck/check.rb