hastie 0.2.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem "jekyll", :git => "git://github.com/vlandham/jekyll.git"
5
+ gem "jekyll", :git => "git://github.com/metalhelix/jekyll.git"
6
6
 
7
7
  group :test do
8
8
  gem 'fakefs', require: "fakefs/safe"
data/README.textile CHANGED
@@ -18,17 +18,38 @@ This creates a @.hastie@ file in your home directory. The @-a@ flag indicates th
18
18
 
19
19
  h3. hastie create
20
20
 
21
- Now you are ready to generate a new report. Navigate to the directory that you would like the report to be created in, and create it with @hastie create@:
21
+ Now you are ready to generate a new report. Navigate to your base project directory, and create it with @hastie create@:
22
22
 
23
23
  <pre>
24
24
  cd /path/to/report/base
25
- hastie create analysis_of_sample_x -r ada -p hym
25
+ hastie create -i cbio_101 -r ada -p hym
26
26
  </pre>
27
27
 
28
- This will create a new directory called @report@ with your new report inside. The flags set meta data about the report. @-r@ for the researcher this report is for and @-p@ for the PI or lead researcher of the researcher specified by @-r@. These flags are optional. This data can be easily added later to your report if you forget.
28
+ This will create a new directory called @cbio_101@ with a series of directories inside it. The flags set meta data about the report. @-r@ for the researcher this report is for and @-p@ for the PI or lead researcher of the researcher specified by @-r@.
29
+
30
+ The Project directory, @cbio_101@ will now contain these sub-directories:
31
+
32
+ <pre>
33
+ --cbio_101
34
+ |
35
+ |__ report
36
+ |
37
+ |__ data
38
+ | |
39
+ | |__ input
40
+ | |
41
+ | |__ output
42
+ |
43
+ |__ code
44
+ |
45
+ |__ notes
46
+
47
+ </pre>
29
48
 
30
49
  Inside your report directory will be a number of files and sub-directories to get your report started. Many of these files are copied directly from the server you supplied in your config file.
31
50
 
51
+ You can generate *just* the report directory by using the @--only-report@ flag.
52
+
32
53
  h3. hastie watch
33
54
 
34
55
  Now start editing your report. It will be inside your @report@ directory, and be named @date_report_name.textile@. Watch changes to your report as you modify this file using @hastie watch@:
data/bin/hastie CHANGED
@@ -53,6 +53,11 @@ create_server options:
53
53
  Hastie::ConfigGenerator.start ARGV
54
54
  when "create_server","server_start"
55
55
  Hastie::ServerGenerator.start ARGV
56
+ when "overview"
57
+ id = Time.now.strftime('%b_%Y')
58
+ options = ["--template","overview","--id", id, "--output", id, "--only_report", "--pi", "cbio", "--researcher", "cbio"]
59
+ options.concat(ARGV)
60
+ Hastie::ReportGenerator.start options
56
61
  else
57
62
  puts Hastie::Executable::HELP
58
63
  end
@@ -6,6 +6,8 @@ module Hastie
6
6
 
7
7
  DATA_ROOT = "data"
8
8
  REPORT_CONFIG_FILE = "report.yml"
9
+ DEFAULT_REPORT_DIR = "report"
10
+ DEFAULT_ID_DOMAIN = "cbio"
9
11
 
10
12
  def self.config_file
11
13
  CONFIG_FILE
@@ -22,4 +24,12 @@ module Hastie
22
24
  def self.publish_config_file
23
25
  SERVER_PUBLISH_CONFIG_FILE
24
26
  end
27
+
28
+ def self.default_report_dir
29
+ DEFAULT_REPORT_DIR
30
+ end
31
+
32
+ def self.id_domain
33
+ DEFAULT_ID_DOMAIN
34
+ end
25
35
  end
@@ -0,0 +1,20 @@
1
+ require 'json'
2
+
3
+ module Hastie
4
+ class IdServer
5
+ attr_accessor :root_url, :domain
6
+ def initialize url = "", domain = "cbio"
7
+ self.root_url = url
8
+ self.domain = domain
9
+ end
10
+
11
+ def request_id pi, researcher
12
+ request = {"issuer" => domain, "lab" => pi, "sponsor" => researcher, "project" =>
13
+ {"description" => "new project"}}.to_json
14
+ command = "curl -H \"Accept: application/json\" -H \"Content-type: application/json\" -X POST -d"
15
+ "#{self.domain}.tst.100 -d '#{request.to_s}' #{url}/projects"
16
+ puts command
17
+ "cbio.tst.1000"
18
+ end
19
+ end
20
+ end
@@ -1,42 +1,89 @@
1
1
  require 'fileutils'
2
2
  require 'hastie/config_file'
3
3
  require 'hastie/constants'
4
+ require 'hastie/id_server'
4
5
  require 'hastie/server_reader'
5
6
 
6
7
  module Hastie
7
8
  class ReportGenerator < ServerReader
8
9
  def self.banner
9
- "hastie create [NAME] <OPTIONS>"
10
+ "hastie create -p [PI] -r [RESERACHER] <OPTIONS>"
10
11
  end
11
12
 
12
- attr_accessor :report_id, :title, :analyst, :researcher, :pi
13
+ attr_accessor :report_id, :title, :researcher, :pi
13
14
 
14
15
  desc "Creates framework for new report"
15
- argument :name, :type => :string, :desc => "The name of the new report. no spaces"
16
+ class_option :id, :aliases => "-i", :type => :string, :desc => "Overrides using ID server. Provide custom ID."
17
+ class_option :pi, :aliases => "-p", :required => true, :desc => "PI the researcher is under"
18
+ class_option :researcher, :aliases => "-r", :required => true, :desc => "Researcher the report is for"
16
19
  class_option :type, :aliases => "-t", :desc => "Type of report to generate"
20
+ class_option :template, :desc => "Template to use for creating report", :default => "report"
17
21
  class_option :analyst, :aliases => "-a", :desc => "Analyst generating the report"
18
- class_option :researcher, :aliases => "-r", :desc => "Researcher the report is for"
19
- class_option :pi, :aliases => "-p", :desc => "PI the researcher is under"
20
22
  class_option :date, :aliases => "-d", :desc => "Date to use in report filename. Ex: 2011-11-29", :default => "#{Time.now.strftime('%Y-%m-%d')}"
21
- class_option :output, :aliases => "-o", :desc => "Output Directory for report", :default => File.join(".", "report")
23
+ class_option :output, :aliases => "-o", :desc => "Output Directory for report"
24
+
25
+ class_option :id_server, :desc => "URL of ID server to use"
26
+ class_option :id_domain, :desc => "ID domain to use", :default => Hastie.id_domain
27
+
28
+ class_option :only_report, :type => :boolean, :desc => "Only output report and not rest of directory structure", :default => false
29
+
30
+ def setup_id
31
+ if !options[:id]
32
+ if options[:id_server] and options[:id_domain]
33
+ id_server = Hastie::IdServer.new(options[:id_server], options[:id_domain])
34
+ self.report_id = id_server.request_id(options[:pi], options[:researcher])
35
+ options[:id] = self.report_id
36
+ else
37
+ say_status "error", "No ID server found", :red
38
+ say_status "error", " Provide --id_server and --id_domain", :red
39
+ say_status "error", " Or use --id to specify the ID of your report", :red
40
+ exit(1)
41
+ end
42
+ else
43
+ self.report_id = options[:id]
44
+ end
45
+ options[:name] = options[:id]
46
+
47
+ say_status "note", "id: #{options[:id]}"
48
+ say_status "note", "name: #{options[:name]}"
49
+ end
50
+
51
+ # output directory now means two different things depending on :only_report
52
+ # :only_report = true then :output means name of the report directory
53
+ # :only_report = false then :output means the starting location for the
54
+ # project directory structure
55
+ def setup_destination
56
+ if options[:only_report]
57
+ if !options[:output]
58
+ options[:output] = File.join(".", Hastie.default_report_dir)
59
+ end
60
+ self.destination_root = options[:output]
61
+ else
62
+ if !options[:output]
63
+ options[:output] = "."
64
+ end
65
+ self.destination_root = File.join(options[:output], options[:id])
66
+ end
67
+
68
+ say_status "note", "root: #{self.destination_root}"
69
+ end
70
+
71
+ def create_directory_structure
72
+ unless options[:only_report]
73
+ directory(File.join("templates", "project"), self.destination_root)
74
+ self.destination_root = File.join(self.destination_root, Hastie.default_report_dir)
75
+ end
76
+ end
22
77
 
23
78
  def setup_variables
79
+ options[:pi] ||= "cbio"
80
+ options[:researcher] ||= "cbio"
24
81
  options[:type] ||= "textile"
25
82
  options[:date] ||= "#{Time.now.strftime('%Y-%m-%d')}"
26
- options[:name] = File.basename(name)
27
83
  self.title = options[:name].gsub("_", " ").capitalize
28
84
  options[:title] = self.title
29
- # report_id will be used internally in case the name turns
30
- # out to be too loose to use
31
- self.report_id = File.basename(name)
32
- options[:report_id] = self.report_id
33
- self.destination_root = options[:output]
34
- say_status "note", "root: #{self.destination_root}"
35
85
 
36
- options[:analyst] ||= "unknown"
37
- self.analyst = options[:analyst] || "unknown"
38
- options[:researcher] ||= "unknown"
39
- options[:pi] ||= "unknown"
86
+ options[:analyst] ||= "cbio"
40
87
  options[:data_dir] ||= data_dir
41
88
  end
42
89
 
@@ -57,10 +104,15 @@ module Hastie
57
104
  end
58
105
 
59
106
  def create_report_file
60
- say_status "create", "report: #{options[:report_id]}"
107
+ say_status "create", "report: #{options[:id]}"
61
108
  extension = determine_extension(options[:type])
109
+ template_name = options[:template]
62
110
  options[:extension] = extension
63
- template_file = "templates/report.#{extension}.tt"
111
+ template_file = "templates/#{template_name}.#{extension}.tt"
112
+ if !File.exists? File.join(File.dirname(__FILE__), template_file)
113
+ say_status "error", "#{template_file} not present. Invalid Template.", :red
114
+ exit(1)
115
+ end
64
116
  report_filename = "#{options[:date]}-#{report_id}.#{extension}"
65
117
  say_status "note", "report file: #{report_filename}"
66
118
  template template_file, report_filename
@@ -111,7 +163,7 @@ module Hastie
111
163
  end
112
164
 
113
165
  def data_dir
114
- File.join(DATA_ROOT, options[:report_id])
166
+ File.join(DATA_ROOT, options[:id])
115
167
  end
116
168
  end
117
169
  end
@@ -54,6 +54,18 @@ module Hastie
54
54
  say_status "note", "root: #{self.destination_root}"
55
55
  end
56
56
 
57
+ def create_lock_file
58
+ lock_file = File.join(self.destination_root, "lock.txt")
59
+ if File.exists?(lock_file)
60
+ say_status "error", "Another user is currently publishing to server", :red
61
+ say_status "error", "Please wait", :red
62
+ exit(1)
63
+ end
64
+ File.open(lock_file, 'w') do |file|
65
+ file.puts Time.now.strftime('%Y-%m-%d %H:%M')
66
+ end
67
+ end
68
+
57
69
  def copy_report_file
58
70
  report_filename = options[:local]["report_file"]
59
71
  local_report = File.join(report_dir, report_filename)
@@ -122,25 +134,25 @@ module Hastie
122
134
  end
123
135
  end
124
136
 
125
- def update_git_repo
126
- in_root do
127
- say_status "note", "updating git repository"
128
- Grit::Git.git_timeout = 25
129
- repo = Grit::Repo.new(".")
130
- # ensure we are on the server branch
131
- repo.git.native :checkout, {}, 'server'
132
- repo = Grit::Repo.new(".")
133
- if repo.head.name != "server"
134
- say_status "error", "Remote git not on server branch", :red
135
- say_status "error", "Please git checkout server", :red
136
- say_status "error", "Current branch: #{repo.head.name}", :red
137
- exit(1)
138
- end
139
- all_files = Dir.glob("./**")
140
- repo.add(all_files)
141
- repo.commit_all("update with report: #{options[:local]["report_id"]}")
142
- end
143
- end
137
+ # def update_git_repo
138
+ # in_root do
139
+ # say_status "note", "updating git repository"
140
+ # Grit::Git.git_timeout = 25
141
+ # repo = Grit::Repo.new(".")
142
+ # # ensure we are on the server branch
143
+ # repo.git.native :checkout, {}, 'server'
144
+ # repo = Grit::Repo.new(".")
145
+ # if repo.head.name != "server"
146
+ # say_status "error", "Remote git not on server branch", :red
147
+ # say_status "error", "Please git checkout server", :red
148
+ # say_status "error", "Current branch: #{repo.head.name}", :red
149
+ # exit(1)
150
+ # end
151
+ # all_files = Dir.glob("./**")
152
+ # repo.add(all_files)
153
+ # repo.commit_all("update with report: #{options[:local]["report_id"]}")
154
+ # end
155
+ # end
144
156
 
145
157
  def publish_with_jekyll
146
158
  in_root do
@@ -158,5 +170,10 @@ module Hastie
158
170
  Process.waitpid(pid)
159
171
  end
160
172
  end
173
+
174
+ def remove_lock_file
175
+ lock_file = File.join(self.destination_root, "lock.txt")
176
+ system("rm -f #{lock_file}")
177
+ end
161
178
  end
162
179
  end
@@ -7,13 +7,13 @@ require 'hastie/constants'
7
7
  module Hastie
8
8
  class ServerReader < Thor::Group
9
9
  include Thor::Actions
10
- class_option :server_root, :aliases => "-s", :desc => "Root directory of the server to read / publish to"
11
10
  class_option :config_file, :aliases => "-c", :desc => "Path to .hastie config file", :default => Hastie.config_file
11
+ class_option :server_root, :aliases => "-s", :desc => "Root directory of the server to read / publish to"
12
12
 
13
13
  no_tasks do
14
14
  def config_file
15
15
  @config_file ||= if options[:config_file]
16
- File.expand_path(options[:config_file])
16
+ File.expand_path(options[:config_file])
17
17
  else
18
18
  Hastie.config_file
19
19
  end
@@ -0,0 +1,47 @@
1
+ ---
2
+ layout: overview
3
+ type: overview
4
+ title: <%= title %>
5
+ analyst: <%= options[:analyst] %>
6
+ researcher: <%= options[:researcher] %>
7
+ pi: <%= options[:pi] %>
8
+ data:
9
+ - <%= options[:data_dir] %>/
10
+ ---
11
+
12
+ h2. Overview Period:
13
+
14
+ <div class="note">
15
+ *SUMMARY*
16
+
17
+ </div>
18
+
19
+ h3. New Projects
20
+
21
+ {% table csv class = overview, format = textile %}
22
+ PI, description, lead, report, comments, end date
23
+
24
+ {% endtable %}
25
+
26
+
27
+ h3. Ongoing Projects
28
+
29
+ {% table csv class = overview, format = textile %}
30
+ PI, description, lead, report, comments, end date
31
+
32
+ {% endtable %}
33
+
34
+ h3. Finished Projects
35
+
36
+ {% table csv class = overview, format = textile %}
37
+ PI, description, lead, report, comments, end date
38
+
39
+ {% endtable %}
40
+
41
+ h3. Pending Projects
42
+
43
+ {% table csv class = overview, format = textile %}
44
+ PI, description, lead, report, comments, end date
45
+
46
+ {% endtable %}
47
+
File without changes
File without changes
File without changes
@@ -1,3 +1,3 @@
1
1
  module Hastie
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "1.1.2".freeze
3
3
  end
File without changes
File without changes
File without changes
@@ -4,8 +4,16 @@ require 'hastie/report_generator'
4
4
 
5
5
  class ReportGeneratorChild < Hastie::ReportGenerator
6
6
  no_tasks do
7
- def config_file
8
- FakeFsHelper::CONFIG_FILE
7
+ def config_file
8
+ FakeFsHelper::CONFIG_FILE
9
+ end
10
+ end
11
+ end
12
+
13
+ module Hastie
14
+ class IdServer
15
+ def request_id researcher, pi
16
+ "cbio.#{researcher}.1000"
9
17
  end
10
18
  end
11
19
  end
@@ -25,111 +33,162 @@ describe Hastie::ReportGenerator do
25
33
  @server_dir = File.expand_path(File.join(File.dirname(__FILE__), "fixtures", "server"))
26
34
  @output_dir = File.expand_path(File.join(File.dirname(__FILE__), "sandbox"))
27
35
  @date = "2011-11-31"
28
- @input = ["sandbox", "-o", @output_dir, "--config_file", @config_file, "--server_root", @server_dir, "--date", @date]
29
- @expected_report_name = File.join(@output_dir, "#{@date}-#{File.basename(@output_dir)}")
30
36
  end
31
37
 
32
38
  after :each do
33
39
  FileUtils.rm_r @output_dir if File.exists?(@output_dir)
34
40
  end
35
41
 
36
- it "should create scaffold files in output directory" do
37
- content = capture(:stdout) do
38
- lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
42
+ describe "project directory generation" do
43
+ before :each do
44
+ @report_id = "test.test.100"
45
+ @input = ["-i", @report_id, "-p", "ppp", "-r", "rrr", "-o", @output_dir, "--config_file", @config_file, "--server_root", @server_dir, "--date", @date]
46
+ @expected_report_name = File.join(@output_dir,@report_id, "report", "#{@date}-#{File.basename(@report_id)}")
39
47
  end
40
48
 
41
- File.exists?(@expected_report_name + ".textile").should == true
42
- File.directory?(File.join(@output_dir, "data")).should == true
43
- File.directory?(File.join(@output_dir, "data", File.basename(@output_dir))).should == true
44
- File.directory?(File.join(@output_dir, "_layouts")).should == true
45
- File.directory?(File.join(@output_dir, "css")).should == true
46
- File.directory?(File.join(@output_dir, "js")).should == true
47
- File.directory?(File.join(@output_dir, "_plugins")).should == true
48
- File.directory?(File.join(@output_dir, "_includes")).should == true
49
- File.exists?(File.join(@output_dir, "_config.yml")).should == true
50
- File.exists?(File.join(@output_dir, "report.yml")).should == true
51
- File.exists?(File.join(@output_dir, "index.html")).should == true
52
- end
53
-
54
- it "should provide link in index file to html page" do
55
- content = capture(:stdout) do
56
- lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
49
+ after :each do
50
+ FileUtils.rm_r @output_dir if File.exists?(@output_dir)
57
51
  end
58
52
 
59
- index_file = File.join(@output_dir, "index.html")
60
- File.exists?(index_file).should == true
53
+ it "should create scaffold files in output directory" do
54
+ content = capture(:stdout) do
55
+ lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
56
+ end
61
57
 
62
- index_content = read_file index_file
58
+ File.exists?(File.join(@output_dir)).should == true
59
+ File.exists?(File.join(@output_dir,@report_id)).should == true
60
+ File.exists?(File.join(@output_dir,@report_id, "report")).should == true
61
+ File.exists?(@expected_report_name + ".textile").should == true
63
62
 
64
- index_content.should match /url=#{File.basename(@expected_report_name)}.html/
63
+ File.exists?(File.join(@output_dir,@report_id,"data")).should == true
64
+ end
65
65
 
66
66
  end
67
67
 
68
- ["markdown", "textile"].each do |format|
69
- it "should have default content" do
70
- @input << "--type" << format
68
+ describe "create overview page" do
69
+
70
+ before :each do
71
+ @input = ["--template", "overview", "-i", "sandbox", "-p", "ppp", "-r", "rrr", "-o", @output_dir, "--config_file", @config_file, "--server_root", @server_dir, "--date", @date, "--only_report"]
72
+ @expected_report_name = File.join(@output_dir, "#{@date}-#{File.basename(@output_dir)}")
73
+ end
74
+
75
+
76
+ it "should create scaffold files in output directory" do
71
77
  content = capture(:stdout) do
72
78
  lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
73
79
  end
74
80
 
75
- report_file = File.join(@expected_report_name + "." + format)
76
- File.exists?(report_file).should == true
77
- report_file_content = read_file report_file
78
-
79
- report_file_content.should match /layout: report/
80
- report_file_content.should match /title: Sandbox/
81
- report_file_content.should match /data:/
82
- report_file_content.should match /- data\/#{File.basename(@output_dir)}/
81
+ File.exists?(@expected_report_name + ".textile").should == true
83
82
  end
84
83
  end
85
84
 
86
- describe "input options" do
87
- it "--type" do
88
- @input << "--type" << "markdown"
85
+ describe "basic functionality" do
86
+
87
+ before :each do
88
+ @input = ["-i", "sandbox", "-p", "ppp", "-r", "rrr", "-o", @output_dir, "--config_file", @config_file, "--server_root", @server_dir, "--date", @date, "--only_report"]
89
+ @expected_report_name = File.join(@output_dir, "#{@date}-#{File.basename(@output_dir)}")
90
+ end
91
+
92
+
93
+ it "should create scaffold files in output directory" do
89
94
  content = capture(:stdout) do
90
95
  lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
91
96
  end
92
97
 
93
- File.exists?(File.join(@expected_report_name + ".markdown")).should == true
98
+ File.exists?(@expected_report_name + ".textile").should == true
99
+ File.directory?(File.join(@output_dir, "data")).should == true
100
+ File.directory?(File.join(@output_dir, "data", File.basename(@output_dir))).should == true
101
+ File.directory?(File.join(@output_dir, "_layouts")).should == true
102
+ File.directory?(File.join(@output_dir, "css")).should == true
103
+ File.directory?(File.join(@output_dir, "js")).should == true
104
+ File.directory?(File.join(@output_dir, "_plugins")).should == true
105
+ File.directory?(File.join(@output_dir, "_includes")).should == true
106
+ File.exists?(File.join(@output_dir, "_config.yml")).should == true
107
+ File.exists?(File.join(@output_dir, "report.yml")).should == true
108
+ File.exists?(File.join(@output_dir, "index.html")).should == true
94
109
  end
95
110
 
96
- it "--analyst" do
97
- @input << "--analyst" << "mcm"
111
+ it "should provide link in index file to html page" do
98
112
  content = capture(:stdout) do
99
113
  lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
100
114
  end
101
- report_file = File.join(@expected_report_name + ".textile")
102
115
 
103
- File.exists?(report_file).should == true
104
- report_file_content = read_file report_file
116
+ puts content
117
+ index_file = File.join(@output_dir, "index.html")
118
+ File.exists?(index_file).should == true
119
+
120
+ index_content = read_file index_file
121
+
122
+ index_content.should match /url=#{File.basename(@expected_report_name)}.html/
105
123
 
106
- report_file_content.should match /analyst: mcm/
107
124
  end
108
125
 
109
- it "--pi" do
110
- @input << "--pi" << "dad"
111
- content = capture(:stdout) do
112
- lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
126
+ ["markdown", "textile"].each do |format|
127
+ it "should have default content" do
128
+ @input << "--type" << format
129
+ content = capture(:stdout) do
130
+ lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
131
+ end
132
+
133
+ report_file = File.join(@expected_report_name + "." + format)
134
+ File.exists?(report_file).should == true
135
+ report_file_content = read_file report_file
136
+
137
+ report_file_content.should match /layout: report/
138
+ report_file_content.should match /title: Sandbox/
139
+ report_file_content.should match /data:/
140
+ report_file_content.should match /- data\/#{File.basename(@output_dir)}/
113
141
  end
114
- report_file = File.join(@expected_report_name + ".textile")
142
+ end
115
143
 
116
- File.exists?(report_file).should == true
117
- report_file_content = read_file report_file
144
+ describe "input options" do
145
+ it "--type" do
146
+ @input << "--type" << "markdown"
147
+ content = capture(:stdout) do
148
+ lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
149
+ end
118
150
 
119
- report_file_content.should match /pi: dad/
120
- end
151
+ File.exists?(File.join(@expected_report_name + ".markdown")).should == true
152
+ end
121
153
 
122
- it "--researcher" do
123
- @input << "--researcher" << "odd"
124
- content = capture(:stdout) do
125
- lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
154
+ it "--analyst" do
155
+ @input << "--analyst" << "mcm"
156
+ content = capture(:stdout) do
157
+ lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
158
+ end
159
+ report_file = File.join(@expected_report_name + ".textile")
160
+
161
+ File.exists?(report_file).should == true
162
+ report_file_content = read_file report_file
163
+
164
+ report_file_content.should match /analyst: mcm/
126
165
  end
127
- report_file = File.join(@expected_report_name + ".textile")
128
166
 
129
- File.exists?(report_file).should == true
130
- report_file_content = read_file report_file
167
+ it "--pi" do
168
+ @input << "--pi" << "dad"
169
+ content = capture(:stdout) do
170
+ lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
171
+ end
172
+ report_file = File.join(@expected_report_name + ".textile")
131
173
 
132
- report_file_content.should match /researcher: odd/
174
+ File.exists?(report_file).should == true
175
+ report_file_content = read_file report_file
176
+
177
+ report_file_content.should match /pi: dad/
178
+ end
179
+
180
+ it "--researcher" do
181
+ @input << "--researcher" << "odd"
182
+ content = capture(:stdout) do
183
+ lambda { Hastie::ReportGenerator.start @input }.should_not raise_error SystemExit
184
+ end
185
+ report_file = File.join(@expected_report_name + ".textile")
186
+
187
+ File.exists?(report_file).should == true
188
+ report_file_content = read_file report_file
189
+
190
+ report_file_content.should match /researcher: odd/
191
+ end
133
192
  end
134
193
  end
135
194
  end
@@ -149,7 +208,7 @@ describe Hastie::ReportGenerator, fakefs: true do
149
208
  FakeFsHelper.add_published_report project
150
209
 
151
210
  content = capture(:stdout) do
152
- lambda { ReportGeneratorChild.start [project] }.should raise_error SystemExit
211
+ lambda { ReportGeneratorChild.start ["-i", project, "-p", "ppp", "-r", "rrr", "--only_report"]}.should raise_error SystemExit
153
212
  end
154
213
  content.should match /#{project} is already/
155
214
  end
@@ -30,13 +30,13 @@ describe Hastie::ReportPublisher do
30
30
  FileUtils.cp_r @org_report_dir, @report_dir
31
31
 
32
32
  @report_name = File.basename(Dir.glob(File.join(@report_dir, "*.textile"))[0])
33
- FileUtils.cd(@server_dir) do
34
- system("git init .")
35
- system("git add .")
36
- system("git commit -m \"initial commit\"")
37
- system("git branch server")
38
- system("git checkout server")
39
- end
33
+ # FileUtils.cd(@server_dir) do
34
+ # system("git init .")
35
+ # system("git add .")
36
+ # system("git commit -m \\"initial commit\\"")
37
+ # system("git branch server")
38
+ # system("git checkout server")
39
+ # end
40
40
 
41
41
  @input = [@report_dir, "--config_file", @config_file, "--server_root", @server_dir]
42
42
  end
@@ -54,6 +54,17 @@ describe Hastie::ReportPublisher do
54
54
  File.exists?(File.join(@server_dir, "data", "report")).should == true
55
55
  end
56
56
 
57
+ it "should prevent publish when lock file is present" do
58
+ lock_file = File.join(@server_dir, "lock.txt")
59
+ system("touch #{lock_file}")
60
+ content = capture(:stdout) do
61
+ lambda { Hastie::ReportPublisher.start @input }.should raise_error SystemExit
62
+ end
63
+
64
+ File.exists?(File.join(@server_dir, "_posts", @report_name)).should_not == true
65
+ File.exists?(File.join(@server_dir, "data", "report")).should_not == true
66
+ end
67
+
57
68
  it "should add report to _reports.yml" do
58
69
  content = capture(:stdout) do
59
70
  lambda { Hastie::ReportPublisher.start @input }.should_not raise_error SystemExit
@@ -62,14 +73,14 @@ describe Hastie::ReportPublisher do
62
73
  reports_content.should match /#{File.basename(@report_dir)}/
63
74
  end
64
75
 
65
- it "should update git repository with new commit" do
66
- content = capture(:stdout) do
67
- lambda { Hastie::ReportPublisher.start @input }.should_not raise_error SystemExit
68
- end
76
+ # it "should update git repository with new commit" do
77
+ # content = capture(:stdout) do
78
+ # lambda { Hastie::ReportPublisher.start @input }.should_not raise_error SystemExit
79
+ # end
69
80
 
70
- commits = Grit::Repo.new(@server_dir).commits('server',1)
71
- commits[0].message.should match /update with report: report/
72
- end
81
+ # commits = Grit::Repo.new(@server_dir).commits('server',1)
82
+ # commits[0].message.should match /update with report: report/
83
+ # end
73
84
 
74
85
  end
75
86
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hastie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-06 00:00:00.000000000Z
12
+ date: 2012-09-11 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &3725550 !ruby/object:Gem::Requirement
16
+ requirement: &70147378031820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.14.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *3725550
24
+ version_requirements: *70147378031820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: grit
27
- requirement: &3725300 !ruby/object:Gem::Requirement
27
+ requirement: &70147378029960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.4.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *3725300
35
+ version_requirements: *70147378029960
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sinatra
38
- requirement: &3725070 !ruby/object:Gem::Requirement
38
+ requirement: &70147378027680 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.3.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *3725070
46
+ version_requirements: *70147378027680
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: thin
49
- requirement: &3724840 !ruby/object:Gem::Requirement
49
+ requirement: &70147378009460 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.3.1
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *3724840
57
+ version_requirements: *70147378009460
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &3724610 !ruby/object:Gem::Requirement
60
+ requirement: &70147378008760 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '1.0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *3724610
68
+ version_requirements: *70147378008760
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rdoc
71
- requirement: &3724380 !ruby/object:Gem::Requirement
71
+ requirement: &70147378007680 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '3.9'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *3724380
79
+ version_requirements: *70147378007680
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &3724150 !ruby/object:Gem::Requirement
82
+ requirement: &70147378006300 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '2.3'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *3724150
90
+ version_requirements: *70147378006300
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: simplecov
93
- requirement: &3723920 !ruby/object:Gem::Requirement
93
+ requirement: &70147378005120 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0.4'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *3723920
101
+ version_requirements: *70147378005120
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: ZenTest
104
- requirement: &3723690 !ruby/object:Gem::Requirement
104
+ requirement: &70147378004140 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: 4.5.0
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *3723690
112
+ version_requirements: *70147378004140
113
113
  description: ''
114
114
  email: none@none.com
115
115
  executables:
@@ -132,6 +132,7 @@ files:
132
132
  - lib/hastie/config_file.rb
133
133
  - lib/hastie/config_generator.rb
134
134
  - lib/hastie/constants.rb
135
+ - lib/hastie/id_server.rb
135
136
  - lib/hastie/report_generator.rb
136
137
  - lib/hastie/report_publisher.rb
137
138
  - lib/hastie/report_updater.rb
@@ -139,6 +140,12 @@ files:
139
140
  - lib/hastie/server_generator.rb
140
141
  - lib/hastie/server_reader.rb
141
142
  - lib/hastie/templates/hastie_config.tt
143
+ - lib/hastie/templates/overview.textile.tt
144
+ - lib/hastie/templates/project/code/.gitignore
145
+ - lib/hastie/templates/project/code/analysis.R
146
+ - lib/hastie/templates/project/data/input/.gitignore
147
+ - lib/hastie/templates/project/data/output/.gitignore
148
+ - lib/hastie/templates/project/notes/notes.txt
142
149
  - lib/hastie/templates/report.markdown.tt
143
150
  - lib/hastie/templates/report.textile.tt
144
151
  - lib/hastie/templates/report_index.html.tt
@@ -167,6 +174,9 @@ files:
167
174
  - spec/fixtures/report/js/.gitignore
168
175
  - spec/fixtures/report/report.yml
169
176
  - spec/fixtures/server/_config.yml
177
+ - spec/fixtures/server/_includes/.gitignore
178
+ - spec/fixtures/server/_layouts/.gitignore
179
+ - spec/fixtures/server/_plugins/.gitignore
170
180
  - spec/fixtures/server/_posts/2011-11-11-jfv_mak_snp_analysis.textile
171
181
  - spec/fixtures/server/_reports.yml
172
182
  - spec/fixtures/server/css/style.css
@@ -202,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
212
  version: 1.3.6
203
213
  requirements: []
204
214
  rubyforge_project:
205
- rubygems_version: 1.8.5
215
+ rubygems_version: 1.8.10
206
216
  signing_key:
207
217
  specification_version: 3
208
218
  summary: ''
@@ -218,6 +228,9 @@ test_files:
218
228
  - spec/fixtures/report/js/.gitignore
219
229
  - spec/fixtures/report/report.yml
220
230
  - spec/fixtures/server/_config.yml
231
+ - spec/fixtures/server/_includes/.gitignore
232
+ - spec/fixtures/server/_layouts/.gitignore
233
+ - spec/fixtures/server/_plugins/.gitignore
221
234
  - spec/fixtures/server/_posts/2011-11-11-jfv_mak_snp_analysis.textile
222
235
  - spec/fixtures/server/_reports.yml
223
236
  - spec/fixtures/server/css/style.css