molflow 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 836aa8b9130202fe2c84adc752f2ed7503d66566
4
- data.tar.gz: fe2c3afb559e992a6ab4474c4239ba1125e21c3a
3
+ metadata.gz: 3051535820c9d5ee3f7c8456b0fea1ffc361b399
4
+ data.tar.gz: f8530e2828227be2784d4e893292dd58753de3fc
5
5
  SHA512:
6
- metadata.gz: 3619a381ae99524f3480662ab6aab6acec05a566df849cf6b5195466631a6747969710f9d93f983cf0bbec2bed1aa113f86d11ed5f3853aca29955dd28f65a55
7
- data.tar.gz: 60a208a9157c01e7585fbf2a506a96930a77513b099bd3e925f083b46fdd9adcfbba5a4d235836fd0abe03eb76d6befde863629fd12da36c0b1fc39e7f0c27fe
6
+ metadata.gz: cf78541e7af95b9f4502600a7e35dff57dc26bee2cf7f0c02c76430d0426054a59b3b8ecd0b11b87cbc0e171286f6095f50d065e96a03502d544cd0a45e53c4a
7
+ data.tar.gz: db9b0483d061613ef308cc4ab2a840c2f0a5dd0f7523fe3949d43b09ec4735a311649a0e971fe8d5021ba96fcc9eb8a9ba34a206954fff0ad0a65fcc8d476b4f
data/Gemfile CHANGED
@@ -3,5 +3,9 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in molflow.gemspec
4
4
  gemspec
5
5
 
6
- gem 'jira-ruby', require: :jira
7
- gem 'pry'
6
+ gem 'molflow', path: '../molflow'
7
+ gem 'pry'
8
+
9
+ group :test do
10
+ gem "rspec", "~> 3.1"
11
+ end
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "molflow"
3
+ require 'molflow/cli'
5
4
 
6
- Molflow::Application.new.run
5
+ Molflow::CLI.start
@@ -3,6 +3,7 @@ require 'rake'
3
3
  Rake.application.options.trace = true
4
4
 
5
5
  require 'molflow/application'
6
+ require 'molflow/jira_client'
6
7
  require 'molflow/version'
7
8
 
8
9
  module Molflow
@@ -0,0 +1,38 @@
1
+ require 'thor'
2
+ require 'pry'
3
+
4
+ module Molflow
5
+ class CLI < Thor
6
+ # molflow install
7
+
8
+ desc 'install', 'Install Figaro'
9
+
10
+ method_option 'path',
11
+ aliases: ['-p'],
12
+ default: "#{ENV['HOME']}/.molflow",
13
+ desc: 'Specify a configuration file path'
14
+
15
+ def install
16
+ require 'molflow/cli/install'
17
+ Install.start
18
+ end
19
+
20
+ # molflow jira:ps
21
+
22
+ desc 'jira:ps', 'The list of projects in jira'
23
+
24
+ define_method 'jira:ps' do
25
+ require 'molflow/cli/jira_projects'
26
+ JiraProjects.run(options)
27
+ end
28
+
29
+ # molflow jira:is
30
+
31
+ desc 'jira:is', 'The list of projects in jira'
32
+
33
+ define_method 'jira:is' do
34
+ require 'molflow/cli/jira_issues'
35
+ JiraIssues.run(options)
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,30 @@
1
+ require 'thor/group'
2
+
3
+ module Molflow
4
+ class CLI < Thor
5
+ class Install < Thor::Group
6
+ include Thor::Actions
7
+
8
+ class_option 'path',
9
+ aliases: ['-p'],
10
+ default: "#{ENV['HOME']}/.molflow",
11
+ desc: 'Specify a configuration file path'
12
+
13
+ def self.source_root
14
+ File.expand_path('../install', __FILE__)
15
+ end
16
+
17
+ def create_configuration
18
+ @site = ask('Atlassian site: ')
19
+ @username = ask('Atlassian username: ')
20
+ @password = ask('Atlassian password: ')
21
+
22
+ template('molflow', options[:path])
23
+ end
24
+
25
+ def complete
26
+ say('COMPLETE!', :green)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,3 @@
1
+ site: '<%= @site %>'
2
+ username: '<%= @username %>'
3
+ password: '<%= @password %>'
@@ -0,0 +1,20 @@
1
+ require 'molflow/jira'
2
+ require 'molflow/cli/task'
3
+
4
+ module Molflow
5
+ class CLI < Thor
6
+ class JiraIssues < Task
7
+
8
+ def run
9
+ client = Jira.client
10
+ jql = 'assignee = currentUser() AND (status = "To Do" OR status = "In Progress") AND (labels not in (Приостановлен) OR labels is EMPTY) ORDER BY updatedDate DESC'
11
+
12
+ issues = client.Issue.jql(jql)
13
+
14
+ issues.each do |issue|
15
+ puts "#{issue.key} : #{issue.summary}"
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ require "molflow/jira"
2
+ require "molflow/cli/task"
3
+
4
+ module Molflow
5
+ class CLI < Thor
6
+ class JiraProjects < Task
7
+
8
+ def run
9
+ client = Jira.client
10
+ @projects = client.Project.all
11
+
12
+ @projects.each do |project|
13
+ puts("#{project.key} : #{project.name}")
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ module Molflow
2
+ class CLI < Thor
3
+ class Task
4
+ attr_reader :options
5
+
6
+ def self.run(options = {})
7
+ new(options).run
8
+ end
9
+
10
+ def initialize(options = {})
11
+ @options = options
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1 +1,22 @@
1
- load File.expand_path(File.join(File.dirname(__FILE__),'tasks/jira.rake'))
1
+ require 'jira'
2
+ require 'yaml'
3
+
4
+ module Molflow
5
+ class Jira
6
+ def self.client
7
+ config_path = "#{ENV['HOME']}/.molflow"
8
+ config_of_file = YAML.load_file(config_path)
9
+
10
+ options = {
11
+ username: config_of_file['username'],
12
+ password: config_of_file['password'],
13
+ site: config_of_file['site'],
14
+ auth_type: :basic,
15
+ context_path: '',
16
+ use_ssl: true
17
+ }
18
+
19
+ JIRA::Client.new(options)
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module Molflow
2
- VERSION = "0.1.6"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -14,9 +14,12 @@ Gem::Specification.new do |s|
14
14
  s.files = `git ls-files`.split($/)
15
15
 
16
16
  s.required_ruby_version = '>= 1.9.3'
17
- s.add_runtime_dependency 'rake', '~> 10.0', '>= 10.0.0'
17
+ s.add_dependency "thor", "~> 0.14"
18
18
  s.add_dependency 'jira-ruby','~> 0.1'
19
19
 
20
+ s.add_development_dependency "bundler", "~> 1.7"
21
+ s.add_development_dependency "rake", "~> 10.4"
22
+
20
23
  s.executables = %w(molflow)
21
24
  s.require_paths = ["lib"]
22
25
  end
@@ -1,2 +1,4 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'molflow'
1
+ require "bundler"
2
+ Bundler.setup
3
+
4
+ Bundler.require(:test)
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: molflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Silaev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2015-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '10.0'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 10.0.0
19
+ version: '0.14'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '10.0'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 10.0.0
26
+ version: '0.14'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: jira-ruby
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,6 +38,34 @@ dependencies:
44
38
  - - "~>"
45
39
  - !ruby/object:Gem::Version
46
40
  version: '0.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.4'
47
69
  description: Workflow in Molinos
48
70
  email:
49
71
  - dmsilaev@yandex.ru
@@ -59,17 +81,16 @@ files:
59
81
  - LICENSE.txt
60
82
  - README.md
61
83
  - Rakefile
62
- - bin/console
63
84
  - bin/molflow
64
- - bin/setup
65
85
  - lib/Rakefile
66
86
  - lib/molflow.rb
67
- - lib/molflow/application.rb
68
- - lib/molflow/install.rb
87
+ - lib/molflow/cli.rb
88
+ - lib/molflow/cli/install.rb
89
+ - lib/molflow/cli/install/molflow
90
+ - lib/molflow/cli/jira_issues.rb
91
+ - lib/molflow/cli/jira_projects.rb
92
+ - lib/molflow/cli/task.rb
69
93
  - lib/molflow/jira.rb
70
- - lib/molflow/tasks/install.rake
71
- - lib/molflow/tasks/jira.rake
72
- - lib/molflow/templates/molflow.erb
73
94
  - lib/molflow/version.rb
74
95
  - molflow.gemspec
75
96
  - spec/molflow_spec.rb
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "molflow"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
@@ -1,18 +0,0 @@
1
- module Molflow
2
- class Application < Rake::Application
3
- def initialize
4
- super
5
- @rakefiles = %w{Capfile} << rakefile
6
- end
7
-
8
- def run
9
- Rake.application = self
10
- super
11
- end
12
-
13
- # allows the `cap install` task to load without a capfile
14
- def rakefile
15
- File.expand_path(File.join(File.dirname(__FILE__),'..','Rakefile'))
16
- end
17
- end
18
- end
@@ -1 +0,0 @@
1
- load File.expand_path(File.join(File.dirname(__FILE__),'tasks/install.rake'))
@@ -1,43 +0,0 @@
1
- require 'erb'
2
- require 'pathname'
3
-
4
- task :install do
5
- home_dir = Pathname.new(ENV['HOME'])
6
- molflow = File.expand_path("../../templates/molflow.erb", __FILE__)
7
-
8
- entries = [{ template: molflow, file: home_dir.join('.molflow') }]
9
-
10
- entries.each do |entry|
11
- if File.exists?(entry[:file])
12
- warn "[skip] #{entry[:file]} already exists"
13
- else
14
- File.open(entry[:file], 'w+') do |f|
15
- f.write(ERB.new(File.read(entry[:template])).result(binding))
16
- end
17
- end
18
- end
19
- end
20
-
21
- def site
22
- STDOUT.puts "atlassian site:"
23
- input = STDIN.gets.chomp
24
- raise "enter address" if input == ''
25
-
26
- input
27
- end
28
-
29
- def username
30
- STDOUT.puts "atlassian username:"
31
- input = STDIN.gets.chomp
32
- raise "enter username" if input == ''
33
-
34
- input
35
- end
36
-
37
- def password
38
- STDOUT.puts "atlassian password:"
39
- input = STDIN.gets.chomp
40
- raise "enter password" if input == ''
41
-
42
- input
43
- end
@@ -1,40 +0,0 @@
1
- require 'jira'
2
- require 'yaml'
3
-
4
- namespace :jira do
5
- molflow_config_file = Pathname.new(ENV['HOME']).join('.molflow')
6
-
7
- if File.exist?(molflow_config_file)
8
- molflow_config = YAML.load_file(molflow_config_file)
9
-
10
- options = {
11
- :username => molflow_config['username'],
12
- :password => molflow_config['password'],
13
- :site => molflow_config['site'],
14
- :auth_type => :basic,
15
- :context_path => '',
16
- :use_ssl => true
17
- }
18
-
19
- @client = JIRA::Client.new(options)
20
- end
21
-
22
- task :ps do
23
- # Show all projects
24
- @projects = @client.Project.all
25
- @projects.each do |project|
26
- puts "#{project.key} : #{project.name}"
27
- end
28
- end
29
-
30
- task :is do
31
- jql = 'assignee = currentUser() AND (status = "To Do" OR status = "In Progress") AND (labels not in (Приостановлен) OR labels is EMPTY) ORDER BY updatedDate DESC'
32
-
33
- @issues = @client.Issue.jql(jql)
34
-
35
- @issues.each do |issue|
36
- puts "#{issue.key} : #{issue.summary}"
37
- end
38
- end
39
- end
40
-
@@ -1,3 +0,0 @@
1
- site: '<%= site %>'
2
- username: '<%= username %>'
3
- password: '<%= password %>'