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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b942c54993980934eb4801cb0cf646e77791472
4
- data.tar.gz: ff643d7291808157d6f417f272e1fd16974dee72
3
+ metadata.gz: e787726b7c913489c1086c2d777e2ec8d33e0af0
4
+ data.tar.gz: 4f71e2c8f7c5c70387a1b427973b9b02ceb84de7
5
5
  SHA512:
6
- metadata.gz: 66f318d4866804d292374c7406b0f0f2d8fb1c6b1544e141bb2b4df5d1a1e74993f497d21ed37f02bd38d2fdc1991ee7238f0e2eaac0c89fe5cbfcb38a8f9775
7
- data.tar.gz: 17573005dcb6feb989e116c5bd64fcb66dcaf43e7a7fb8e9e28bce2bd8b87cfdbf1ae7901a65592eba16520796c0326e531fbf47158ec3a32b791eca96e39a73
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 perform
5
- remove_in_gem(".git") unless @config.engine?
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
- create_customized_gem(
7
- "rails plugin new #{@config.gem_name} -T #{mountable_opt} --dummy-path=spec/dummy"
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
@@ -26,4 +26,5 @@ Gem::Specification.new do |s|
26
26
  s.add_development_dependency "rspec-rails", "~> 3.4.0"
27
27
  s.add_development_dependency "guard-rspec", "~> 4.7"
28
28
  s.add_development_dependency "factory_girl_rails", "~> 4.6.0"
29
+ s.add_development_dependency "coveralls"
29
30
  end
@@ -0,0 +1,9 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/db/*.sqlite3
5
+ spec/dummy/db/*.sqlite3-journal
6
+ spec/dummy/log/*.log
7
+ spec/dummy/tmp/
8
+ spec/dummy/.sass-cache
9
+ coverage/
@@ -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 %>
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "rspec", "~> 3.4"
27
27
  spec.add_development_dependency "guard-rspec", "~> 4.7"
28
28
  spec.add_development_dependency "pry"
29
+ spec.add_development_dependency "coveralls"
29
30
  end
@@ -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"
@@ -0,0 +1,13 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.12.5
6
+ deploy:
7
+ provider: rubygems
8
+ api_key:
9
+ secure: your_secure_key
10
+ gem: <%= config.gem_name %>
11
+ on:
12
+ tags: true
13
+ repo: platanus/<%= config.gem_name %>
@@ -1,3 +1,4 @@
1
1
  module Gemaker
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
+ RAILS_VERSION = "4.2.8"
3
4
  end
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.3.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-28 00:00:00.000000000 Z
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