active_pivot 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -3
- data/active_pivot.gemspec +1 -1
- data/lib/active_pivot/api/paginated_collection.rb +15 -2
- data/lib/active_pivot/api/project.rb +5 -3
- data/lib/active_pivot/importer.rb +8 -2
- data/lib/active_pivot/version.rb +1 -1
- data/lib/generators/active_pivot/migrations_generator.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91900b963062514c2b7bde44ce7ad8603a3fcec6
|
4
|
+
data.tar.gz: 418925417ea5c8482ea7d5dd8a0ebbb75e3dacd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1e230b197c717e72e6ba82400b4e4756a193ea11f7ebce077618332a810e53c5466f37b1e96cb079beabf42501179dbf1521e83a31f92518c779dea86c77c36
|
7
|
+
data.tar.gz: c81ff145b3fa7c5de7bf920038d600b31e56cd9089dfbb38998c3cb005fda38be27a797bb84863e942b4a6e0e6d4b296a8ba981eff4bc5ee7931c96d8c4b7af1
|
data/README.md
CHANGED
@@ -68,11 +68,22 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
68
68
|
|
69
69
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
70
70
|
|
71
|
+
## License
|
72
|
+
|
73
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
74
|
+
|
71
75
|
## Contributing
|
72
76
|
|
73
|
-
|
77
|
+
1. Fork it
|
78
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
79
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
80
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
81
|
+
5. Create new Pull Request
|
74
82
|
|
83
|
+
## About Foraker Labs
|
75
84
|
|
76
|
-
|
85
|
+
<img src="http://assets.foraker.com/foraker_logo.png" width="400" height="62">
|
77
86
|
|
78
|
-
|
87
|
+
This project is maintained by Foraker Labs. The names and logos of Foraker Labs are fully owned and copyright Foraker Design, LLC.
|
88
|
+
|
89
|
+
Foraker Labs is a Boulder-based Ruby on Rails and iOS development shop. Please reach out if we can [help build your product](http://www.foraker.com).
|
data/active_pivot.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{Import all of your Pivotal projects and stories easily}
|
13
13
|
#spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
|
-
spec.homepage = "
|
14
|
+
spec.homepage = "https://github.com/foraker/active_pivot"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
@@ -28,7 +28,7 @@ module ActivePivot
|
|
28
28
|
|
29
29
|
(2..total_pages).map do |page|
|
30
30
|
offset = limit * (page - 1)
|
31
|
-
|
31
|
+
send_request(params.merge(offset: offset))
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -37,8 +37,21 @@ module ActivePivot
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def first_page
|
40
|
-
@first_page ||=
|
40
|
+
@first_page ||= send_request(params)
|
41
|
+
end
|
42
|
+
|
43
|
+
def send_request(params = {})
|
44
|
+
Request.get(endpoint, params).tap do |response|
|
45
|
+
raise_request_error unless response.success?
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def raise_request_error
|
50
|
+
raise InvalidRequestError,
|
51
|
+
"Pivotal request failed. Endpoint #{endpoint} invalid with params: #{params}"
|
41
52
|
end
|
42
53
|
end
|
54
|
+
|
55
|
+
class InvalidRequestError < StandardError; end
|
43
56
|
end
|
44
57
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module ActivePivot
|
2
2
|
module Api
|
3
3
|
class Project < OpenStruct
|
4
|
+
COLLECTION_URL = "/services/v5/projects.json?fields=:default,current_velocity,current_volatility"
|
5
|
+
|
4
6
|
def self.all
|
5
|
-
Api::PaginatedCollection.new(
|
6
|
-
self.new(remote_project)
|
7
|
-
end
|
7
|
+
Api::PaginatedCollection.new(COLLECTION_URL).all.map do |remote_project|
|
8
|
+
self.new(remote_project)
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
10
12
|
end
|
@@ -5,9 +5,13 @@ module ActivePivot
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def run
|
8
|
+
puts "Importing Projects"
|
8
9
|
import_projects
|
10
|
+
puts "Importing Epics"
|
9
11
|
import_epics
|
12
|
+
puts "Importing Stories"
|
10
13
|
import_stories
|
14
|
+
puts "Importing Activity - may take up to 10 minutes"
|
11
15
|
import_activities
|
12
16
|
end
|
13
17
|
|
@@ -18,8 +22,10 @@ module ActivePivot
|
|
18
22
|
ActivePivot::Project.where(pivotal_id: remote_project.id)
|
19
23
|
.first_or_initialize
|
20
24
|
.update_attributes!({
|
21
|
-
name:
|
22
|
-
point_scale:
|
25
|
+
name: remote_project.name,
|
26
|
+
point_scale: remote_project.point_scale,
|
27
|
+
current_velocity: remote_project.current_velocity,
|
28
|
+
current_volatility: remote_project.current_volatility
|
23
29
|
})
|
24
30
|
end
|
25
31
|
end
|
data/lib/active_pivot/version.rb
CHANGED
@@ -2,7 +2,7 @@ module ActivePivot
|
|
2
2
|
module Generators
|
3
3
|
class MigrationsGenerator < ::Rails::Generators::Base
|
4
4
|
def create_all
|
5
|
-
generate "migration", "create_pivotal_projects pivotal_id:integer name:text point_scale:text updated_at:datetime created_at:datetime"
|
5
|
+
generate "migration", "create_pivotal_projects pivotal_id:integer name:text point_scale:text current_velocity:integer current_volatility:integer updated_at:datetime created_at:datetime"
|
6
6
|
generate "migration", "create_pivotal_epics project_id:integer:index pivotal_id:integer label_id:integer name:string url:string updated_at:datetime created_at:datetime"
|
7
7
|
generate "migration", "create_pivotal_stories pivotal_id:integer project_id:integer:index started_at:datetime accepted_at:datetime url:string estimate:integer name:text description:text kind:string story_type:string labels:text current_state:string tags:text[] updated_at:datetime created_at:datetime"
|
8
8
|
generate "migration", "create_pivotal_epic_stories story_id:integer:index epic_id:integer:index updated_at:datetime created_at:datetime"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_pivot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allan McLelland
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-08-
|
12
|
+
date: 2015-08-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -122,7 +122,7 @@ files:
|
|
122
122
|
- lib/active_pivot/version.rb
|
123
123
|
- lib/generators/active_pivot/migrations_generator.rb
|
124
124
|
- lib/tasks/import.rake
|
125
|
-
homepage:
|
125
|
+
homepage: https://github.com/foraker/active_pivot
|
126
126
|
licenses:
|
127
127
|
- MIT
|
128
128
|
metadata:
|