rocket_fuel 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +12 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +31 -0
  7. data/Rakefile +7 -0
  8. data/bin/rocket_fuel +8 -0
  9. data/lib/rocket_fuel/command_line_interface.rb +40 -0
  10. data/lib/rocket_fuel/fix/abstract_fix.rb +30 -0
  11. data/lib/rocket_fuel/fix/command_line_tool_fix.rb +61 -0
  12. data/lib/rocket_fuel/fix/command_line_tools/dmg_metadata.rb +46 -0
  13. data/lib/rocket_fuel/fix/command_line_tools/download.rb +30 -0
  14. data/lib/rocket_fuel/fix/command_line_tools/download_routine.rb +76 -0
  15. data/lib/rocket_fuel/fix/command_line_tools/install.applescript +58 -0
  16. data/lib/rocket_fuel/fix/command_line_tools/install.rb +31 -0
  17. data/lib/rocket_fuel/fix/file_sanitizer_fix.rb +25 -0
  18. data/lib/rocket_fuel/fix/macports_fix.rb +36 -0
  19. data/lib/rocket_fuel/fix/rbenv_fix.rb +24 -0
  20. data/lib/rocket_fuel/fix/rvm_fix.rb +24 -0
  21. data/lib/rocket_fuel/fix.rb +10 -0
  22. data/lib/rocket_fuel/operating_system.rb +53 -0
  23. data/lib/rocket_fuel/precheck/check.rb +52 -0
  24. data/lib/rocket_fuel/precheck/check_result.rb +17 -0
  25. data/lib/rocket_fuel/precheck/command_line_result_presenter.rb +28 -0
  26. data/lib/rocket_fuel/precheck/command_line_tool_check.rb +43 -0
  27. data/lib/rocket_fuel/precheck/macports_check.rb +48 -0
  28. data/lib/rocket_fuel/precheck/rbenv_check.rb +42 -0
  29. data/lib/rocket_fuel/precheck/run.rb +57 -0
  30. data/lib/rocket_fuel/precheck/rvm_check.rb +41 -0
  31. data/lib/rocket_fuel/precheck.rb +26 -0
  32. data/lib/rocket_fuel/system_details.rb +21 -0
  33. data/lib/rocket_fuel/version.rb +3 -0
  34. data/lib/rocket_fuel.rb +10 -0
  35. data/rocket_fuel.gemspec +28 -0
  36. data/spec/rocket_fuel/fix/command_line_tools/dmg_metadata_spec.rb +19 -0
  37. data/spec/rocket_fuel/fix/command_line_tools/download_spec.rb +12 -0
  38. data/spec/rocket_fuel/fix/macports_fix_spec.rb +23 -0
  39. data/spec/rocket_fuel/fix/rbenv_fix_spec.rb +29 -0
  40. data/spec/rocket_fuel/fix/rvm_fix_spec.rb +29 -0
  41. data/spec/rocket_fuel/operating_system_spec.rb +29 -0
  42. data/spec/rocket_fuel/precheck/check_result_spec.rb +23 -0
  43. data/spec/rocket_fuel/precheck/check_spec.rb +19 -0
  44. data/spec/rocket_fuel/precheck/command_line_result_presenter_spec.rb +32 -0
  45. data/spec/rocket_fuel/precheck/command_line_tool_check_spec.rb +71 -0
  46. data/spec/rocket_fuel/precheck/macports_check_spec.rb +34 -0
  47. data/spec/rocket_fuel/precheck/rbenv_check_spec.rb +35 -0
  48. data/spec/rocket_fuel/precheck/run_spec.rb +10 -0
  49. data/spec/rocket_fuel/precheck/rvm_check_spec.rb +38 -0
  50. data/spec/rocket_fuel/precheck_spec.rb +10 -0
  51. data/spec/spec_helper.rb +34 -0
  52. metadata +195 -0
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+
3
+ require 'rocket_fuel/precheck/command_line_tool_check'
4
+
5
+ require 'fakefs'
6
+ require 'fakefs/spec_helpers'
7
+ require 'fileutils'
8
+
9
+ describe RocketFuel::Precheck::CommandLineToolCheck do
10
+ include FakeFS::SpecHelpers
11
+
12
+ before(:each) do
13
+ FileUtils.mkdir_p(File.dirname(path))
14
+ end
15
+
16
+ let(:path) { RocketFuel::Precheck::CommandLineToolCheck::TEN_NINE_RECEIPT_PATH }
17
+ [
18
+ '10.9.4',
19
+ '10.10'
20
+ ].each do |os_vers|
21
+ context "os x #{os_vers}" do
22
+ let(:os) { RocketFuel::OperatingSystem.new('darwin', os_vers)}
23
+ before(:each) do
24
+ RocketFuel::SystemDetails.stubs(:os).returns(os)
25
+ end
26
+
27
+ let(:check) { RocketFuel::Precheck::CommandLineToolCheck.new }
28
+ it 'is ok if the receipt file is found' do
29
+ FileUtils.touch(path)
30
+ expect(check).to be_ok
31
+ end
32
+
33
+ it 'is not ok if the receipt is not found' do
34
+ FileUtils.rm_f(path) if FileTest.exist?(path)
35
+ expect(check).to_not be_ok
36
+ end
37
+
38
+ it 'has a failure message if the receipt is not found' do
39
+ FileUtils.rm_f(path) if FileTest.exist?(path)
40
+ expect(check.run.message).to match(/not found/i)
41
+ end
42
+ end
43
+ end
44
+
45
+ context 'os x 10.8' do
46
+ before(:each) do
47
+ os = RocketFuel::OperatingSystem.new('darwin', '10.8.4')
48
+ RocketFuel::SystemDetails.stubs(:os).returns(os)
49
+ end
50
+
51
+ let(:check) { RocketFuel::Precheck::CommandLineToolCheck.new }
52
+ let(:path) { RocketFuel::Precheck::CommandLineToolCheck::DEFAULT_RECEIPT_PATH }
53
+
54
+ it 'is ok if the receipt file is found' do
55
+ FileUtils.touch(path)
56
+ expect(check).to be_ok
57
+ end
58
+
59
+ it 'is not ok if the receipt is not found' do
60
+ FileUtils.rm_f(path) if FileTest.exist?(path)
61
+ expect(check).to_not be_ok
62
+ end
63
+ end
64
+
65
+ it 'does not check for operating systems other than the mac' do
66
+ check = RocketFuel::Precheck::CommandLineToolCheck.new
67
+ os = RocketFuel::OperatingSystem.new('linux', '2.6')
68
+ RocketFuel::SystemDetails.stubs(:os).returns(os)
69
+ expect(check).to_not be_check
70
+ end
71
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ require 'rocket_fuel/precheck/macports_check'
4
+
5
+ describe RocketFuel::Precheck::MacportsCheck do
6
+ include FakeFS::SpecHelpers
7
+
8
+ let(:path) { RocketFuel::Precheck::MacportsCheck.bin_path }
9
+ let(:check) { RocketFuel::Precheck::MacportsCheck.new }
10
+
11
+ it 'is not ok if macports is found in the users home directory' do
12
+ FileUtils.mkdir_p(path)
13
+ expect(check).to_not be_ok
14
+ end
15
+
16
+ it 'is ok if macports is not found or installed' do
17
+ expect(check).to be_ok
18
+ end
19
+
20
+ it 'has a success message if macports is not found' do
21
+ expect(check.message).to match(/not found/i)
22
+ end
23
+
24
+ it 'has a failure message if macports is found' do
25
+ FileUtils.mkdir_p(path)
26
+ expect(check.message).to match(/found/i)
27
+ end
28
+
29
+ it 'does not check if not run on a Mac' do
30
+ os = RocketFuel::OperatingSystem.new('linux', '2.6')
31
+ RocketFuel::SystemDetails.stubs(:os).returns(os)
32
+ expect(check).to_not be_check
33
+ end
34
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ require 'rocket_fuel/precheck'
4
+ require 'rocket_fuel/precheck/run'
5
+
6
+ describe RocketFuel::Precheck::RbenvCheck do
7
+ include FakeFS::SpecHelpers
8
+
9
+ let(:home_path) { RocketFuel::Precheck::RbenvCheck.home_path }
10
+ let(:global_path) { RocketFuel::Precheck::RbenvCheck.global_path }
11
+ let(:check) { RocketFuel::Precheck::RbenvCheck.new }
12
+
13
+ it 'is not ok if rbenv is found in the users home directory' do
14
+ FileUtils.mkdir_p(home_path)
15
+ expect(check).to_not be_ok
16
+ end
17
+
18
+ it 'is not ok if rm is found in the global directory' do
19
+ FileUtils.mkdir_p(global_path)
20
+ expect(check).to_not be_ok
21
+ end
22
+
23
+ it 'is ok if rbenv is not found or installed' do
24
+ expect(check).to be_ok
25
+ end
26
+
27
+ it 'has a success message if rbenv is not found' do
28
+ expect(check.message).to match(/not found/i)
29
+ end
30
+
31
+ it 'has a failure message if rbenv is found' do
32
+ FileUtils.mkdir_p(home_path)
33
+ expect(check.message).to match(/found/i)
34
+ end
35
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ require 'rocket_fuel/precheck'
4
+
5
+ describe RocketFuel::Precheck::Run do
6
+ it 'returns results' do
7
+ results = capture(:stdout) { RocketFuel::Precheck::Run.new.results }
8
+ expect(results).to_not eq('')
9
+ end
10
+ end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ require 'rocket_fuel/precheck'
4
+
5
+ require 'fakefs'
6
+ require 'fakefs/spec_helpers'
7
+ require 'fileutils'
8
+
9
+ describe RocketFuel::Precheck::RvmCheck do
10
+ include FakeFS::SpecHelpers
11
+
12
+ let(:home_path) { RocketFuel::Precheck::RvmCheck.home_path }
13
+ let(:global_path) { RocketFuel::Precheck::RvmCheck.global_path }
14
+ let(:check) { RocketFuel::Precheck::RvmCheck.new }
15
+
16
+ it 'is not ok if rvm is found in the users home directory' do
17
+ FileUtils.mkdir_p(home_path)
18
+ expect(check).to_not be_ok
19
+ end
20
+
21
+ it 'is not ok if rvm is found in the global directory' do
22
+ FileUtils.mkdir_p(global_path)
23
+ expect(check).to_not be_ok
24
+ end
25
+
26
+ it 'is ok if rvm is not found or installed' do
27
+ expect(check).to be_ok
28
+ end
29
+
30
+ it 'has a success message if rvm is not found' do
31
+ expect(check.message).to match(/not found/i)
32
+ end
33
+
34
+ it 'has a failure message if rvm is found' do
35
+ FileUtils.mkdir_p(home_path)
36
+ expect(check.message).to match(/found/i)
37
+ end
38
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ require 'rocket_fuel/precheck'
4
+
5
+ describe RocketFuel::Precheck do
6
+ it 'has a map of checks' do
7
+ expect(RocketFuel::Precheck.checks[:rvm].ancestors).to include(
8
+ RocketFuel::Precheck::Check)
9
+ end
10
+ end
@@ -0,0 +1,34 @@
1
+ require 'rspec'
2
+
3
+ require 'rocket_fuel'
4
+
5
+ require 'mocha/api'
6
+
7
+ begin
8
+ require 'simplecov'
9
+ require 'coveralls'
10
+
11
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
12
+ SimpleCov::Formatter::HTMLFormatter,
13
+ Coveralls::SimpleCov::Formatter
14
+ ]
15
+ SimpleCov.start
16
+ rescue
17
+ end
18
+
19
+ RSpec.configure do |config|
20
+ #capture method courtesy of https://github.com/docwhat/homedir/blob/homedir3/spec/spec_helper.rb
21
+ def capture(stream)
22
+ begin
23
+ stream = stream.to_s
24
+ eval "$#{stream} = StringIO.new"
25
+ yield
26
+ result = eval("$#{stream}").string
27
+ ensure
28
+ eval("$#{stream} = #{stream.upcase}")
29
+ end
30
+ result
31
+ end
32
+
33
+ config.mock_with :mocha
34
+ end
metadata ADDED
@@ -0,0 +1,195 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rocket_fuel
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dan Pickett
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mocha
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: fakefs
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: A ruby client for installing rocket fuel.
98
+ email:
99
+ - dan.pickett@launchacademy.com
100
+ executables:
101
+ - rocket_fuel
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - bin/rocket_fuel
112
+ - lib/rocket_fuel.rb
113
+ - lib/rocket_fuel/command_line_interface.rb
114
+ - lib/rocket_fuel/fix.rb
115
+ - lib/rocket_fuel/fix/abstract_fix.rb
116
+ - lib/rocket_fuel/fix/command_line_tool_fix.rb
117
+ - lib/rocket_fuel/fix/command_line_tools/dmg_metadata.rb
118
+ - lib/rocket_fuel/fix/command_line_tools/download.rb
119
+ - lib/rocket_fuel/fix/command_line_tools/download_routine.rb
120
+ - lib/rocket_fuel/fix/command_line_tools/install.applescript
121
+ - lib/rocket_fuel/fix/command_line_tools/install.rb
122
+ - lib/rocket_fuel/fix/file_sanitizer_fix.rb
123
+ - lib/rocket_fuel/fix/macports_fix.rb
124
+ - lib/rocket_fuel/fix/rbenv_fix.rb
125
+ - lib/rocket_fuel/fix/rvm_fix.rb
126
+ - lib/rocket_fuel/operating_system.rb
127
+ - lib/rocket_fuel/precheck.rb
128
+ - lib/rocket_fuel/precheck/check.rb
129
+ - lib/rocket_fuel/precheck/check_result.rb
130
+ - lib/rocket_fuel/precheck/command_line_result_presenter.rb
131
+ - lib/rocket_fuel/precheck/command_line_tool_check.rb
132
+ - lib/rocket_fuel/precheck/macports_check.rb
133
+ - lib/rocket_fuel/precheck/rbenv_check.rb
134
+ - lib/rocket_fuel/precheck/run.rb
135
+ - lib/rocket_fuel/precheck/rvm_check.rb
136
+ - lib/rocket_fuel/system_details.rb
137
+ - lib/rocket_fuel/version.rb
138
+ - rocket_fuel.gemspec
139
+ - spec/rocket_fuel/fix/command_line_tools/dmg_metadata_spec.rb
140
+ - spec/rocket_fuel/fix/command_line_tools/download_spec.rb
141
+ - spec/rocket_fuel/fix/macports_fix_spec.rb
142
+ - spec/rocket_fuel/fix/rbenv_fix_spec.rb
143
+ - spec/rocket_fuel/fix/rvm_fix_spec.rb
144
+ - spec/rocket_fuel/operating_system_spec.rb
145
+ - spec/rocket_fuel/precheck/check_result_spec.rb
146
+ - spec/rocket_fuel/precheck/check_spec.rb
147
+ - spec/rocket_fuel/precheck/command_line_result_presenter_spec.rb
148
+ - spec/rocket_fuel/precheck/command_line_tool_check_spec.rb
149
+ - spec/rocket_fuel/precheck/macports_check_spec.rb
150
+ - spec/rocket_fuel/precheck/rbenv_check_spec.rb
151
+ - spec/rocket_fuel/precheck/run_spec.rb
152
+ - spec/rocket_fuel/precheck/rvm_check_spec.rb
153
+ - spec/rocket_fuel/precheck_spec.rb
154
+ - spec/spec_helper.rb
155
+ homepage: ''
156
+ licenses:
157
+ - MIT
158
+ metadata: {}
159
+ post_install_message:
160
+ rdoc_options: []
161
+ require_paths:
162
+ - lib
163
+ required_ruby_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ required_rubygems_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ requirements: []
174
+ rubyforge_project:
175
+ rubygems_version: 2.2.2
176
+ signing_key:
177
+ specification_version: 4
178
+ summary: A ruby client for installing rocket fuel
179
+ test_files:
180
+ - spec/rocket_fuel/fix/command_line_tools/dmg_metadata_spec.rb
181
+ - spec/rocket_fuel/fix/command_line_tools/download_spec.rb
182
+ - spec/rocket_fuel/fix/macports_fix_spec.rb
183
+ - spec/rocket_fuel/fix/rbenv_fix_spec.rb
184
+ - spec/rocket_fuel/fix/rvm_fix_spec.rb
185
+ - spec/rocket_fuel/operating_system_spec.rb
186
+ - spec/rocket_fuel/precheck/check_result_spec.rb
187
+ - spec/rocket_fuel/precheck/check_spec.rb
188
+ - spec/rocket_fuel/precheck/command_line_result_presenter_spec.rb
189
+ - spec/rocket_fuel/precheck/command_line_tool_check_spec.rb
190
+ - spec/rocket_fuel/precheck/macports_check_spec.rb
191
+ - spec/rocket_fuel/precheck/rbenv_check_spec.rb
192
+ - spec/rocket_fuel/precheck/run_spec.rb
193
+ - spec/rocket_fuel/precheck/rvm_check_spec.rb
194
+ - spec/rocket_fuel/precheck_spec.rb
195
+ - spec/spec_helper.rb