artisan-core 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  require "artisan/activity/iteration_auditor"
2
+ require "artisan/iterations/iteration_point_calculator"
2
3
  require "artisan/iterations/iterations_interactor"
3
4
  require "artisan/iterations/move_to_backlog"
4
5
  require "artisan/repository"
@@ -22,7 +23,7 @@ module Artisan
22
23
 
23
24
  Activity::IterationAuditor.completed(iteration.id, iteration.project.id, user.id)
24
25
  MoveToBacklog.new(iteration).move
25
- #
26
+ #
26
27
  # Artisan::Stories.for(project.id, user).backlog.each do |story|
27
28
  # story.position += 1 if story.position
28
29
  # Artisan::Repository.story.save(story)
@@ -1,3 +1,5 @@
1
+ require "artisan/stories/stories_interactor"
2
+
1
3
  module Artisan
2
4
  module Iterations
3
5
  class MoveToBacklog
@@ -0,0 +1,26 @@
1
+ module Artisan
2
+ module Notifications
3
+ class EventMailer
4
+
5
+ def initialize(project)
6
+ @project_name = project.name
7
+ @configuration = project.project_configuration
8
+ @archived = project.archived
9
+ end
10
+
11
+ def new_assigned_user(story)
12
+ if !@archived
13
+ email_list = @configuration.story_assigned_email_list.join(", ")
14
+ Notifier.new_assigned_user(@project_name, story.assigned_user.full_name, story.name, email_list).deliver if !email_list.empty?
15
+ end
16
+ end
17
+
18
+ def completed_story(story)
19
+ if !@archived
20
+ email_list = @configuration.story_completed_email_list.join(", ")
21
+ Notifier.completed_story(@project_name, story.name, email_list).deliver if !email_list.empty?
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,40 @@
1
+ require 'artisan/repository'
2
+
3
+ module Artisan
4
+ module Notifications
5
+ class Inviter
6
+ EMAIL_REGEX = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/
7
+
8
+ def initialize(name, email)
9
+ @name = name
10
+ @email = email
11
+ end
12
+
13
+ def invite
14
+ if valid_name? && valid_email?
15
+ mail_invite
16
+ else
17
+ raise "Name and email fields are required, please fill out all fields and try again."
18
+ end
19
+ end
20
+
21
+ def add_to_future_users(project)
22
+ Artisan::Repository.future_user.create(:email => @email, :project_id => project.id)
23
+ end
24
+
25
+ private
26
+
27
+ def valid_name?
28
+ return !@name.nil? && !@name.empty?
29
+ end
30
+
31
+ def valid_email?
32
+ return @email =~ EMAIL_REGEX
33
+ end
34
+
35
+ def mail_invite
36
+ Invites.invite(@name, @email).deliver
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,7 +1,7 @@
1
1
  require "artisan/crud_strategy"
2
2
  require "artisan/repository"
3
3
  require "artisan/activity/project_auditor"
4
- require "artisan/team"
4
+ require "artisan/teams/team"
5
5
  require "artisan/projects/api_key_generator"
6
6
 
7
7
  module Artisan
@@ -24,7 +24,7 @@ module Artisan
24
24
  Activity::ProjectAuditor.created(project.id, @user.id, project_attributes)
25
25
  generate_first_iteration_for project
26
26
  repository.create_project_configuration(project)
27
- Team.new(project, @user).add_team_owner(@user)
27
+ Teams::Team.new(project, @user).add_team_owner(@user)
28
28
 
29
29
  @callbacks.call(:success, project)
30
30
  else
@@ -46,7 +46,11 @@ module Artisan
46
46
  private
47
47
 
48
48
  def check_permissions(project, user)
49
- raise "You are not authorized to view this project." if !Team.new(project, user).user?(user)
49
+ raise "You are not authorized to view this project." if !authorized?(project, user)
50
+ end
51
+
52
+ def authorized?(project, user)
53
+ Teams::Team.new(project, user).user?(user)
50
54
  end
51
55
 
52
56
 
@@ -1,3 +1,8 @@
1
+ require "artisan/iterations/iterations"
2
+ require "artisan-memory-repository/models/iteration"
3
+ require "artisan-memory-repository/models/project"
4
+ require "artisan-memory-repository/models/story"
5
+
1
6
  module Artisan
2
7
  module Reports
3
8
 
@@ -1,8 +1,13 @@
1
+ require "artisan/reports/burn_up_chart"
2
+ require "artisan/reports/average_stat_per_iteration_data"
3
+ require "artisan/reports/percentage_of_commitments_met_data"
4
+ require "lazy_high_charts"
5
+
1
6
  module Artisan
2
7
  module Reports
3
8
  module HighChartsDataRetriever
4
9
  def self.build_burn_up_chart(project)
5
- chart_data = Artisan::Reports::BurnUpChart.new(project)
10
+ chart_data = ::Artisan::Reports::BurnUpChart.new(project)
6
11
 
7
12
  LazyHighCharts::HighChart.new do |f|
8
13
  f.chart(:defaultSeriesType => 'line', :backgroundColor => nil, :margin => [0,0,0,0])
@@ -72,6 +77,3 @@ module Artisan
72
77
  end
73
78
  end
74
79
  end
75
-
76
-
77
-
@@ -1,3 +1,5 @@
1
+ require "artisan/reports/high_charts_data_retriever"
2
+
1
3
  module Artisan
2
4
  module Reports
3
5
  class HighChartsInteractor
@@ -1,5 +1,6 @@
1
1
  require "artisan/crud_strategy"
2
- require 'artisan/activity/story_auditor'
2
+ require "artisan/activity/story_auditor"
3
+ require "artisan/stories/story_collection"
3
4
  require "artisan/stories/story_numberer"
4
5
 
5
6
  module Artisan
@@ -1,5 +1,7 @@
1
1
  class StoryExporter
2
2
 
3
+ # DEPRECATE (BP) - activesupport dependency FTL
4
+
3
5
  UNNECESSARY_FIELDS = [:complete, :completed_at, :creator_id, :deleted, :foreign_id, :iteration_id, :split_from, :updated_at]
4
6
 
5
7
  def initialize(story)
File without changes
@@ -0,0 +1,53 @@
1
+ require 'artisan/repository'
2
+ require 'ostruct'
3
+
4
+ module Artisan
5
+ module Teams
6
+ class Team
7
+
8
+ attr_reader :project
9
+
10
+ def initialize(project, current_user)
11
+ @project = project
12
+ end
13
+
14
+ def add_team_member(user)
15
+ add_member(user, false)
16
+ end
17
+
18
+ def add_team_owner(user)
19
+ add_member(user, true)
20
+ end
21
+
22
+ def owner?(user)
23
+ return false if project.nil? || !user?(user)
24
+ project_repo.is_owner?(project, user)
25
+ end
26
+
27
+ def user?(user)
28
+ project_repo.is_member?(project, user)
29
+ end
30
+
31
+ def remove_user(user)
32
+ project_repo.remove_member(project, user)
33
+ if !user.nil?
34
+ Artisan::Member.new(OpenStruct.new(:user => user, :project => project)).remove_from_email_lists
35
+ end
36
+ end
37
+
38
+ def owners
39
+ project_repo.owners(project)
40
+ end
41
+
42
+ private
43
+
44
+ def add_member(user, owner)
45
+ project_repo.add_member(project, user, owner) unless user?(user)
46
+ end
47
+
48
+ def project_repo
49
+ Artisan::Repository.project
50
+ end
51
+ end
52
+ end
53
+ end
metadata CHANGED
@@ -1,27 +1,38 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: artisan-core
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
4
5
  prerelease:
5
- version: 0.0.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - 8th Light Craftsmen
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-10-10 00:00:00 Z
14
- dependencies: []
15
-
12
+ date: 2012-10-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: lazy_high_charts
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.1.5
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.1.5
16
30
  description: Artisan Core behavior
17
31
  email: paul@8thlight.com
18
32
  executables: []
19
-
20
33
  extensions: []
21
-
22
34
  extra_rdoc_files: []
23
-
24
- files:
35
+ files:
25
36
  - lib/artisan/activity/activity_interactor.rb
26
37
  - lib/artisan/activity/activity_presenter.rb
27
38
  - lib/artisan/activity/formatters/diff_changes.rb
@@ -33,8 +44,6 @@ files:
33
44
  - lib/artisan/activity/story_auditor.rb
34
45
  - lib/artisan/callbacks.rb
35
46
  - lib/artisan/crud_strategy.rb
36
- - lib/artisan/event_mailer.rb
37
- - lib/artisan/inviter.rb
38
47
  - lib/artisan/iterations/iteration_point_calculator.rb
39
48
  - lib/artisan/iterations/iteration_presenter.rb
40
49
  - lib/artisan/iterations/iteration_workflow_interactor.rb
@@ -43,8 +52,9 @@ files:
43
52
  - lib/artisan/iterations/iterations_interactor.rb
44
53
  - lib/artisan/iterations/move_to_backlog.rb
45
54
  - lib/artisan/iterations/story_tags.rb
46
- - lib/artisan/member.rb
47
55
  - lib/artisan/no_op_callbacks.rb
56
+ - lib/artisan/notifications/event_mailer.rb
57
+ - lib/artisan/notifications/inviter.rb
48
58
  - lib/artisan/projects/api_key_generator.rb
49
59
  - lib/artisan/projects/archive_interactor.rb
50
60
  - lib/artisan/projects/completed_stories_presenter.rb
@@ -61,7 +71,6 @@ files:
61
71
  - lib/artisan/reports/signoff/pdf.rb
62
72
  - lib/artisan/reports/signoff/report.rb
63
73
  - lib/artisan/reports/velocity_report.rb
64
- - lib/artisan/repository.rb
65
74
  - lib/artisan/stories/pert_calculator.rb
66
75
  - lib/artisan/stories/stories_interactor.rb
67
76
  - lib/artisan/stories/story_collection.rb
@@ -72,57 +81,30 @@ files:
72
81
  - lib/artisan/story_board.rb
73
82
  - lib/artisan/story_column_changer.rb
74
83
  - lib/artisan/story_exporter.rb
75
- - lib/artisan/team.rb
76
- - spec/crud_strategy_spec.rb
77
- - spec/event_mailer_spec.rb
78
- - spec/inviter_spec.rb
79
- - spec/member_spec.rb
80
- - spec/repository_spec.rb
81
- - spec/story_board_spec.rb
82
- - spec/story_collection_spec.rb
83
- - spec/story_column_changer_spec.rb
84
- - spec/story_exporter_spec.rb
85
- - spec/story_sorter_spec.rb
86
- - spec/team_spec.rb
84
+ - lib/artisan/teams/member.rb
85
+ - lib/artisan/teams/team.rb
87
86
  homepage: http://8thlight.com
88
87
  licenses: []
89
-
90
88
  post_install_message:
91
89
  rdoc_options: []
92
-
93
- require_paths:
90
+ require_paths:
94
91
  - lib
95
- required_ruby_version: !ruby/object:Gem::Requirement
92
+ required_ruby_version: !ruby/object:Gem::Requirement
96
93
  none: false
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- hash: -751255112709990634
101
- segments:
102
- - 0
103
- version: "0"
104
- required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
99
  none: false
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: "0"
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
110
104
  requirements: []
111
-
112
105
  rubyforge_project:
113
106
  rubygems_version: 1.8.24
114
107
  signing_key:
115
108
  specification_version: 3
116
109
  summary: Artisan Core
117
- test_files:
118
- - spec/crud_strategy_spec.rb
119
- - spec/event_mailer_spec.rb
120
- - spec/inviter_spec.rb
121
- - spec/member_spec.rb
122
- - spec/repository_spec.rb
123
- - spec/story_board_spec.rb
124
- - spec/story_collection_spec.rb
125
- - spec/story_column_changer_spec.rb
126
- - spec/story_exporter_spec.rb
127
- - spec/story_sorter_spec.rb
128
- - spec/team_spec.rb
110
+ test_files: []
@@ -1,22 +0,0 @@
1
- class EventMailer
2
-
3
- def initialize(project)
4
- @project_name = project.name
5
- @configuration = project.project_configuration
6
- @archived = project.archived
7
- end
8
-
9
- def new_assigned_user(story)
10
- if !@archived
11
- email_list = @configuration.story_assigned_email_list.join(", ")
12
- Notifier.new_assigned_user(@project_name, story.assigned_user.full_name, story.name, email_list).deliver if !email_list.empty?
13
- end
14
- end
15
-
16
- def completed_story(story)
17
- if !@archived
18
- email_list = @configuration.story_completed_email_list.join(", ")
19
- Notifier.completed_story(@project_name, story.name, email_list).deliver if !email_list.empty?
20
- end
21
- end
22
- end
@@ -1,36 +0,0 @@
1
- require 'artisan/repository'
2
-
3
- class Inviter
4
- EMAIL_REGEX = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/
5
-
6
- def initialize(name, email)
7
- @name = name
8
- @email = email
9
- end
10
-
11
- def invite
12
- if valid_name? && valid_email?
13
- mail_invite
14
- else
15
- raise "Name and email fields are required, please fill out all fields and try again."
16
- end
17
- end
18
-
19
- def add_to_future_users(project)
20
- Artisan::Repository.future_user.create(:email => @email, :project_id => project.id)
21
- end
22
-
23
- private
24
-
25
- def valid_name?
26
- return !@name.nil? && !@name.empty?
27
- end
28
-
29
- def valid_email?
30
- return @email =~ EMAIL_REGEX
31
- end
32
-
33
- def mail_invite
34
- Invites.invite(@name, @email).deliver
35
- end
36
- end