pivotal-github 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pivotal-github/story_accept.rb +17 -17
- data/lib/pivotal-github/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45a58bb6127bbee7345696b43a96afc44fde54ee
|
4
|
+
data.tar.gz: 937b78962142d01fa2d252c4d632818490573d2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba3a6db85f4bdea3eef8aa16e0e38a7eb5ae2aead40dc2123b7b27e845fce40b9eb06260ae585303c5ca7b52b7761683e32a34a0ab65d9ece1011e4e63bb21d0
|
7
|
+
data.tar.gz: 2f90885f4c94c5c07ba0cb9ea186de358b2f65c5a2e57a6f3098dc74992cea03501406ae1dea3d272f3708c72dca30b48364cf87abb0c8dbb7dd822797b168af
|
@@ -58,28 +58,26 @@ class StoryAccept < Command
|
|
58
58
|
Nokogiri::XML(response.body).at_css('current_state').content == "accepted"
|
59
59
|
end
|
60
60
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
@
|
61
|
+
def config_filename(filename, description)
|
62
|
+
if File.exist?(filename)
|
63
|
+
add_to_gitignore(filename)
|
64
|
+
varname = '@' + filename.sub('.', '')
|
65
|
+
value = File.read(filename).strip
|
66
|
+
instance_variable_set(varname, value)
|
65
67
|
else
|
66
|
-
puts "Please create a file called '#{
|
67
|
-
puts "containing
|
68
|
-
add_to_gitignore(
|
68
|
+
puts "Please create a file called '#{filename}'"
|
69
|
+
puts "containing #{description}."
|
70
|
+
add_to_gitignore(filename)
|
69
71
|
exit 1
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
75
|
+
def api_token
|
76
|
+
config_filename('.api_token', 'your Pivotal tracker API token')
|
77
|
+
end
|
78
|
+
|
73
79
|
def project_id
|
74
|
-
|
75
|
-
if File.exist?(project_id_filename)
|
76
|
-
@project_id ||= File.read(project_id_filename).strip
|
77
|
-
else
|
78
|
-
puts "Please create a file called '.project_id'"
|
79
|
-
puts "containing the Pivotal Tracker project number."
|
80
|
-
add_to_gitignore('.project_id')
|
81
|
-
exit 1
|
82
|
-
end
|
80
|
+
config_filename('.project_id', 'the Pivotal tracker project id')
|
83
81
|
end
|
84
82
|
|
85
83
|
# Adds a filename to the .gitignore file (if necessary).
|
@@ -90,7 +88,9 @@ class StoryAccept < Command
|
|
90
88
|
if File.exist?(gitignore)
|
91
89
|
contents = File.read(gitignore)
|
92
90
|
unless contents =~ /#{filename}/
|
93
|
-
|
91
|
+
# Prepend a newline if the file doesn't end in a newline.
|
92
|
+
line = contents == contents.chomp ? "\n#{filename}" : filename
|
93
|
+
File.open(gitignore, 'a') { |f| f.puts(line) }
|
94
94
|
puts "Added #{filename} to .gitignore"
|
95
95
|
end
|
96
96
|
end
|