lib/schema_dev/gem.rb in schema_dev-3.0.1 vs lib/schema_dev/gem.rb in schema_dev-3.1.0
- old
+ new
@@ -13,18 +13,18 @@
attr_accessor :gem_name, :gem_module, :gem_root, :fullname, :email
def initialize(name)
self.gem_name = name.underscore
- self.gem_module = gem_name.camelize
+ self.gem_module = gem_name.camelize.sub(/^SchemaPlus(?=\w+)/, 'SchemaPlus::')
self.gem_root = Pathname.new(gem_name)
+ get_fullname_and_email
end
def build
ensure_not_in_git
ensure_doesnt_exist
- get_fullname_and_email
copy_template
self.gem_root = self.gem_root.realpath
rename_files
substitute_keys
freshen
@@ -64,10 +64,11 @@
end
end
def copy_template
FileUtils.cp_r Templates.root + "gem", gem_root
+ (gem_root + "gitignore").rename gem_root + ".gitignore"
end
def rename_files
Dir.glob(gem_root + "**/*GEM_NAME*").each do |path|
FileUtils.mv path, path.gsub(/GEM_NAME/, gem_name)
@@ -112,10 +113,10 @@
end
def git_init
Dir.chdir gem_name do
system "git init"
- system "git add #{gem_root.find.select(&:exist?).join(' ')}"
+ system "git add #{gem_root.find.select(&:exist?).reject(&it.basename.to_s == 'Gemfile.local').join(' ')}"
system "git commit -m 'Initial skeleton generated by `schema_dev gem #{gem_name}`'"
end
end
end
end