make_it_so 0.0.4 → 0.0.5

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: 7edf6e86640b40baa5dbae141ad1cd9e2c6ff132
4
- data.tar.gz: 5084c958f8b8997ff9c88843f62beaebc4a66c48
3
+ metadata.gz: fc65d3862d2185b0170c51918ddd28fd7b487615
4
+ data.tar.gz: 2b9dde02bb189631381b824662003403a72dc4f6
5
5
  SHA512:
6
- metadata.gz: c0900609b3fc0df653c762e61e94c48e013ac115bf46e4d9fee294f40973fd4c013b248ad19e1707950e3bfe9a87efa064f2659571c74bad6d2929e729aa78cd
7
- data.tar.gz: 576d395e41da2034743d7b92702eaded0df70648b9ad55d4f855ae6f348ae86926287e863ead515ad9587ffb5ea8bdc663d4abdcedfcc67fbb86dd0e79999d8b
6
+ metadata.gz: bee10cbbbb3c8dd0eb04ec351d9fd78f6442573f250f475bca512ca16ea0af5a9d589ff47e5aa590b45307c8eb9d04ec664cdd39fa276997809bb5f30c9b4263
7
+ data.tar.gz: 0d36d9ded514a38a977930c9bcafb2062e134b475140162d52ef8cbbbd23748a6f59078abd3b656546d38e40a1a93270196a51cca1c91307bf36dc2e87a10b1d
data/README.md CHANGED
@@ -54,6 +54,32 @@ make_it_so sinatra <app_name>
54
54
 
55
55
  By default, the generator, will create a sinatra root complete with an RSpec configuration.
56
56
 
57
+ ### Gosu
58
+
59
+ In the terminal, run:
60
+ ```no-highlight
61
+ make_it_so gosu <app_name>
62
+ ```
63
+
64
+ By default, the generator, will create a gosu template complete with an RSpec configuration.
65
+
66
+ The tree structure looks like:
67
+
68
+ ```no-highlight
69
+ GosuGame
70
+ ├── Gemfile
71
+ ├── README.md
72
+ ├── game.rb
73
+ ├── img
74
+ ├── lib
75
+ │   ├── bounding_box.rb
76
+ │   └── keys.rb
77
+ └── spec
78
+ └── spec_helper.rb
79
+ ```
80
+
81
+ To learn more about Gosu development [read through this tutorial](https://github.com/SpencerCDixon/Gosu-Tutorial)
82
+
57
83
  ## Contributing
58
84
 
59
85
  1. Fork it ( https://github.com/[my-github-username]/make_it_so/fork )
@@ -0,0 +1,80 @@
1
+ module MakeItSo
2
+ class GosuAppGenerator < Thor::Group
3
+ include Thor::Actions
4
+
5
+ desc "Creates a new Gosu game"
6
+ argument :name,
7
+ type: :string,
8
+ desc: "The name of the new application"
9
+
10
+ class_option :rspec,
11
+ type: :boolean,
12
+ default: true,
13
+ desc: 'install rspec'
14
+
15
+ def directories
16
+ [
17
+ 'lib',
18
+ 'spec',
19
+ 'img'
20
+ ].each do |dir|
21
+ empty_directory File.join(app_path, dir)
22
+ end
23
+ end
24
+
25
+ def app_file
26
+ file_path = 'app.rb'
27
+ template(file_path, File.join(app_path, file_path))
28
+ end
29
+
30
+ def readme
31
+ file_path = 'README.md'
32
+ template(file_path, File.join(app_path, file_path))
33
+ end
34
+
35
+ def lib
36
+ [
37
+ 'lib/keys.rb',
38
+ 'lib/bounding_box.rb'
39
+ ].each do |file_path|
40
+ template(file_path, File.join(app_path, file_path))
41
+ end
42
+ end
43
+
44
+ def gemfile
45
+ file_path = 'Gemfile'
46
+ template(file_path, File.join(app_path, file_path))
47
+ end
48
+
49
+ def gitignore
50
+ file_path = '.gitignore'
51
+ template(file_path, File.join(app_path, file_path))
52
+ end
53
+
54
+ def rspec
55
+ if options.rspec?
56
+ spec_helper = 'spec/spec_helper.rb'
57
+ template(spec_helper, File.join(app_path, spec_helper))
58
+
59
+ dot_rspec = '.rspec'
60
+ template(dot_rspec, File.join(app_path, dot_rspec))
61
+ end
62
+ end
63
+
64
+ def self.source_root
65
+ template_path = File.join(
66
+ File.dirname(__FILE__),
67
+ "..",
68
+ "..",
69
+ "templates",
70
+ "gosu")
71
+
72
+ File.expand_path(template_path)
73
+ end
74
+
75
+ protected
76
+ def app_path
77
+ name
78
+ end
79
+ end
80
+ end
@@ -15,5 +15,12 @@ module MakeItSo
15
15
  puts "#{args.first}"
16
16
  MakeItSo::SinatraAppGenerator.start(args)
17
17
  end
18
+
19
+ desc "gosu <app_name>",
20
+ "generates a gosu game template"
21
+ def gosu(*args)
22
+ puts "#{args.first}"
23
+ MakeItSo::GosuAppGenerator.start(args)
24
+ end
18
25
  end
19
26
  end
@@ -1,3 +1,3 @@
1
1
  module MakeItSo
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/make_it_so.rb CHANGED
@@ -12,3 +12,4 @@ require "make_it_so/rails"
12
12
  require "make_it_so/command_line_interface"
13
13
  require "generators/rails_app_generator"
14
14
  require "generators/sinatra_app_generator"
15
+ require "generators/gosu_app_generator"
data/make_it_so.gemspec CHANGED
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "rspec"
28
28
  spec.add_development_dependency "capybara"
29
+ spec.add_development_dependency "pry"
29
30
  end
@@ -0,0 +1,84 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'user generates gosu app' do
4
+ def app_name
5
+ 'dummy_gosu'
6
+ end
7
+
8
+ def app_path
9
+ join_paths(tmp_path, app_name)
10
+ end
11
+
12
+ before(:all) do
13
+ make_it_so!("gosu #{app_path}")
14
+ end
15
+
16
+ scenario 'includes gosu in the app.rb file' do
17
+ expect(FileTest.exists?(join_paths(app_path, 'app.rb'))).
18
+ to be(true)
19
+ end
20
+
21
+ scenario 'creates a lib directory' do
22
+ expect(has_dir?('lib')).to be(true)
23
+ end
24
+
25
+ scenario 'creates a img directory' do
26
+ expect(has_dir?('img')).to be(true)
27
+ end
28
+
29
+ scenario 'creates a README' do
30
+ expect(has_file?('README.md')).to be(true)
31
+ end
32
+
33
+ scenario 'creates a lib/keys module' do
34
+ expect(has_file?('lib/keys.rb')).to be(true)
35
+ end
36
+
37
+ scenario 'creates bounding box' do
38
+ expect(has_file?('lib/bounding_box.rb')).to be(true)
39
+ end
40
+
41
+ scenario '.gitignore' do
42
+ expect(has_file?('.gitignore')).to be(true)
43
+ end
44
+
45
+ context 'Gemfile' do
46
+ scenario 'includes a Gemfile' do
47
+ expect(has_file?('Gemfile')).to be(true)
48
+ end
49
+
50
+ scenario 'includes gosu in the Gemfile' do
51
+ expect(in_gemfile?('gosu')).
52
+ to be(true)
53
+ end
54
+
55
+ scenario 'includes pry in the Gemfile' do
56
+ expect(in_gemfile?('pry')).
57
+ to be(true)
58
+ end
59
+
60
+ scenario 'includes rspec in the Gemfile' do
61
+ expect(in_gemfile?('rspec')).
62
+ to be(true)
63
+ end
64
+ end
65
+
66
+ context 'rspec' do
67
+ scenario 'creates a spec_helper' do
68
+ expect(has_file?('spec/spec_helper.rb')).to be(true)
69
+ end
70
+
71
+ scenario 'creates a .rspec file' do
72
+ expect(has_file?('.rspec')).to be(true)
73
+ end
74
+
75
+ scenario 'creates a spec directory' do
76
+ expect(has_dir?('spec')).to be(true)
77
+ end
78
+
79
+ scenario 'includes rspec as a dependency' do
80
+ expect(in_gemfile?('rspec')).to be(true)
81
+ end
82
+ end
83
+ end
84
+
@@ -100,17 +100,4 @@ describe 'user generates sinatra app' do
100
100
  expect(in_gemfile?('launchy')).to be(true)
101
101
  end
102
102
  end
103
-
104
- def has_dir?(relative_path)
105
- File.directory?(join_paths(app_path, relative_path))
106
- end
107
-
108
- def has_file?(relative_path)
109
- FileTest.exists?(join_paths(app_path, relative_path))
110
- end
111
-
112
- def in_gemfile?(gem_name)
113
- File.read(join_paths(app_path, 'Gemfile')).
114
- match(/gem.*#{Regexp.escape(gem_name)}/).present?
115
- end
116
103
  end
@@ -31,6 +31,19 @@ module MakeItSoSpecHelpers
31
31
  def join_paths(*paths)
32
32
  File.join(*paths)
33
33
  end
34
+
35
+ def has_dir?(relative_path)
36
+ File.directory?(join_paths(app_path, relative_path))
37
+ end
38
+
39
+ def has_file?(relative_path)
40
+ FileTest.exists?(join_paths(app_path, relative_path))
41
+ end
42
+
43
+ def in_gemfile?(gem_name)
44
+ File.read(join_paths(app_path, 'Gemfile')).
45
+ match(/gem.*#{Regexp.escape(gem_name)}/).present?
46
+ end
34
47
  end
35
48
 
36
49
  RSpec.configure do |config|
File without changes
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'gosu'
4
+ gem 'pry'
5
+ gem 'rspec'
@@ -0,0 +1,22 @@
1
+ require 'gosu'
2
+ require_relative 'lib/keys'
3
+
4
+ class Game < Gosu::Window
5
+ include Keys
6
+ SCREEN_HEIGHT = 1000
7
+ SCREEN_WIDTH = 1000
8
+
9
+ def initialize
10
+ super(SCREEN_WIDTH, SCREEN_HEIGHT, false)
11
+ end
12
+
13
+ def draw
14
+
15
+ end
16
+
17
+ def update
18
+
19
+ end
20
+ end
21
+
22
+ Game.new.show
@@ -0,0 +1,21 @@
1
+ class BoundingBox
2
+ attr_reader :left, :bottom, :width, :height, :right, :top
3
+
4
+ def initialize(left, bottom, width, height)
5
+ @left = left
6
+ @bottom = bottom
7
+ @width = width
8
+ @height = height
9
+ @right = @left + @width
10
+ @top = @bottom + @height
11
+ end
12
+
13
+ def collide?(x, y)
14
+ x >= left && x <= right && y >= bottom && y <= top
15
+ end
16
+
17
+ def intersects?(box)
18
+ self.right > box.left && self.bottom < box.top && self.left < box.right && self.top > box.bottom
19
+ end
20
+ end
21
+
@@ -0,0 +1,7 @@
1
+ module Keys
2
+ def button_up(id)
3
+ end
4
+
5
+ def button_down(id)
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ # Gosu Game
2
+
3
+ This is a game written in Ruby using the Gosu Framework.
@@ -0,0 +1,4 @@
1
+ require 'pry'
2
+ require 'rspec'
3
+
4
+ require_relative '../game.rb'
@@ -6,7 +6,7 @@ feature 'user signs out', %Q{
6
6
  So that my identity is forgotten about on the machine I'm using
7
7
  } do
8
8
  # Acceptance Criteria
9
- # * If I'm signed in, i have an option to sign out
9
+ # * If I'm signed in, I have an option to sign out
10
10
  # * When I opt to sign out, I get a confirmation that my identity has been
11
11
  # forgotten on the machine I'm using
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: make_it_so
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Pickett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-18 00:00:00.000000000 Z
11
+ date: 2015-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: Generate ruby gems, sinatra apps, and rails apps
112
126
  email:
113
127
  - dan.pickett@launchacademy.com
@@ -123,7 +137,6 @@ files:
123
137
  - LICENSE.txt
124
138
  - README.md
125
139
  - Rakefile
126
- - app.rb
127
140
  - bin/make_it_so
128
141
  - gemfiles/rails_4_0.gemfile
129
142
  - gemfiles/rails_4_0.gemfile.lock
@@ -131,6 +144,7 @@ files:
131
144
  - gemfiles/rails_4_1.gemfile.lock
132
145
  - gemfiles/rails_4_2.gemfile
133
146
  - gemfiles/rails_4_2.gemfile.lock
147
+ - lib/generators/gosu_app_generator.rb
134
148
  - lib/generators/rails_app_generator.rb
135
149
  - lib/generators/sinatra_app_generator.rb
136
150
  - lib/make_it_so.rb
@@ -141,11 +155,20 @@ files:
141
155
  - make_it_so.gemspec
142
156
  - snippets/rails/application_generator.rb
143
157
  - snippets/rails/user_factory.rb
158
+ - spec/features/user_generates_gosu_spec.rb
144
159
  - spec/features/user_generates_rails_spec.rb
145
160
  - spec/features/user_generates_sinatra_spec.rb
146
161
  - spec/spec_helper.rb
147
162
  - spec/support/make_it_so_spec_helpers.rb
148
163
  - templates/.gitkeep
164
+ - templates/gosu/.gitignore
165
+ - templates/gosu/.rspec
166
+ - templates/gosu/Gemfile
167
+ - templates/gosu/app.rb
168
+ - templates/gosu/lib/bounding_box.rb
169
+ - templates/gosu/lib/keys.rb
170
+ - templates/gosu/readme.md
171
+ - templates/gosu/spec/spec_helper.rb
149
172
  - templates/rails/.gitkeep
150
173
  - templates/rails/app/controllers/application_controller.rb
151
174
  - templates/rails/app/controllers/homes_controller.rb
@@ -185,11 +208,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
208
  version: '0'
186
209
  requirements: []
187
210
  rubyforge_project:
188
- rubygems_version: 2.2.2
211
+ rubygems_version: 2.4.5
189
212
  signing_key:
190
213
  specification_version: 4
191
214
  summary: An application generator for all things ruby
192
215
  test_files:
216
+ - spec/features/user_generates_gosu_spec.rb
193
217
  - spec/features/user_generates_rails_spec.rb
194
218
  - spec/features/user_generates_sinatra_spec.rb
195
219
  - spec/spec_helper.rb
data/app.rb DELETED
@@ -1,20 +0,0 @@
1
- require 'sinatra'
2
- require 'sinatra/reloader'
3
-
4
- configure :development, :test do
5
- require 'pry'
6
- end
7
-
8
- configure do
9
- set :views, 'app/views'
10
- end
11
-
12
- Dir[File.join(File.dirname(__FILE__), 'lib', '**', '*.rb')].each do |file|
13
- require file
14
- also_reload file
15
- end
16
-
17
- get '/' do
18
- @title = "Hello World"
19
- erb :index
20
- end