Class: GBud::ProjectBuilder
- Inherits:
-
Object
- Object
- GBud::ProjectBuilder
- Defined in:
- lib/gbud/project_builder.rb
Instance Attribute Summary collapse
-
#cli ⇒ Object
readonly
Returns the value of attribute cli.
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(metadata, cli) ⇒ ProjectBuilder
constructor
Instantiates the ProjectBuilder object using information provided.
Constructor Details
#initialize(metadata, cli) ⇒ ProjectBuilder
Instantiates the ProjectBuilder object using information provided
metadata : a hash containing the name, summary, description, authors, email
and URL for the project to be initialized
cli : specifies the need for a CLI option parser and executable
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/gbud/project_builder.rb', line 29 def initialize , cli = @cli = cli @files = { readme: 'README.md', gemspec: "#{metadata[:name]}.gemspec", gemfile: 'Gemfile', rakefile: 'Rakefile', main: "#{metadata[:name]}.rb", hello: "hello.rb", test_hello: "test_hello.rb" } @paths = { project_dir: "#{metadata[:name]}/", project_lib_dir: "#{metadata[:name]}/lib/", project_lib_project_dir: "#{metadata[:name]}/lib/#{metadata[:name]}/", project_test_dir: "#{metadata[:name]}/test/" } if cli == true @files[:executable] = "#{metadata[:name]}" @paths[:project_bin_dir] = "#{metadata[:name]}/bin/" end end |
Instance Attribute Details
#cli ⇒ Object (readonly)
Returns the value of attribute cli.
20 21 22 |
# File 'lib/gbud/project_builder.rb', line 20 def cli @cli end |
#files ⇒ Object (readonly)
Returns the value of attribute files.
20 21 22 |
# File 'lib/gbud/project_builder.rb', line 20 def files @files end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
20 21 22 |
# File 'lib/gbud/project_builder.rb', line 20 def end |
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
20 21 22 |
# File 'lib/gbud/project_builder.rb', line 20 def paths @paths end |
Instance Method Details
#build ⇒ Object
53 54 55 56 57 |
# File 'lib/gbud/project_builder.rb', line 53 def build make_directories make_files make_executable :executable if @cli == true end |