createproj 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/lib/createproj/creator/creator.rb +4 -1
- data/lib/createproj/creator/rails.rb +38 -5
- data/lib/createproj/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f02e3b4cad72ddf32641b0b2d2b44489a4094d25
|
4
|
+
data.tar.gz: 002a9b696fde325b4b8effa3ad1b5d184e3f93f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88f59554b99aeb5314807e31c45db76741f122ec313e0716dabc17ac8775df3859a20cf303e39cbb5f6ebd76e7e04a4c18e60bf4972941e7858ad70d3d3b73f5
|
7
|
+
data.tar.gz: 4265e90d15ec1b8f9cd93fcbc648ac1a56c55bcb1a6c508b5b7de69094f324bbe4470467ae1d432ba745014853375a0450be43fa70808342fc23e87829fbd5f5
|
data/README.md
CHANGED
@@ -22,14 +22,19 @@ Once run, createproj will:
|
|
22
22
|
- Create the project directory
|
23
23
|
- Initialize a git repository with a language specified .gitignore and language specified git pre-commit hook (right now both are linters)
|
24
24
|
- Create a sandbox
|
25
|
-
- Ruby: rvm gemset
|
25
|
+
- Ruby, Rails: rvm gemset
|
26
26
|
- Haskell: cabal sandbox
|
27
27
|
- Python: virtualenv environment
|
28
28
|
- Install default dependencies in the sandbox
|
29
|
-
- Ruby: rubocop, yard, rspec
|
29
|
+
- Ruby, Rails: rubocop, yard, rspec
|
30
30
|
- Haskell: happy, hlint
|
31
31
|
- Python: pylint,
|
32
32
|
|
33
|
+
## Options
|
34
|
+
For a variety of projects options can be set through the command line.
|
35
|
+
- Rails
|
36
|
+
- `-d, --database, the desired rails database`
|
37
|
+
|
33
38
|
## Steps for building/publish gem
|
34
39
|
- From `createproj` directory, run:
|
35
40
|
- `rake gem:build` to build the gem
|
@@ -81,7 +81,10 @@ module CreateProj
|
|
81
81
|
def gitignore(ignore_files)
|
82
82
|
return if ignore_files.empty?
|
83
83
|
|
84
|
-
|
84
|
+
file_mode = 'a'
|
85
|
+
file_mode = 'w+' unless File.exist?('.gitignore')
|
86
|
+
|
87
|
+
File.open('.gitignore', file_mode) do |f|
|
85
88
|
ignore_files.each do |gf|
|
86
89
|
f.write("#{gf}\n")
|
87
90
|
end
|
@@ -2,15 +2,48 @@ module CreateProj
|
|
2
2
|
module Creator
|
3
3
|
# Class for creating Rails project
|
4
4
|
class RailsCreator < RubyCreator
|
5
|
-
def initialize
|
6
|
-
super
|
5
|
+
def initialize(*args)
|
6
|
+
super(*args)
|
7
7
|
@precommit_template = 'lint-pre-commit'
|
8
8
|
@precommit_options = { linter: 'rubocop', file_ext: '.rb' }
|
9
9
|
end
|
10
10
|
|
11
|
-
#
|
12
|
-
|
13
|
-
|
11
|
+
# Create a new directory using rails create
|
12
|
+
#
|
13
|
+
# @param [String] name the directory name
|
14
|
+
#
|
15
|
+
# @example Create a new directory
|
16
|
+
# create_directory("proj") #=> 'proj' (and rails new proj)
|
17
|
+
#
|
18
|
+
# @return name of directory just created
|
19
|
+
def create_directory(name)
|
20
|
+
options_db = options[:database]
|
21
|
+
database = "--database=#{options_db}" unless options_db.nil?
|
22
|
+
|
23
|
+
# -T skip test
|
24
|
+
# -B skip bundle install
|
25
|
+
rails_args = "-B -T #{database}"
|
26
|
+
system("rails new #{name} #{rails_args}")
|
27
|
+
|
28
|
+
name
|
29
|
+
end
|
30
|
+
|
31
|
+
# Installs dependencies in the new sandbox - appends to rails gemfile
|
32
|
+
#
|
33
|
+
# @example Write rubocop to a gemfile and prompt `bundle install`
|
34
|
+
# install_dependencies #=> rubocop written in Gemfile
|
35
|
+
#
|
36
|
+
# @return Nothing
|
37
|
+
def install_dependencies
|
38
|
+
# append to the gem file
|
39
|
+
File.open('Gemfile', 'a') do |f|
|
40
|
+
@gems_to_install.each do |k, v|
|
41
|
+
f.write("gem '#{k}', '~> #{v}'\n")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
command = 'Enter the directory and run bundle install.'
|
46
|
+
puts command
|
14
47
|
end
|
15
48
|
end
|
16
49
|
end
|
data/lib/createproj/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: createproj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt McNaughton
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - ~>
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 0.18.1
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rails
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ~>
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 4.2.0
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ~>
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 4.2.0
|
153
167
|
description: Simple project creation gem.
|
154
168
|
email:
|
155
169
|
- mattjmcnaughton@gmail.com
|