geordi 0.18.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +13 -5
  2. data/.ruby-version +1 -0
  3. data/README.md +199 -110
  4. data/Rakefile +40 -0
  5. data/bin/apache-site +1 -19
  6. data/bin/cap-all +1 -27
  7. data/bin/cleanup-directory +1 -11
  8. data/bin/console-for +1 -12
  9. data/bin/cuc +1 -2
  10. data/bin/cuc-show +1 -2
  11. data/bin/cuc-vnc-setup +1 -114
  12. data/bin/deploy-to-production +1 -91
  13. data/bin/dump-for +4 -32
  14. data/bin/dumple +2 -4
  15. data/bin/geordi +10 -0
  16. data/bin/gitpt +1 -2
  17. data/bin/launchy_browser +9 -3
  18. data/bin/load-dump +1 -4
  19. data/bin/migrate-all +1 -13
  20. data/bin/optimize-png +1 -118
  21. data/bin/power-rake +1 -7
  22. data/bin/remove-executable-flags +1 -6
  23. data/bin/rs +1 -26
  24. data/bin/run_tests +1 -2
  25. data/bin/setup-firefox-for-selenium +1 -3
  26. data/bin/shell-for +1 -8
  27. data/bin/tests +1 -5
  28. data/geordi.gemspec +19 -0
  29. data/lib/geordi/COMMAND_TEMPLATE +29 -0
  30. data/lib/geordi/capistrano.rb +9 -7
  31. data/lib/geordi/capistrano_config.rb +66 -0
  32. data/lib/geordi/cli.rb +28 -0
  33. data/lib/geordi/commands/all_targets.rb +26 -0
  34. data/lib/geordi/commands/apache_site.rb +22 -0
  35. data/lib/geordi/commands/bundle_install.rb +7 -0
  36. data/lib/geordi/commands/cleanup_directory.rb +16 -0
  37. data/lib/geordi/commands/commit.rb +171 -0
  38. data/lib/geordi/commands/console.rb +24 -0
  39. data/lib/geordi/commands/create_database_yml.rb +18 -0
  40. data/lib/geordi/commands/create_databases.rb +16 -0
  41. data/lib/geordi/commands/cucumber.rb +20 -0
  42. data/lib/geordi/commands/deploy.rb +65 -0
  43. data/lib/geordi/commands/devserver.rb +14 -0
  44. data/lib/geordi/commands/dump.rb +63 -0
  45. data/lib/geordi/commands/migrate.rb +26 -0
  46. data/lib/geordi/commands/png_optimize.rb +92 -0
  47. data/lib/geordi/commands/rake.rb +21 -0
  48. data/lib/geordi/commands/remove_executable_flags.rb +14 -0
  49. data/lib/geordi/commands/rspec.rb +40 -0
  50. data/lib/geordi/commands/security_update.rb +56 -0
  51. data/lib/geordi/commands/setup.rb +33 -0
  52. data/lib/geordi/commands/setup_firefox_for_selenium.rb +6 -0
  53. data/lib/geordi/commands/setup_vnc.rb +84 -0
  54. data/lib/geordi/commands/shell.rb +20 -0
  55. data/lib/geordi/commands/test.rb +9 -0
  56. data/lib/geordi/commands/unit.rb +11 -0
  57. data/lib/geordi/commands/update.rb +33 -0
  58. data/lib/geordi/commands/version.rb +7 -0
  59. data/lib/geordi/commands/vnc_show.rb +6 -0
  60. data/lib/geordi/commands/with_firefox_for_selenium.rb +18 -0
  61. data/lib/geordi/commands/with_rake.rb +11 -0
  62. data/lib/geordi/{cuc.rb → cucumber.rb} +28 -39
  63. data/lib/geordi/dump_loader.rb +44 -70
  64. data/lib/geordi/firefox_for_selenium.rb +93 -74
  65. data/lib/geordi/interaction.rb +47 -0
  66. data/lib/geordi/remote.rb +66 -0
  67. data/lib/geordi/util.rb +60 -0
  68. data/lib/geordi/version.rb +1 -1
  69. data/lib/geordi.rb +1 -0
  70. metadata +50 -16
  71. data/bin/install-gems-remotely +0 -18
  72. data/bin/install-gems-remotely.sh +0 -16
  73. data/bin/power-deploy +0 -18
  74. data/bin/remotify-local-branch +0 -12
  75. data/lib/geordi/gitpt.rb +0 -175
data/lib/geordi/gitpt.rb DELETED
@@ -1,175 +0,0 @@
1
- require 'rubygems'
2
- require 'highline'
3
- require 'pivotal-tracker'
4
- require 'yaml'
5
-
6
- module Geordi
7
- class Gitpt
8
-
9
- attr_reader :token, :initials, :settings_file, :deprecated_token_file,
10
- :highline, :applicable_stories, :memberships
11
-
12
- def initialize
13
- @highline = HighLine.new
14
- @settings_file = File.join(ENV['HOME'], '.gitpt')
15
- @deprecated_token_file = File.join(ENV['HOME'], '.pt_token')
16
- load_settings
17
- settings_were_invalid = (not settings_valid?)
18
-
19
- hello unless settings_valid?
20
- request_settings while not settings_valid?
21
- stored if settings_were_invalid
22
-
23
- PivotalTracker::Client.use_ssl = true
24
- PivotalTracker::Client.token = token
25
- end
26
-
27
- def settings_valid?
28
- token and token.size > 10
29
- end
30
-
31
- def bold(string)
32
- HighLine::BOLD + string + HighLine::RESET
33
- end
34
-
35
- def highlight(string)
36
- bold HighLine::BLUE + string
37
- end
38
-
39
- def hello
40
- highline.say HighLine::RESET
41
- highline.say "Welcome to #{bold 'gitpt'}.\n\n"
42
- end
43
-
44
- def left(string)
45
- leading_whitespace = (string.match(/\A( +)[^ ]+/) || [])[1]
46
- string.gsub! /^#{leading_whitespace}/, '' if leading_whitespace
47
- string
48
- end
49
-
50
- def loading(message, &block)
51
- print message
52
- STDOUT.flush
53
- yield
54
- print "\r" + ' ' * message.size + "\r" # Remove loading message
55
- STDOUT.flush
56
- end
57
-
58
- def stored
59
- highline.say left(<<-MESSAGE)
60
- Thank you. Your settings have been stored at #{highlight @settings_file}
61
- You may remove that file for the wizard to reappear.
62
-
63
- ----------------------------------------------------
64
-
65
- MESSAGE
66
- end
67
-
68
- def request_settings
69
- highline.say highlight('Your settings are missing or invalid.')
70
- highline.say "Please configure your Pivotal Tracker access.\n\n"
71
- token = highline.ask bold("Your API key:") + " "
72
- initials = highline.ask bold("Your PT initials") + " (optional, used for highlighting your stories): "
73
- highline.say "\n"
74
-
75
- settings = { :token => token, :initials => initials }
76
- File.open settings_file, 'w' do |file|
77
- file.write settings.to_yaml
78
- end
79
- load_settings
80
- end
81
-
82
- def load_settings
83
- if File.exists? settings_file
84
- settings = YAML.load(File.read settings_file)
85
- @initials = settings[:initials]
86
- @token = settings[:token]
87
- else
88
- if File.exists?(deprecated_token_file)
89
- highline.say left(<<-MESSAGE)
90
- #{HighLine::YELLOW}You are still using #{highlight(deprecated_token_file) + HighLine::YELLOW} which will be deprecated in a future version.
91
- Please migrate your settings to ~/.gitpt or remove #{deprecated_token_file} for the wizard to cast magic.
92
- MESSAGE
93
- @token = File.read(deprecated_token_file)
94
- end
95
- end
96
- end
97
-
98
- def load_projects
99
- project_id_filename = '.pt_project_id'
100
- if File.exists?(project_id_filename)
101
- project_ids = File.read('.pt_project_id').split(/[\s]+/).map(&:to_i)
102
- end
103
-
104
- unless project_ids and project_ids.size > 0
105
- highline.say left(<<-MESSAGE)
106
- Sorry, I could not find a project ID in #{highlight project_id_filename} :(
107
-
108
- Please put at least one Pivotal Tracker project id into #{project_id_filename} in this directory.
109
- You may add multiple IDs, separated using white space.
110
- MESSAGE
111
- exit 1
112
- end
113
-
114
- loading 'Connecting to Pivotal Tracker...' do
115
- projects = project_ids.collect do |project_id|
116
- PivotalTracker::Project.find(project_id)
117
- end
118
-
119
- @memberships = projects.collect(&:memberships).map(&:all).flatten
120
-
121
- @applicable_stories = projects.collect do |project|
122
- project.stories.all(:state => 'started,finished,rejected')
123
- end.flatten
124
- end
125
- end
126
-
127
- def choose_story
128
- selected_story = nil
129
-
130
- highline.choose do |menu|
131
- menu.header = "Choose a story"
132
- applicable_stories.each do |story|
133
- owner_name = story.owned_by
134
- owner = if owner_name
135
- owners = memberships.select{|member| member.name == owner_name}
136
- owners.first ? owners.first.initials : '?'
137
- else
138
- '?'
139
- end
140
-
141
- state = story.current_state
142
- if state == 'started'
143
- state = HighLine::GREEN + state + HighLine::RESET
144
- elsif state != 'finished'
145
- state = HighLine::RED + state + HighLine::RESET
146
- end
147
- state += HighLine::BOLD if owner == initials
148
-
149
- label = "(#{owner}, #{state}) #{story.name}"
150
- label = bold(label) if owner == initials
151
- menu.choice(label) { selected_story = story }
152
- end
153
- menu.hidden ''
154
- end
155
-
156
- if selected_story
157
- message = highline.ask("\nAdd an optional message")
158
- highline.say message
159
-
160
- commit_message = "[##{selected_story.id}] #{selected_story.name}"
161
- if message.strip != ''
162
- commit_message << ' - '<< message.strip
163
- end
164
-
165
- exec('git', 'commit', '-m', commit_message)
166
- end
167
- end
168
-
169
- def run
170
- load_projects
171
- choose_story
172
- end
173
-
174
- end
175
- end