make_it_so 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d301c85dbcb436020137a3aa762ba0b12e644247
4
+ data.tar.gz: f32477cf05fde180f925743f6aab3b6b094205d4
5
+ SHA512:
6
+ metadata.gz: 57843769cc1bed8f88e31fdcc2c3048ba74e0123648be87128ea090d5285506e450e316cd2c2bb57d84425185417234e59b330420992315e14d1ca90aabc9acc
7
+ data.tar.gz: e004da0a24866b66293b529d3cac1d3410107acd7cd2c87339144ea977a65359a88b70a4c2cca329b57f2318c46ee25a43acb10a2572c59d0e19f03725defeff
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in make_it_so.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'pry'
8
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Dan Pickett
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # MakeItSo
2
+
3
+ ![Make It So](http://images.simplysyndicated.com/wp-content/uploads/2014/07/make-it-so-captain.jpg)
4
+
5
+ Make It So is a command line utility that makes it easy to create starting points
6
+ for all apps ruby. Right now, it only supports Rails, but support for Sinatra,
7
+ Gosu, and other paradigms are in progress.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'make_it_so'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install make_it_so
24
+
25
+ ## Usage
26
+
27
+ ```ruby
28
+ make_it_so rails <app_name>
29
+ ```
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it ( https://github.com/[my-github-username]/make_it_so/fork )
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new(:rspec)
5
+
6
+ desc 'Run the test suite'
7
+ task :default => :rspec
8
+
9
+ task :console do
10
+ require 'irb'
11
+ require 'irb/completion'
12
+ require 'make_it_so' # You know what to do.
13
+ ARGV.clear
14
+ IRB.start
15
+ end
data/bin/make_it_so ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
3
+ require 'make_it_so'
4
+
5
+ MakeItSo::CommandLineInterface.start(ARGV)
@@ -0,0 +1,54 @@
1
+ require 'rails/generators/rails/app/app_generator'
2
+
3
+ module MakeItSo
4
+ class RailsAppGenerator < ::Rails::Generators::AppGenerator
5
+ source_root(MakeItSo.source_root(:rails))
6
+
7
+ class_option :rspec,
8
+ type: :boolean,
9
+ default: true,
10
+ desc: 'install rspec'
11
+
12
+ class_option :devise,
13
+ type: :boolean,
14
+ default: true,
15
+ desc: 'install devise: complete with acceptance tests'
16
+
17
+ #override database to default to postgres
18
+ class_option :database,
19
+ type: :string,
20
+ aliases: '-d',
21
+ default: 'postgresql',
22
+ desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
23
+
24
+ def initialize(*args)
25
+ super
26
+ if @options[:rspec]
27
+ # don't generate Test::Unit - we have to dup to unfreeze
28
+ @options = @options.dup
29
+ @options[:skip_test_unit] = true
30
+ end
31
+ end
32
+
33
+ def finish_template
34
+ super
35
+ if options[:rspec]
36
+ build 'rspec_dependency'
37
+ end
38
+ end
39
+
40
+ protected
41
+
42
+ def get_builder_class
43
+ MakeItSo::Rails::AppBuilder
44
+ end
45
+
46
+ end
47
+ end
48
+
49
+ [
50
+ MakeItSo.source_root(:rails),
51
+ Rails::Generators::AppGenerator.source_root
52
+ ].each do |path|
53
+ MakeItSo::RailsAppGenerator.source_paths << path
54
+ end
@@ -0,0 +1,11 @@
1
+ require 'thor'
2
+ module MakeItSo
3
+ class CommandLineInterface < Thor
4
+ desc "rails <app_name>", "generates a rails application based on your specifications"
5
+ option :devise
6
+ def rails(app_name)
7
+ puts "#{app_name}"
8
+ MakeItSo::RailsAppGenerator.start([app_name])
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,17 @@
1
+ require 'rails/generators/rails/app/app_generator'
2
+
3
+ module MakeItSo
4
+ module Rails
5
+ class AppBuilder < ::Rails::AppBuilder
6
+ def rspec_dependency
7
+ self.gem 'rspec-rails', group: [:development, :test]
8
+ after_bundle do
9
+ #stop spring in case it is running - it will hang
10
+ #https://github.com/rails/rails/issues/13381
11
+ run 'spring stop'
12
+ generate 'rspec:install'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,6 @@
1
+ require 'make_it_so/rails/app_builder'
2
+
3
+ module MakeItSo
4
+ module Rails
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module MakeItSo
2
+ VERSION = "0.0.1"
3
+ end
data/lib/make_it_so.rb ADDED
@@ -0,0 +1,13 @@
1
+ module MakeItSo
2
+ def self.source_root(template_category = nil)
3
+ root = File.join(File.dirname(__FILE__), '../templates')
4
+ template_category.nil? ? root : File.join(root, template_category.to_s)
5
+ end
6
+ end
7
+
8
+ require "make_it_so/version"
9
+
10
+ require "make_it_so/rails"
11
+
12
+ require "make_it_so/command_line_interface"
13
+ require "generators/rails_app_generator"
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'make_it_so/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "make_it_so"
8
+ spec.version = MakeItSo::VERSION
9
+ spec.authors = ["Dan Pickett"]
10
+ spec.email = ["dan.pickett@launchacademy.com"]
11
+ spec.summary = %q{An application generator for all things ruby}
12
+ spec.description = %q{Generate ruby gems, sinatra apps, and rails apps}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "thor"
22
+ spec.add_dependency "railties"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.7"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "capybara"
28
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ feature 'user generates rails app' do
4
+ def app_name
5
+ 'dummy_rails'
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!("rails #{app_name}")
14
+ end
15
+
16
+ scenario 'generates a rails app' do
17
+ expect(FileTest.exists?(join_paths(app_path, 'app/models'))).to eq(true)
18
+ end
19
+
20
+ context 'rspec' do
21
+ it 'eliminates test/unit' do
22
+ expect(FileTest.exists?(join_paths(app_path, 'test'))).to_not eq(true)
23
+ end
24
+
25
+ it 'inserts a spec_helper' do
26
+ spec_helper = join_paths(app_path, 'spec/spec_helper.rb')
27
+ expect(FileTest.exists?(spec_helper)).to eq(true)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ require 'bundler/setup'
2
+ require 'rspec'
3
+ require 'capybara/rspec'
4
+
5
+ Bundler.require(:default, :test)
6
+
7
+ require File.join(File.dirname(__FILE__), '../lib/make_it_so')
8
+
9
+ require File.join(File.dirname(__FILE__), 'support/make_it_so_spec_helpers')
@@ -0,0 +1,47 @@
1
+ module MakeItSoSpecHelpers
2
+ def make_it_so!(subcommand_with_args)
3
+ Dir.chdir(tmp_path) do
4
+ Bundler.with_clean_env do
5
+ `#{join_paths(bin_path, 'make_it_so')} #{subcommand_with_args}`
6
+ end
7
+ end
8
+ end
9
+
10
+ def make_tmp_path
11
+ FileUtils.mkdir_p(tmp_path)
12
+ end
13
+
14
+ def purge_tmp_dir
15
+ FileUtils.rm_rf(tmp_path)
16
+ end
17
+
18
+ protected
19
+ def bin_path
20
+ join_paths(root_path, 'bin')
21
+ end
22
+
23
+ def tmp_path
24
+ '/tmp/make_it_so'
25
+ end
26
+
27
+ def root_path
28
+ join_paths(File.dirname(__FILE__), '../../')
29
+ end
30
+
31
+ def join_paths(*paths)
32
+ File.join(*paths)
33
+ end
34
+ end
35
+
36
+ RSpec.configure do |config|
37
+ config.include(MakeItSoSpecHelpers)
38
+
39
+ config.before(:all) do
40
+ purge_tmp_dir
41
+ make_tmp_path
42
+ end
43
+
44
+ config.after(:all) do
45
+ purge_tmp_dir
46
+ end
47
+ end
File without changes
File without changes
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: make_it_so
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-12-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: railties
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
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: capybara
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: Generate ruby gems, sinatra apps, and rails apps
98
+ email:
99
+ - dan.pickett@launchacademy.com
100
+ executables:
101
+ - make_it_so
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - bin/make_it_so
112
+ - lib/generators/rails_app_generator.rb
113
+ - lib/make_it_so.rb
114
+ - lib/make_it_so/command_line_interface.rb
115
+ - lib/make_it_so/rails.rb
116
+ - lib/make_it_so/rails/app_builder.rb
117
+ - lib/make_it_so/version.rb
118
+ - make_it_so.gemspec
119
+ - spec/features/user_generates_rails_spec.rb
120
+ - spec/spec_helper.rb
121
+ - spec/support/make_it_so_spec_helpers.rb
122
+ - templates/.gitkeep
123
+ - templates/rails/.gitkeep
124
+ homepage: ''
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.2.2
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: An application generator for all things ruby
148
+ test_files:
149
+ - spec/features/user_generates_rails_spec.rb
150
+ - spec/spec_helper.rb
151
+ - spec/support/make_it_so_spec_helpers.rb