gemaker 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/gemaker.rb +1 -0
- data/lib/gemaker/cli.rb +6 -3
- data/lib/gemaker/commands/configure_git.rb +13 -2
- data/lib/gemaker/commands/configure_test_env.rb +2 -0
- data/lib/gemaker/commands/configure_travis.rb +15 -0
- data/lib/gemaker/commands/create_gem.rb +12 -3
- data/lib/gemaker/templates/coveralls.yml +1 -0
- data/lib/gemaker/templates/engine/gemspec.erb +1 -0
- data/lib/gemaker/templates/engine/gitignore +9 -0
- data/lib/gemaker/templates/engine/rails_helper.rb.erb +20 -0
- data/lib/gemaker/templates/engine/travis.yml.erb +15 -0
- data/lib/gemaker/templates/normal/gemspec.erb +1 -0
- data/lib/gemaker/templates/normal/spec_helper.rb.erb +11 -0
- data/lib/gemaker/templates/normal/travis.yml.erb +13 -0
- data/lib/gemaker/version.rb +2 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e787726b7c913489c1086c2d777e2ec8d33e0af0
|
4
|
+
data.tar.gz: 4f71e2c8f7c5c70387a1b427973b9b02ceb84de7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41bceb695dca4957991e586e8fabc64070781067d413a6730885906e70be2dc23bfac1191c1ddb2837e5304a14db90825ca410255a3eb2b20c1faa20aee2b843
|
7
|
+
data.tar.gz: 7b4b51862cf98ce53d67970629e90b025e8fe2f630cbb54862e28bd8aba912150440fd24a7392da5a4310ac62c9fb29deefce7f7227a2c2ab1bcdd30bea9a5a2
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,17 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
### v0.4.0
|
6
|
+
|
7
|
+
##### Added
|
8
|
+
|
9
|
+
* Add command to configure Travis CI.
|
10
|
+
* Change test command to configure coveralls.
|
11
|
+
|
12
|
+
##### Fixed
|
13
|
+
|
14
|
+
* Run engine creation with specific Rails version to avoid unsupported Rails 5 structure.
|
15
|
+
|
5
16
|
### v0.3.0
|
6
17
|
|
7
18
|
##### Added
|
data/lib/gemaker.rb
CHANGED
@@ -21,6 +21,7 @@ require "gemaker/commands/customize_rakefile"
|
|
21
21
|
require "gemaker/commands/customize_main_lib_file"
|
22
22
|
require "gemaker/commands/add_install_generator"
|
23
23
|
require "gemaker/commands/add_hound_rules"
|
24
|
+
require "gemaker/commands/configure_travis"
|
24
25
|
|
25
26
|
module Gemaker
|
26
27
|
end
|
data/lib/gemaker/cli.rb
CHANGED
@@ -34,14 +34,17 @@ module Gemaker
|
|
34
34
|
end
|
35
35
|
|
36
36
|
config.human_gem_name = ask(
|
37
|
-
"Enter the human readable version of the name. e.g. \"#{config.human_gem_name}\":"
|
37
|
+
"Enter the human readable version of the name. e.g. \"#{config.human_gem_name}\":"
|
38
|
+
)
|
38
39
|
config.summary = ask("Enter gem's summary: ")
|
39
40
|
config.description = ask("Enter gem's description: ")
|
40
41
|
config.homepage = ask(
|
41
|
-
"Enter gem's homepage. e.g. https://github.com/platanus/#{config.gem_name}: "
|
42
|
+
"Enter gem's homepage. e.g. https://github.com/platanus/#{config.gem_name}: "
|
43
|
+
)
|
42
44
|
config.authors = ask("Enter gem's authors. e.g. Sherlock Holmes,James Moriarty: ")
|
43
45
|
config.emails = ask(
|
44
|
-
"Enter the authors' emails. e.g. sherlock@platan.us,james@platan.us: "
|
46
|
+
"Enter the authors' emails. e.g. sherlock@platan.us,james@platan.us: "
|
47
|
+
)
|
45
48
|
config.engine = agree("Is the gem a Rails engine?")
|
46
49
|
|
47
50
|
if config.engine?
|
@@ -1,8 +1,19 @@
|
|
1
1
|
module Gemaker
|
2
2
|
module Cmd
|
3
3
|
class ConfigureGit < Gemaker::Cmd::Base
|
4
|
-
def
|
5
|
-
remove_in_gem(".git")
|
4
|
+
def in_normal_context
|
5
|
+
remove_in_gem(".git")
|
6
|
+
do_initial_commit
|
7
|
+
end
|
8
|
+
|
9
|
+
def in_engine_context
|
10
|
+
copy_file("engine/gitignore", ".gitignore")
|
11
|
+
do_initial_commit
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def do_initial_commit
|
6
17
|
execute_in_gem("git init")
|
7
18
|
execute_in_gem("bundle install")
|
8
19
|
execute_in_gem("git add .")
|
@@ -4,6 +4,7 @@ module Gemaker
|
|
4
4
|
def in_normal_context
|
5
5
|
copy_template("normal/spec_helper.rb", "spec/spec_helper.rb", config: @config)
|
6
6
|
copy_file("test_helpers.rb", "spec/support/test_helpers.rb")
|
7
|
+
copy_file("coveralls.yml", ".coveralls.yml")
|
7
8
|
copy_template("normal/test_example.rb", "spec/#{@config.gem_name}_spec.rb", config: @config)
|
8
9
|
copy_file("normal/Guardfile", "Guardfile")
|
9
10
|
info "Configure Rspec"
|
@@ -16,6 +17,7 @@ module Gemaker
|
|
16
17
|
"spec/dummy/spec/#{@config.gem_name}_spec.rb", config: @config)
|
17
18
|
create_dir("spec/dummy/spec/factories")
|
18
19
|
copy_file("test_helpers.rb", "spec/dummy/spec/support/test_helpers.rb")
|
20
|
+
copy_file("coveralls.yml", ".coveralls.yml")
|
19
21
|
copy_file("image.png", "spec/dummy/spec/assets/image.png")
|
20
22
|
copy_file("video.mp4", "spec/dummy/spec/assets/video.mp4")
|
21
23
|
copy_file("engine/rspec", ".rspec")
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Gemaker
|
2
|
+
module Cmd
|
3
|
+
class ConfigureTravis < Gemaker::Cmd::Base
|
4
|
+
def in_normal_context
|
5
|
+
copy_template("normal/travis.yml", ".travis.yml", config: @config)
|
6
|
+
info "Configure Tavis"
|
7
|
+
end
|
8
|
+
|
9
|
+
def in_engine_context
|
10
|
+
copy_template("engine/travis.yml", ".travis.yml", config: @config)
|
11
|
+
info "Configure Tavis"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -3,9 +3,16 @@ module Gemaker
|
|
3
3
|
class CreateGem < Gemaker::Cmd::Base
|
4
4
|
def in_engine_context
|
5
5
|
mountable_opt = "--mountable" if @config.mountable?
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
|
7
|
+
commands = [
|
8
|
+
"echo \"source 'https://rubygems.org'\" > GemakerGemfile",
|
9
|
+
"echo \"gem 'rails', '~> #{Gemaker::RAILS_VERSION}'\" > GemakerGemfile",
|
10
|
+
"BUNDLE_GEMFILE=GemakerGemfile bundle install",
|
11
|
+
"BUNDLE_GEMFILE=GemakerGemfile bundle exec rails plugin new #{@config.gem_name} -T #{mountable_opt} --dummy-path=spec/dummy", # rubocop:disable Metrics/LineLength
|
12
|
+
"rm -f GemakerGemfile GemakerGemfile.lock"
|
13
|
+
]
|
14
|
+
|
15
|
+
create_customized_gem(commands.join('; '))
|
9
16
|
end
|
10
17
|
|
11
18
|
def in_normal_context
|
@@ -14,6 +21,7 @@ module Gemaker
|
|
14
21
|
|
15
22
|
private
|
16
23
|
|
24
|
+
# rubocop:disable Metrics/MethodLength
|
17
25
|
def create_customized_gem(cmd)
|
18
26
|
execute(cmd)
|
19
27
|
Gemaker::Cmd::AddReadme.for(config: @config)
|
@@ -28,6 +36,7 @@ module Gemaker
|
|
28
36
|
Gemaker::Cmd::CustomizeMainLibFile.for(config: @config)
|
29
37
|
Gemaker::Cmd::AddInstallGenerator.for(config: @config)
|
30
38
|
Gemaker::Cmd::AddHoundRules.for(config: @config)
|
39
|
+
Gemaker::Cmd::ConfigureTravis.for(config: @config)
|
31
40
|
Gemaker::Cmd::ConfigureGit.for(config: @config)
|
32
41
|
info("Done!")
|
33
42
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
@@ -1,3 +1,23 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
|
4
|
+
formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
|
5
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter::new(formatters)
|
6
|
+
|
7
|
+
SimpleCov.start do
|
8
|
+
add_filter do |src|
|
9
|
+
r = [
|
10
|
+
src.filename =~ /lib/,
|
11
|
+
src.filename =~ /models/,
|
12
|
+
src.filename =~ /controllers/
|
13
|
+
].uniq
|
14
|
+
r.count == 1 && r.first.nil?
|
15
|
+
end
|
16
|
+
|
17
|
+
add_filter "engine.rb"
|
18
|
+
add_filter "spec.rb"
|
19
|
+
end
|
20
|
+
|
1
21
|
ENV["RAILS_ENV"] ||= "test"
|
2
22
|
require File.expand_path("../../spec/dummy/config/environment", __FILE__)
|
3
23
|
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
@@ -0,0 +1,15 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 2.3.1
|
5
|
+
script:
|
6
|
+
- RAILS_ENV=test bundle exec rake db:create db:migrate
|
7
|
+
- bundle exec rspec spec
|
8
|
+
deploy:
|
9
|
+
provider: rubygems
|
10
|
+
api_key:
|
11
|
+
secure: your_secure_secret
|
12
|
+
gem: <%= config.gem_name %>
|
13
|
+
on:
|
14
|
+
tags: true
|
15
|
+
repo: platanus/<%= config.gem_name %>
|
@@ -1,3 +1,14 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
|
4
|
+
formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
|
5
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter::new(formatters)
|
6
|
+
|
7
|
+
SimpleCov.start do
|
8
|
+
add_filter { |src| !(src.filename =~ /lib/) }
|
9
|
+
add_filter "spec.rb"
|
10
|
+
end
|
11
|
+
|
1
12
|
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
2
13
|
require "<%= config.gem_name %>"
|
3
14
|
require "pry"
|
data/lib/gemaker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Segovia
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: power-types
|
@@ -202,6 +202,7 @@ files:
|
|
202
202
|
- lib/gemaker/commands/base.rb
|
203
203
|
- lib/gemaker/commands/configure_git.rb
|
204
204
|
- lib/gemaker/commands/configure_test_env.rb
|
205
|
+
- lib/gemaker/commands/configure_travis.rb
|
205
206
|
- lib/gemaker/commands/create_gem.rb
|
206
207
|
- lib/gemaker/commands/customize_engine.rb
|
207
208
|
- lib/gemaker/commands/customize_gemspec.rb
|
@@ -211,12 +212,14 @@ files:
|
|
211
212
|
- lib/gemaker/templates/CHANGELOG.md
|
212
213
|
- lib/gemaker/templates/LICENSE.txt.erb
|
213
214
|
- lib/gemaker/templates/cli.rb.erb
|
215
|
+
- lib/gemaker/templates/coveralls.yml
|
214
216
|
- lib/gemaker/templates/engine/Guardfile
|
215
217
|
- lib/gemaker/templates/engine/README.md.erb
|
216
218
|
- lib/gemaker/templates/engine/Rakefile
|
217
219
|
- lib/gemaker/templates/engine/engine.rb.erb
|
218
220
|
- lib/gemaker/templates/engine/example_class.rb.erb
|
219
221
|
- lib/gemaker/templates/engine/gemspec.erb
|
222
|
+
- lib/gemaker/templates/engine/gitignore
|
220
223
|
- lib/gemaker/templates/engine/initializer.rb.erb
|
221
224
|
- lib/gemaker/templates/engine/install_generator.rb.erb
|
222
225
|
- lib/gemaker/templates/engine/install_usage.erb
|
@@ -225,6 +228,7 @@ files:
|
|
225
228
|
- lib/gemaker/templates/engine/rspec
|
226
229
|
- lib/gemaker/templates/engine/spec_helper.rb.erb
|
227
230
|
- lib/gemaker/templates/engine/test_example.rb.erb
|
231
|
+
- lib/gemaker/templates/engine/travis.yml.erb
|
228
232
|
- lib/gemaker/templates/exe.erb
|
229
233
|
- lib/gemaker/templates/image.png
|
230
234
|
- lib/gemaker/templates/normal/Guardfile
|
@@ -233,6 +237,7 @@ files:
|
|
233
237
|
- lib/gemaker/templates/normal/gemspec.erb
|
234
238
|
- lib/gemaker/templates/normal/spec_helper.rb.erb
|
235
239
|
- lib/gemaker/templates/normal/test_example.rb.erb
|
240
|
+
- lib/gemaker/templates/normal/travis.yml.erb
|
236
241
|
- lib/gemaker/templates/ruby-version.erb
|
237
242
|
- lib/gemaker/templates/test_helpers.rb
|
238
243
|
- lib/gemaker/templates/video.mp4
|