README.md in dslable-0.0.5 vs README.md in dslable-0.0.6
- old
+ new
@@ -1,7 +1,9 @@
# Dslable
+[![Gem Version](https://badge.fury.io/rb/dslable.svg)](http://badge.fury.io/rb/dslable)
+
Dslable is generator for simple spec gem.
## Summary
* create gem template with DslSettingFile.
* you can get bin-executable gem.
@@ -214,14 +216,15 @@
~~~ruby
# encoding: utf-8
require 'fizz_buzz_gem_dsl'
module FizzBuzzGem
- # FizzBuzzGem Core
+ # FizzBuzzGem Core
class Core
- FIZZ_BUZZ_GEM_FILE = "Fizzbuzzgemfile"
- FIZZ_BUZZ_GEM_TEMPLATE =<<-EOS
+ # rubocop:disable LineLength
+ FIZZ_BUZZ_GEM_FILE = 'Fizzbuzzgemfile'
+ FIZZ_BUZZ_GEM_TEMPLATE = <<-EOS
# encoding: utf-8
# is_upper_case
# is_upper_case is required
# is_upper_case allow only String
@@ -232,29 +235,33 @@
# range allow only Array
# range's default value => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
range [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
EOS
+ # rubocop:enable LineLength
- #== generate Fizzbuzzgemfile to current directory.
+ # generate Fizzbuzzgemfile to current directory.
def init
- File.open(FIZZ_BUZZ_GEM_FILE, "w") {|f|f.puts FIZZ_BUZZ_GEM_TEMPLATE}
+ File.open(FIZZ_BUZZ_GEM_FILE, 'w') do |f|
+ f.puts FIZZ_BUZZ_GEM_TEMPLATE
+ end
end
- #== TODO: write your gem's specific contents
+ # TODO: write your gem's specific contents
def execute
src = read_dsl
dsl = FizzBuzzGem::Dsl.new
dsl.instance_eval src
# TODO: implement your gem's specific logic
end
private
+
def read_dsl
- File.open(FIZZ_BUZZ_GEM_FILE) {|f|f.read}
+ File.open(FIZZ_BUZZ_GEM_FILE) { |f|f.read }
end
end
end
~~~
@@ -263,22 +270,25 @@
~~~ruby
# encoding: utf-8
require 'fizz_buzz_gem_dsl_model'
module FizzBuzzGem
+ # Dsl
class Dsl
attr_accessor :fizz_buzz_gem
+ # String Define
[:is_upper_case].each do |f|
define_method f do |value|
- eval "@fizz_buzz_gem.#{f.to_s} = '#{value}'", binding
+ @fizz_buzz_gem.send("#{f}=", value)
end
end
+ # Array/Hash/Boolean Define
[:range].each do |f|
define_method f do |value|
- eval "@fizz_buzz_gem.#{f.to_s} = #{value}", binding
+ @fizz_buzz_gem.send("#{f}=", value)
end
end
def initialize
@fizz_buzz_gem = FizzBuzzGem::DslModel.new
@@ -293,23 +303,26 @@
fizz_buzz_gem_dsl_model.rb
~~~ruby
# encoding: utf-8
require 'active_model'
+# rubocop:disable LineLength
module FizzBuzzGem
+ # DslModel
class DslModel
include ActiveModel::Model
# is_upper_case
attr_accessor :is_upper_case
- validates :is_upper_case, :presence => true
+ validates :is_upper_case, presence: true
# range
attr_accessor :range
end
end
+# rubocop:enable LineLength
~~~
bin source Template
~~~ruby
#!/usr/bin/env ruby
@@ -320,12 +333,12 @@
require "thor"
module FizzBuzzGem
#= FizzBuzzGem CLI
class CLI < Thor
- class_option :help, :type => :boolean, :aliases => '-h', :desc => 'help message.'
- class_option :version, :type => :boolean, :desc => 'version'
+ class_option :help, type: :boolean, aliases: '-h', desc: 'help message.'
+ class_option :version, type: :boolean, desc: 'version'
desc "execute", "TODO: write your desc"
def execute
FizzBuzzGem::Core.new.execute
end
@@ -718,12 +731,12 @@
require "thor"
module FizzBuzzGem
#= FizzBuzzGem CLI
class CLI < Thor
- class_option :help, :type => :boolean, :aliases => '-h', :desc => 'help message.'
- class_option :version, :type => :boolean, :desc => 'version'
+ class_option :help, type: :boolean, aliases: '-h', desc: 'help message.'
+ class_option :version, type: :boolean, desc: 'version'
desc "execute", "execute fizz buzz"
def execute
puts FizzBuzzGem::Core.new.execute
end
@@ -985,9 +998,11 @@
* this gem uses 'rspec --init' command to create RSpec template (rspec gem).
* this gem uses 'piccolo' command to create RSpec spec template (rspec_piccolo gem).
* this gem uses 'tudu' command to create Workflow (tudu gem).
## History
+* version 0.0.6 : fix generation code.remove rubocop warnings
+* version 0.0.5 : update runtime_dependency(version up rspec_piccolo ver0.0.6 to ver0.0.8)
* version 0.0.4 : delete Core#init spec generation
* version 0.0.4 : delete Hash default brace.
* version 0.0.3 : add using class Boolean(true or class).
* version 0.0.2 : add workflow generation by 'tudu gem'.
* version 0.0.1 : first release.