Class: Jkr::Env
- Inherits:
-
Object
- Object
- Jkr::Env
- Defined in:
- lib/jkr/env.rb
Constant Summary collapse
- PLAN_DIR =
"plan"
- RESULT_DIR =
"result"
- SCRIPT_DIR =
"script"
Instance Attribute Summary collapse
-
#jkr_dir ⇒ Object
readonly
Returns the value of attribute jkr_dir.
-
#jkr_plan_dir ⇒ Object
readonly
Returns the value of attribute jkr_plan_dir.
-
#jkr_result_dir ⇒ Object
readonly
Returns the value of attribute jkr_result_dir.
-
#jkr_script_dir ⇒ Object
readonly
Returns the value of attribute jkr_script_dir.
-
#working_dir ⇒ Object
readonly
Returns the value of attribute working_dir.
Instance Method Summary collapse
-
#initialize(working_dir = Dir.pwd, jkr_dir = File.join(Dir.pwd, "jkr")) ⇒ Env
constructor
A new instance of Env.
- #next_plan ⇒ Object
- #plans ⇒ Object
Constructor Details
#initialize(working_dir = Dir.pwd, jkr_dir = File.join(Dir.pwd, "jkr")) ⇒ Env
Returns a new instance of Env.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/jkr/env.rb', line 16 def initialize(working_dir = Dir.pwd, jkr_dir = File.join(Dir.pwd, "jkr")) @jkr_dir = jkr_dir @working_dir = working_dir @jkr_plan_dir = File.join(@jkr_dir, PLAN_DIR) @jkr_result_dir = File.join(@jkr_dir, RESULT_DIR) @jkr_script_dir = File.join(@jkr_dir, SCRIPT_DIR) [@jkr_dir, @jkr_result_dir, @jkr_plan_dir, @jkr_script_dir].each do |dir_path| unless Dir.exists?(dir_path) FileUtils.mkdir_p(dir_path) end end end |
Instance Attribute Details
#jkr_dir ⇒ Object (readonly)
Returns the value of attribute jkr_dir.
6 7 8 |
# File 'lib/jkr/env.rb', line 6 def jkr_dir @jkr_dir end |
#jkr_plan_dir ⇒ Object (readonly)
Returns the value of attribute jkr_plan_dir.
9 10 11 |
# File 'lib/jkr/env.rb', line 9 def jkr_plan_dir @jkr_plan_dir end |
#jkr_result_dir ⇒ Object (readonly)
Returns the value of attribute jkr_result_dir.
8 9 10 |
# File 'lib/jkr/env.rb', line 8 def jkr_result_dir @jkr_result_dir end |
#jkr_script_dir ⇒ Object (readonly)
Returns the value of attribute jkr_script_dir.
10 11 12 |
# File 'lib/jkr/env.rb', line 10 def jkr_script_dir @jkr_script_dir end |
#working_dir ⇒ Object (readonly)
Returns the value of attribute working_dir.
7 8 9 |
# File 'lib/jkr/env.rb', line 7 def working_dir @working_dir end |
Instance Method Details
#next_plan ⇒ Object
30 31 32 |
# File 'lib/jkr/env.rb', line 30 def next_plan self.plans.first end |
#plans ⇒ Object
34 35 36 |
# File 'lib/jkr/env.rb', line 34 def plans Dir.glob("#{@jkr_plan_dir}#{File::SEPARATOR}*.plan").sort end |