greenhouse 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6027cc41bf0c1a926c85278dd081e434c06fae2d
4
- data.tar.gz: c5b70d6f770987c6b2693e082914fecf30af4f43
3
+ metadata.gz: cb09c160cfae667639e3d36d4ac008e47dcbd7fd
4
+ data.tar.gz: a20696bc130d382de9b591e2336f34f5f943d667
5
5
  SHA512:
6
- metadata.gz: 1c57213c213b37f6792878f8b2c137c99306e7fb95e4ef5329ad28185d38bfa7e16046ab8d3b92e506c2747879bd9ccaeeda015bd16747c000e0fa71b05f112b
7
- data.tar.gz: f6f746e1e7ac782bb6dd55f999795e9aa56f689078aa9227a27f77c3261ea222c7d703f67898c77c8793525dbcf99b5bbabb12d9b72cc92a0915a382349113ed
6
+ metadata.gz: 04f751c5e720212da0918a2868bbc727083295bb96e61eb8613d3ecec9c8c133567a9cf4f2b80fe05b9072f032993f74e8ef7652bb3dcda9709445c5eb425dea
7
+ data.tar.gz: 0bccfedd895e135bce4ecd184349b6275d9f0f0e33b932177e67336d706e1d2c774fd8eb67c73c61421ab026cebd553cfda7ce8db10a2c4c86af91e1b8868fcb
@@ -0,0 +1,42 @@
1
+ module Greenhouse
2
+ module Commands
3
+ class Console
4
+ include Command
5
+ command_summary "Run a rails console for one of your applications"
6
+ project_arguments *Projects::applications.map(&:to_arg)
7
+
8
+ class << self
9
+ def usage
10
+ puts <<USAGE
11
+ usage: #{::Greenhouse::CLI.command_name} #{command_name} <application> #{valid_arguments.to_s}
12
+
13
+ Applications:
14
+ #{project_arguments.to_help}
15
+ USAGE
16
+ end
17
+ end
18
+
19
+ def run
20
+ if arguments.empty? || arguments.all? { |arg| valid_arguments.map(&:keys).flatten.include?(arg) }
21
+ puts "An application is required."
22
+ puts
23
+ print " "
24
+ usage
25
+ return
26
+ end
27
+
28
+ app = Projects::applications.select { |application| arguments.map(&:key).include?(application.name) }.first
29
+ if app.nil?
30
+ puts "Application does not exist. Try adding it with `#{::Greenhouse::CLI::binary} add` and initializing it with `#{::Greenhouse::CLI::binary} init`"
31
+ return
32
+ end
33
+
34
+ Bundler.with_clean_env do
35
+ app.chdir do
36
+ exec 'bundle exec rails console'
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -24,6 +24,7 @@ require 'greenhouse/commands/add'
24
24
  require 'greenhouse/commands/status'
25
25
  require 'greenhouse/commands/launch'
26
26
  require 'greenhouse/commands/start'
27
+ require 'greenhouse/commands/console'
27
28
  require 'greenhouse/commands/push'
28
29
  require 'greenhouse/commands/pull'
29
30
  require 'greenhouse/commands/sync'
@@ -15,8 +15,8 @@ module Greenhouse
15
15
 
16
16
  def initialize(name, args={})
17
17
  @name = name
18
- @title = args.delete('title') || name.camelize
19
- @ignored = (args.has_key?('ignore') ? [args.delete('ignore')] : []).flatten
18
+ @title = args.delete(:title) || name.camelize
19
+ @ignored = (args.has_key?(:ignore) ? [args.delete(:ignore)] : []).flatten
20
20
  @repository = Repository.new(name, args)
21
21
  @ignore_file = Resources::IgnoreFile.new("#{path}/.ignore")
22
22
  end
@@ -30,7 +30,7 @@ module Greenhouse
30
30
 
31
31
  projects_file.projects.each do |name,project|
32
32
  type = (project.has_key?('type') ? project['type'] : 'project')
33
- projargs = project.merge({:remote => (project['remote'] || project['git'])})
33
+ projargs = Hash[project.merge({:remote => (project['remote'] || project['git'])}).map{ |k,v| [k.to_sym, v] }]
34
34
  classname = "Greenhouse::Projects::#{type.singularize.camelize}"
35
35
  @@projects << (defined?(classname.constantize) ? classname.constantize.new(name, projargs) : Greenhouse::Projects::Project.new(name, projargs))
36
36
  end
@@ -78,16 +78,16 @@ module Greenhouse
78
78
  argarr = arg.split("=")
79
79
  argkey = argarr.slice!(0)
80
80
 
81
- if !valid_arguments.concat(project_arguments).map(&:keys).any? { |keys| keys.include?(argkey) } && !arg.match(/\A(-)+[a-z0-9\-]=?.*\Z/i) && (a > 0 && args[a-1].match(/\A(-)+[a-z0-9\-]=?.*\Z/i)) && !@arguments.empty?
81
+ if !valid_arguments.clone.concat(project_arguments).map(&:keys).any? { |keys| keys.include?(argkey) } && !arg.match(/\A(-)+[a-z0-9\-]=?.*\Z/i) && (a > 0 && args[a-1].match(/\A(-)+[a-z0-9\-]=?.*\Z/i)) && !@arguments.empty?
82
82
  @arguments.last.value = arg
83
83
  next
84
84
  end
85
85
 
86
86
  if validate_arguments?
87
- raise InvalidArgument, "Invalid Argument: #{arg}" unless valid_arguments.concat(project_arguments).map(&:keys).any? { |keys| keys.include?(argkey) }
88
- @arguments << valid_arguments.concat(project_arguments).select { |varg| varg.keys.include?(argkey) }.first
87
+ raise InvalidArgument, "Invalid Argument: #{arg}" unless valid_arguments.clone.concat(project_arguments).map(&:keys).any? { |keys| keys.include?(argkey) }
88
+ @arguments << valid_arguments.clone.concat(project_arguments).select { |varg| varg.keys.include?(argkey) }.first
89
89
  else
90
- valid_arg = valid_arguments.concat(project_arguments).select { |varg| varg.keys.include?(argkey) }.first
90
+ valid_arg = valid_arguments.clone.concat(project_arguments).select { |varg| varg.keys.include?(argkey) }.first
91
91
  @arguments << (valid_arg || Argument.new(argkey))
92
92
  end
93
93
  @arguments.last.value = argarr.join("=") unless argarr.empty?
@@ -6,7 +6,7 @@ module Greenhouse
6
6
  def prompt_for_project
7
7
  remote = nil
8
8
  print "Enter a git remote to add a project (leave blank to skip): "
9
- remote = STDIN.gets.chomp.downcase
9
+ remote = STDIN.gets.chomp
10
10
  return if remote.empty?
11
11
  project = Projects::Project.new(remote.match(/([^\/]*)\.git/)[1], {remote: remote})
12
12
 
@@ -1,8 +1,13 @@
1
1
  module Greenhouse
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
4
4
 
5
5
  __END__
6
+ 0.0.6:
7
+ * Don't downcase git repos (duh)
8
+ * Add console command to easily run rails console for rails apps
9
+ * Some minor internal cleanup
10
+
6
11
  0.0.5:
7
12
  * Fix for pushing projects by ensuring each branch is pushed individually
8
13
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: greenhouse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rebec
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-30 00:00:00.000000000 Z
11
+ date: 2013-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -133,6 +133,7 @@ files:
133
133
  - lib/greenhouse/commands/new.rb
134
134
  - lib/greenhouse/commands/status.rb
135
135
  - lib/greenhouse/commands/sync.rb
136
+ - lib/greenhouse/commands/console.rb
136
137
  - lib/greenhouse/commands/launch.rb
137
138
  - lib/greenhouse/commands/add.rb
138
139
  - lib/greenhouse/commands/push.rb