Class: Steep::Drivers::Init
- Inherits:
-
Object
- Object
- Steep::Drivers::Init
- Includes:
- Utils::DriverHelper
- Defined in:
- lib/steep/drivers/init.rb
Constant Summary collapse
- TEMPLATE =
"# target :lib do\n# signature \"sig\"\n#\n# check \"lib\" # Directory name\n# check \"Gemfile\" # File name\n# check \"app/models/**/*.rb\" # Glob\n# # ignore \"lib/templates/*.rb\"\n#\n# # library \"pathname\", \"set\" # Standard libraries\n# # library \"strong_json\" # Gems\n# end\n\n# target :spec do\n# signature \"sig\", \"sig-private\"\n#\n# check \"spec\"\n#\n# # library \"pathname\", \"set\" # Standard libraries\n# # library \"rspec\"\n# end\n"
Instance Attribute Summary collapse
-
#force_write ⇒ Object
Returns the value of attribute force_write.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Attributes included from Utils::DriverHelper
Instance Method Summary collapse
-
#initialize(stdout:, stderr:) ⇒ Init
constructor
A new instance of Init.
- #run ⇒ Object
Methods included from Utils::DriverHelper
Constructor Details
#initialize(stdout:, stderr:) ⇒ Init
33 34 35 36 37 |
# File 'lib/steep/drivers/init.rb', line 33 def initialize(stdout:, stderr:) @stdout = stdout @stderr = stderr @force_write = false end |
Instance Attribute Details
#force_write ⇒ Object
Returns the value of attribute force_write.
6 7 8 |
# File 'lib/steep/drivers/init.rb', line 6 def force_write @force_write end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
5 6 7 |
# File 'lib/steep/drivers/init.rb', line 5 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
4 5 6 |
# File 'lib/steep/drivers/init.rb', line 4 def stdout @stdout end |
Instance Method Details
#run ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/steep/drivers/init.rb', line 39 def run path = steepfile || Pathname("Steepfile") if path.file? && !force_write stdout.puts "#{path} already exists, --force to overwrite" return 1 end stdout.puts "Writing #{path}..." path.write(TEMPLATE) 0 end |