pipely 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 304e00b3319254cb54534703c1d0349fc1bee849
4
- data.tar.gz: 9d33ed9a0eae6d2eab28329d041801cbc82d252a
3
+ metadata.gz: b731960bf5c0239cac639066f033a49a4e5e6c0f
4
+ data.tar.gz: 1612176e9731abbe4d00ad0e9d900a92fb0a3f37
5
5
  SHA512:
6
- metadata.gz: 3218c97c5efba3b81e86bff225655c9ac09a5223973e7c5514cb1956f5178d192879d53da96218ad87e2a0062ecbc70cb5163cb4de6e4df7c4c1a7b5ba5a65da
7
- data.tar.gz: 3f3e63d34afd93f3216fd4827dfb222497c5d436923cd7214e9949984355ccd9540636c58d66e8b6fb7ec7c810f90deb4f81950dcaa313e8b7981caf5ab73b49
6
+ metadata.gz: 2fd1252c31ad76533f47cd2e5262e8e99710354af17308e50490773ca4670720dfeecab393938936db58a9f0a1b79656e88a8b143a9cd48b3223accd23958c1f
7
+ data.tar.gz: a4426e893afb1ea016504ef4853a452c99332b13b347810d66b2a9b0816fffe18eb60da85a6d83b7a1e771066bf3245dd8ed42d84e0b7d6e0d7b5a5b2d14b554
@@ -1,6 +1,7 @@
1
1
  require 'pipely/build/definition'
2
2
  require 'pipely/build/template'
3
3
  require 'pipely/build/daily_scheduler'
4
+ require 'pipely/build/hourly_scheduler'
4
5
  require 'pipely/build/right_now_scheduler'
5
6
  require 'pipely/build/s3_path_builder'
6
7
  require 'pipely/build/environment_config'
@@ -7,7 +7,7 @@ module Pipely
7
7
  class DailyScheduler
8
8
 
9
9
  def initialize(start_time)
10
- @start_time = start_time
10
+ @start_time = DateTime.parse(start_time).strftime('%H:%M:%S')
11
11
  end
12
12
 
13
13
  def period
@@ -44,6 +44,8 @@ module Pipely
44
44
  DailyScheduler.new(config[:start_time])
45
45
  when 'now'
46
46
  RightNowScheduler.new
47
+ when 'hourly'
48
+ HourlyScheduler.new
47
49
  else
48
50
  fail('unspecified scheduler')
49
51
  end
@@ -0,0 +1,29 @@
1
+ module Pipely
2
+ module Build
3
+
4
+ # Compute schedule attributes for a pipeline that runs once-a-day at a set
5
+ # time.
6
+ #
7
+ class HourlyScheduler
8
+
9
+ def period
10
+ '1 hours'
11
+ end
12
+
13
+ def start_date_time
14
+
15
+ (Time.now.utc + 3600).strftime("%Y-%m-%dT%H:00:00")
16
+
17
+ end
18
+
19
+ def to_hash
20
+ {
21
+ :period => period,
22
+ :start_date_time => start_date_time
23
+ }
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+ end
@@ -130,7 +130,8 @@ module Pipely
130
130
  def default_tags
131
131
  {
132
132
  "environment" => ENV['env'],
133
- "creator" => ENV['USER']
133
+ "creator" => ENV['USER'],
134
+ "deploy_id" => SecureRandom.uuid
134
135
  }
135
136
  end
136
137
 
@@ -1,3 +1,3 @@
1
1
  module Pipely
2
- VERSION = '0.12.0' unless defined?(::Pipely::VERSION)
2
+ VERSION = '0.13.0' unless defined?(::Pipely::VERSION)
3
3
  end
@@ -1,9 +1,8 @@
1
1
  require 'pipely/build/daily_scheduler'
2
-
2
+ require 'timecop'
3
3
  describe Pipely::Build::DailyScheduler do
4
4
 
5
5
  let(:start_time) { "11:00:00" }
6
-
7
6
  subject { described_class.new(start_time) }
8
7
 
9
8
  describe "#period" do
@@ -12,22 +11,41 @@ describe Pipely::Build::DailyScheduler do
12
11
  end
13
12
  end
14
13
 
14
+ context "if the start time is garbage" do
15
+ let(:start_time) { "0ksnsnk" }
16
+ it 'Raises an error' do
17
+ expect {described_class.new(start_time)}.to raise_exception ArgumentError
18
+ end
19
+ end
20
+
15
21
  describe "#start_date_time" do
16
- context "if the start time has already happened today in UTC" do
17
- it "chooses the start time tomorrow" do
18
- Timecop.freeze(Time.utc(2013, 6, 12, 16, 12, 30)) do
22
+ context "if the start time is 11:00:00 UTC" do
23
+ let(:start_time) { "11:00:00" }
24
+ it "and it is after that it chooses the start time tomorrow" do
25
+ Timecop.freeze(Time.utc(2013, 6, 13, 16, 12, 30)) do
26
+ expect(subject.start_date_time).to eq("2013-06-14T11:00:00")
27
+ end
28
+ end
29
+
30
+ it "and it is before that it chooses the start time today" do
31
+ Timecop.freeze(Time.utc(2013, 6, 13, 4, 12, 30)) do
19
32
  expect(subject.start_date_time).to eq("2013-06-13T11:00:00")
20
33
  end
21
34
  end
22
35
  end
23
36
 
24
- context "if the start time has not happened yet today in UTC" do
37
+ context "if the start time has is badly formatted" do
38
+ let(:start_time) { "9:00:" }
25
39
  it "chooses the start time today" do
26
40
  Timecop.freeze(Time.utc(2013, 6, 13, 4, 12, 30)) do
27
- expect(subject.start_date_time).to eq("2013-06-13T11:00:00")
41
+ expect(subject.start_date_time).to eq("2013-06-13T09:00:00")
42
+ end
43
+ end
44
+ it "chooses the start time tomorrow" do
45
+ Timecop.freeze(Time.utc(2013, 6, 13, 11, 12, 30)) do
46
+ expect(subject.start_date_time).to eq("2013-06-14T09:00:00")
28
47
  end
29
48
  end
30
49
  end
31
50
  end
32
-
33
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Gillooly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-13 00:00:00.000000000 Z
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-graphviz
@@ -240,6 +240,7 @@ files:
240
240
  - lib/pipely/build/daily_scheduler.rb
241
241
  - lib/pipely/build/definition.rb
242
242
  - lib/pipely/build/environment_config.rb
243
+ - lib/pipely/build/hourly_scheduler.rb
243
244
  - lib/pipely/build/right_now_scheduler.rb
244
245
  - lib/pipely/build/s3_path_builder.rb
245
246
  - lib/pipely/build/template.rb