yuyi 1.0.8 → 1.1.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.
@@ -19,7 +19,7 @@ describe Yuyi::Source do
19
19
  end
20
20
 
21
21
  it 'should put roll files in the tmp dir' do
22
- paths = @source.var(:available_rolls).values
22
+ paths = @source.var(:rolls).values
23
23
 
24
24
  expect(paths.size).to eq 2
25
25
 
@@ -29,7 +29,11 @@ describe Yuyi::Source do
29
29
  end
30
30
 
31
31
  it 'should set the available rolls' do
32
- expect(@source.var(:available_rolls).keys).to include :foo_roll
32
+ expect(@source.var(:rolls).keys).to include :foo_roll
33
+ end
34
+
35
+ it 'should set the available roll models' do
36
+ expect(@source.var(:roll_models).keys).to include :foo_roll_model
33
37
  end
34
38
  end
35
39
 
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe Yuyi::Ui do
4
+ describe '#present_options' do
5
+ before do
6
+ class UiTest; extend Yuyi::Ui; end
7
+
8
+ @output = ''
9
+ allow(UiTest).to receive :say do |o, p|
10
+ @output << (o || '')
11
+ end
12
+
13
+ class PresentOptionsRoll; end
14
+ allow(PresentOptionsRoll).to receive(:title).and_return 'Present Options Roll'
15
+ allow(PresentOptionsRoll).to receive(:file_name).and_return :present_options_roll
16
+ allow(PresentOptionsRoll).to receive(:options).and_return({ :option_foo => '3.0' })
17
+ allow(PresentOptionsRoll).to receive(:option_defs).and_return({
18
+ :option_foo => {
19
+ :description => 'foo description',
20
+ :example => '1.0',
21
+ :default => '2.0'
22
+ }
23
+ })
24
+
25
+ UiTest.send :present_options, PresentOptionsRoll
26
+ end
27
+
28
+ it 'should output the neccessary information' do
29
+ expect(@output).to include 'Present Options Roll'
30
+ expect(@output).to include 'present_options_roll'
31
+ expect(@output).to include 'foo description'
32
+ expect(@output).to include '1.0'
33
+ expect(@output).to include '2.0'
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,51 @@
1
+ $: << '../lib'
2
+ require 'spec_helper'
3
+ require 'yuyi'
4
+
5
+ Yuyi::Menu.new Yuyi.instance_variable_get('@path')
6
+
7
+ describe 'Roll Validator' do
8
+ Yuyi::Menu.sources.each do |source|
9
+
10
+ # require roll models first
11
+ source.roll_models.each do |roll_model_name, roll_model_path|
12
+ require roll_model_path
13
+ end
14
+
15
+ source_title = source.instance_variable_get('@name')
16
+
17
+ describe source_title do
18
+ source.rolls.each do |roll_name, roll_path|
19
+ describe roll_name do
20
+ before do
21
+ # require roll_path
22
+ load "#{roll_path}.rb", true
23
+ @roll_class = Yuyi::Menu.rolls[roll_name].class
24
+ end
25
+
26
+ after do
27
+ # unload class to test other sources of the same roll
28
+ klass = @roll_class.to_s.scan(/[^:]+$/).first.to_sym
29
+ Yuyi.send :remove_const, klass
30
+ end
31
+
32
+ it 'should define install' do
33
+ expect(@roll_class.install).to be_a Proc
34
+ end
35
+
36
+ it 'should define uninstall' do
37
+ expect(@roll_class.uninstall).to be_a Proc
38
+ end
39
+
40
+ it 'should define upgrade' do
41
+ expect(@roll_class.upgrade).to be_a Proc
42
+ end
43
+
44
+ it 'should define installed?' do
45
+ expect(@roll_class.installed?).to be_a Proc
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'ostruct'
2
+
1
3
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
2
4
  $: << File.expand_path('../../lib', __FILE__)
3
5
  $: << File.expand_path('../../rolls', __FILE__)
data/yuyi_menu ADDED
@@ -0,0 +1,8 @@
1
+ sources:
2
+ yuyi: https://github.com/brewster1134/Yuyi-Rolls/archive/master.zip
3
+ rolls:
4
+ bundler:
5
+ ruby:
6
+ versions:
7
+ - 2.1.2
8
+ ruby_gems:
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yuyi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Brewster
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-01 00:00:00.000000000 Z
11
+ date: 2014-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: new
28
+ name: guard
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: guard
42
+ name: guard-rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,21 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: guard-rspec
56
+ name: new
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
@@ -90,31 +104,39 @@ files:
90
104
  - ".gitignore"
91
105
  - ".new"
92
106
  - ".rspec"
107
+ - ".ruby-version"
93
108
  - ".travis.yml"
94
109
  - Gemfile
95
110
  - Gemfile.lock
96
111
  - Guardfile
97
112
  - README.md
98
- - bin/install
113
+ - Rakefile
99
114
  - bin/yuyi
100
115
  - lib/yuyi.rb
101
116
  - lib/yuyi/cli.rb
102
117
  - lib/yuyi/core.rb
118
+ - lib/yuyi/dsl.rb
103
119
  - lib/yuyi/menu.rb
104
120
  - lib/yuyi/roll.rb
105
121
  - lib/yuyi/source.rb
122
+ - lib/yuyi/ui.rb
106
123
  - spec/fixtures/menu.yaml
107
124
  - spec/fixtures/menu2.yaml
125
+ - spec/fixtures/roll_dir/foo_roll.rb
126
+ - spec/fixtures/roll_dir/foo_roll_model.rb
108
127
  - spec/fixtures/roll_dir/nested/bar_roll.rb
109
- - spec/fixtures/roll_dir/nested/foo_roll.rb
110
128
  - spec/fixtures/roll_zip.zip
111
129
  - spec/lib/yuyi/cli_spec.rb
112
130
  - spec/lib/yuyi/core_spec.rb
131
+ - spec/lib/yuyi/dsl_spec.rb
113
132
  - spec/lib/yuyi/menu_spec.rb
114
133
  - spec/lib/yuyi/roll_spec.rb
115
134
  - spec/lib/yuyi/source_spec.rb
135
+ - spec/lib/yuyi/ui_spec.rb
116
136
  - spec/lib/yuyi_spec.rb
137
+ - spec/roll_validator.rb
117
138
  - spec/spec_helper.rb
139
+ - yuyi_menu
118
140
  homepage: https://github.com/brewster1134/Yuyi
119
141
  licenses:
120
142
  - MIT
@@ -135,17 +157,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
157
  version: '0'
136
158
  requirements: []
137
159
  rubyforge_project:
138
- rubygems_version: 2.3.0
160
+ rubygems_version: 2.4.1
139
161
  signing_key:
140
162
  specification_version: 4
141
163
  summary: Automation for installing/uninstalling/updating your machine environment
142
164
  test_files:
165
+ - spec/fixtures/roll_dir/foo_roll.rb
166
+ - spec/fixtures/roll_dir/foo_roll_model.rb
143
167
  - spec/fixtures/roll_dir/nested/bar_roll.rb
144
- - spec/fixtures/roll_dir/nested/foo_roll.rb
145
168
  - spec/lib/yuyi/cli_spec.rb
146
169
  - spec/lib/yuyi/core_spec.rb
170
+ - spec/lib/yuyi/dsl_spec.rb
147
171
  - spec/lib/yuyi/menu_spec.rb
148
172
  - spec/lib/yuyi/roll_spec.rb
149
173
  - spec/lib/yuyi/source_spec.rb
174
+ - spec/lib/yuyi/ui_spec.rb
150
175
  - spec/lib/yuyi_spec.rb
176
+ - spec/roll_validator.rb
151
177
  - spec/spec_helper.rb
data/bin/install DELETED
@@ -1,42 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # THIS CODE INSPIRED BY (COPIED FROM) HOMEBREW'S INSTALL SCRIPT. THANKS! :)
4
-
5
- def download_app
6
- Dir.chdir install_dir do
7
- # -m to stop tar erroring out if it can't modify the mtime for root owned directories
8
- # pipefail to cause the exit status from curl to propogate if it fails
9
- # we use -k for curl because Leopard has a bunch of bad SSL certificates
10
- curl_flags = 'fsSL'
11
- curl_flags << 'k' if macos_version <= '10.5'
12
- `/bin/bash -o pipefail -c '/usr/bin/curl -#{curl_flags} https://github.com/brewster1134/Yuyi/tarball/master | /usr/bin/tar xz -m --strip 1'`
13
- end
14
- end
15
-
16
- def install
17
- system "ruby #{install_dir}/bin/yuyi"
18
- end
19
-
20
- def cleanup
21
- `rm -rf #{install_dir}`
22
- end
23
-
24
- # Create the directory to download to and install from
25
- def install_dir
26
- dir = "#{ENV['TMPDIR']}Yuyi"
27
-
28
- unless File.directory? dir
29
- `/bin/mkdir #{dir}`
30
- end
31
-
32
- dir
33
- end
34
-
35
- # Get OSX minor version
36
- def macos_version
37
- @macos_version ||= `/usr/bin/sw_vers -productVersion`.chomp[/10\.\d+/]
38
- end
39
-
40
- download_app
41
- install
42
- cleanup